Skip to content

Commit ae0129b

Browse files
manueljacobdanielshahaf
authored andcommitted
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.
1 parent 8bd46bf commit ae0129b

3 files changed

Lines changed: 18 additions & 2 deletions

File tree

ChangeLog

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
2020-06-22 Manuel Jacob <me@manueljacob.de>
2+
3+
* 46091: Doc/Zsh/contrib.yo,
4+
Functions/VCS_Info/Backends/VCS_INFO_get_data_hg: Add code to
5+
Mercurial VCS backend to show topic if there is any.
6+
17
2020-06-19 Daniel Shahaf <d.s@daniel.shahaf.name>
28

39
* 46044 (tweaked per Matthew): Completion/Unix/Command/_units:

Doc/Zsh/contrib.yo

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1328,7 +1328,8 @@ enditem()
13281328
In tt(branchformat) these replacements are done:
13291329

13301330
startsitem()
1331-
sitem(tt(%b))(The branch name.)
1331+
sitem(tt(%b))(The branch name. For tt(hg), the branch name can include a
1332+
topic name.)
13321333
sitem(tt(%r))(The current revision number or the tt(hgrevformat) style for
13331334
tt(hg).)
13341335
endsitem()

Functions/VCS_Info/Backends/VCS_INFO_get_data_hg

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
setopt localoptions extendedglob NO_shwordsplit
77

8-
local hgbase bmfile branchfile rebasefile dirstatefile mqseriesfile \
8+
local hgbase bmfile branchfile topicfile rebasefile dirstatefile mqseriesfile \
99
curbmfile curbm \
1010
mqstatusfile mqguardsfile patchdir mergedir \
1111
r_csetid r_lrev r_branch i_bmhash i_bmname \
@@ -27,6 +27,7 @@ mergedir="${hgbase}/.hg/merge/"
2727
bmfile="${hgbase}/.hg/bookmarks"
2828
curbmfile="${hgbase}/.hg/bookmarks.current"
2929
branchfile="${hgbase}/.hg/branch"
30+
topicfile="${hgbase}/.hg/topic"
3031
rebasefile="${hgbase}/.hg/rebasestate"
3132
dirstatefile="${hgbase}/.hg/dirstate"
3233
mqstatusfile="${patchdir}/status" # currently applied patches
@@ -69,6 +70,14 @@ fi
6970
# If we still don't know the branch it's safe to assume default
7071
[[ -n ${r_branch} ]] || r_branch="default"
7172

73+
# Show topic if there is any (the UI for this experimental concept is not yet
74+
# final, but for a long time the convention has been to join the branch name
75+
# and the topic name by a colon)
76+
if [[ -f ${topicfile} && -r ${topicfile} && -s ${topicfile} ]] ; then
77+
IFS= read -r REPLY < ${topicfile}
78+
r_branch=${r_branch}:${REPLY}
79+
fi
80+
7281
# The working dir has uncommitted-changes if the revision ends with a +
7382
if [[ $r_lrev[-1] == + ]] ; then
7483
hgchanges=1

0 commit comments

Comments
 (0)