[PATCH] commit: show active bookmark in commit editor helper text
Antonio Zanardo
zanardo at gmail.com
Sat Feb 2 11:47:23 CST 2013
# HG changeset patch
# User Antonio Zanardo <zanardo at gmail.com>
# Date 1359826637 7200
# Node ID 18fe48212f7d922727a38e9d2c0e8bd7100b9f44
# Parent 7068089c95a2ff3c1b536bbb52ca6bc1f06fc06e
commit: show active bookmark in commit editor helper text
If there is an active bookmark while committing, the bookmark name
will be visible inside the commit message helper, below the branch
name.
This should make easier for the user to detect a mistaken commit
parent, while working for example with a bookmark centric workflow
like topic branches.
The active bookmark is checked to be in the working directory, as
pointed by Kevin Bullock, because otherwise committing would not
advance it. In other words, this would not show the active
bookmark name if the user changed the working tree parents with
'hg debugsetparents', for example.
diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py
--- a/mercurial/cmdutil.py
+++ b/mercurial/cmdutil.py
@@ -12,6 +12,7 @@
import match as matchmod
import subrepo, context, repair, graphmod, revset, phases, obsolete
import changelog
+import bookmarks
import lock as lockmod
def parsealiases(cmd):
@@ -1793,6 +1794,8 @@
edittext.append(_("HG: branch merge"))
if ctx.branch():
edittext.append(_("HG: branch '%s'") % ctx.branch())
+ if bookmarks.iscurrent(repo):
+ edittext.append(_("HG: bookmark '%s'") % repo._bookmarkcurrent)
edittext.extend([_("HG: subrepo %s") % s for s in subs])
edittext.extend([_("HG: added %s") % f for f in added])
edittext.extend([_("HG: changed %s") % f for f in modified])
diff --git a/tests/test-commit.t b/tests/test-commit.t
--- a/tests/test-commit.t
+++ b/tests/test-commit.t
@@ -263,6 +263,7 @@
$ cd commitmsg
$ echo changed > changed
$ echo removed > removed
+ $ hg book currentbookmark
$ hg ci -qAm init
$ hg rm removed
@@ -277,6 +278,7 @@
HG: --
HG: user: test
HG: branch 'default'
+ HG: bookmark 'currentbookmark'
HG: added added
HG: changed changed
HG: removed removed
More information about the Mercurial-devel
mailing list