diff options
author | Manuel Jacob <me@manueljacob.de> | 2020-06-22 00:22:30 +0200 |
---|---|---|
committer | Daniel Shahaf <d.s@daniel.shahaf.name> | 2020-06-22 08:18:38 +0000 |
commit | ae0129b49f9f1b624fb4b067f6f1ef6757a24fd2 (patch) | |
tree | 2e4dfc8d12844bf844fdb6150ece4bf0929c0bd8 /Functions/VCS_Info/Backends | |
parent | 8bd46bf2a241e0e3a32a24ce2333095214b3b77a (diff) | |
download | zsh-ae0129b49f9f1b624fb4b067f6f1ef6757a24fd2.tar.gz zsh-ae0129b49f9f1b624fb4b067f6f1ef6757a24fd2.tar.xz zsh-ae0129b49f9f1b624fb4b067f6f1ef6757a24fd2.zip |
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.
Diffstat (limited to 'Functions/VCS_Info/Backends')
-rw-r--r-- | Functions/VCS_Info/Backends/VCS_INFO_get_data_hg | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/Functions/VCS_Info/Backends/VCS_INFO_get_data_hg b/Functions/VCS_Info/Backends/VCS_INFO_get_data_hg index cd5ef321d..9f61aeaf4 100644 --- a/Functions/VCS_Info/Backends/VCS_INFO_get_data_hg +++ b/Functions/VCS_Info/Backends/VCS_INFO_get_data_hg @@ -5,7 +5,7 @@ setopt localoptions extendedglob NO_shwordsplit -local hgbase bmfile branchfile rebasefile dirstatefile mqseriesfile \ +local hgbase bmfile branchfile topicfile rebasefile dirstatefile mqseriesfile \ curbmfile curbm \ mqstatusfile mqguardsfile patchdir mergedir \ r_csetid r_lrev r_branch i_bmhash i_bmname \ @@ -27,6 +27,7 @@ mergedir="${hgbase}/.hg/merge/" bmfile="${hgbase}/.hg/bookmarks" curbmfile="${hgbase}/.hg/bookmarks.current" branchfile="${hgbase}/.hg/branch" +topicfile="${hgbase}/.hg/topic" rebasefile="${hgbase}/.hg/rebasestate" dirstatefile="${hgbase}/.hg/dirstate" 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 [[ -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 + if [[ $r_lrev[-1] == + ]] ; then hgchanges=1 |