1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2025-10-27 04:40:59 +01:00

46091: Add code to Mercurial VCS backend to show topic if there is any.

"Topics" is an experimental concept in Mercurial that augments the
current branching concept (called "named branches").

For more information, see the not always up-to-date Mercurial Wiki page
https://www.mercurial-scm.org/wiki/TopicPlan.
This commit is contained in:
Manuel Jacob 2020-06-22 00:22:30 +02:00 committed by Daniel Shahaf
parent 8bd46bf2a2
commit ae0129b49f
3 changed files with 18 additions and 2 deletions

View file

@ -1,3 +1,9 @@
2020-06-22 Manuel Jacob <me@manueljacob.de>
* 46091: Doc/Zsh/contrib.yo,
Functions/VCS_Info/Backends/VCS_INFO_get_data_hg: Add code to
Mercurial VCS backend to show topic if there is any.
2020-06-19 Daniel Shahaf <d.s@daniel.shahaf.name> 2020-06-19 Daniel Shahaf <d.s@daniel.shahaf.name>
* 46044 (tweaked per Matthew): Completion/Unix/Command/_units: * 46044 (tweaked per Matthew): Completion/Unix/Command/_units:

View file

@ -1328,7 +1328,8 @@ enditem()
In tt(branchformat) these replacements are done: In tt(branchformat) these replacements are done:
startsitem() startsitem()
sitem(tt(%b))(The branch name.) sitem(tt(%b))(The branch name. For tt(hg), the branch name can include a
topic name.)
sitem(tt(%r))(The current revision number or the tt(hgrevformat) style for sitem(tt(%r))(The current revision number or the tt(hgrevformat) style for
tt(hg).) tt(hg).)
endsitem() endsitem()

View file

@ -5,7 +5,7 @@
setopt localoptions extendedglob NO_shwordsplit setopt localoptions extendedglob NO_shwordsplit
local hgbase bmfile branchfile rebasefile dirstatefile mqseriesfile \ local hgbase bmfile branchfile topicfile rebasefile dirstatefile mqseriesfile \
curbmfile curbm \ curbmfile curbm \
mqstatusfile mqguardsfile patchdir mergedir \ mqstatusfile mqguardsfile patchdir mergedir \
r_csetid r_lrev r_branch i_bmhash i_bmname \ r_csetid r_lrev r_branch i_bmhash i_bmname \
@ -27,6 +27,7 @@ mergedir="${hgbase}/.hg/merge/"
bmfile="${hgbase}/.hg/bookmarks" bmfile="${hgbase}/.hg/bookmarks"
curbmfile="${hgbase}/.hg/bookmarks.current" curbmfile="${hgbase}/.hg/bookmarks.current"
branchfile="${hgbase}/.hg/branch" branchfile="${hgbase}/.hg/branch"
topicfile="${hgbase}/.hg/topic"
rebasefile="${hgbase}/.hg/rebasestate" rebasefile="${hgbase}/.hg/rebasestate"
dirstatefile="${hgbase}/.hg/dirstate" dirstatefile="${hgbase}/.hg/dirstate"
mqstatusfile="${patchdir}/status" # currently applied patches mqstatusfile="${patchdir}/status" # currently applied patches
@ -69,6 +70,14 @@ fi
# If we still don't know the branch it's safe to assume default # If we still don't know the branch it's safe to assume default
[[ -n ${r_branch} ]] || r_branch="default" [[ -n ${r_branch} ]] || r_branch="default"
# Show topic if there is any (the UI for this experimental concept is not yet
# final, but for a long time the convention has been to join the branch name
# and the topic name by a colon)
if [[ -f ${topicfile} && -r ${topicfile} && -s ${topicfile} ]] ; then
IFS= read -r REPLY < ${topicfile}
r_branch=${r_branch}:${REPLY}
fi
# The working dir has uncommitted-changes if the revision ends with a + # The working dir has uncommitted-changes if the revision ends with a +
if [[ $r_lrev[-1] == + ]] ; then if [[ $r_lrev[-1] == + ]] ; then
hgchanges=1 hgchanges=1