[PATCH] commit: show active bookmark in commit editor helper text

Kevin Bullock kbullock+mercurial at ringworld.org
Fri Feb 1 22:46:29 CST 2013


On 1 Feb 2013, at 5:40 PM, Matt Mackall wrote:

> On Fri, 2013-02-01 at 21:30 -0200, Antonio Zanardo wrote:
>> # HG changeset patch
>> # User Antonio Zanardo <zanardo at gmail.com>
>> # Date 1359333800 7200
>> # Node ID c9d1310d1bfe5769f2e7006125586c68660db531
>> # 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.
> 
> Seems like a good idea. Probably wants a test rolled into one of the
> existing test cases in test-commit.t.
> 
> Not entirely sure if this does the right thing with regard to current vs
> active bookmarks. May need some discussion.

Pretty sure it doesn't. If you have an active bookmark that isn't at the working directory, committing will not advance it (and in fact, I think we'll want to deactivate it in this case). This patch doesn't check for that.

>> 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.
>> 
>> diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py
>> --- a/mercurial/cmdutil.py
>> +++ b/mercurial/cmdutil.py
>> @@ -1793,6 +1793,8 @@
>>          edittext.append(_("HG: branch merge"))
>>      if ctx.branch():
>>          edittext.append(_("HG: branch '%s'") % ctx.branch())
>> +    if repo._bookmarkcurrent:

Here you want:
         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])

pacem in terris / мир / शान्ति / ‎‫سَلاَم‬ / 平和
Kevin R. Bullock



More information about the Mercurial-devel mailing list