Patchwork commit: show active bookmark in commit editor helper text

login
register
mail settings
Submitter Antonio Zanardo
Date Feb. 1, 2013, 11:30 p.m.
Message ID <510C5033.6040309@gmail.com>
Download mbox | patch
Permalink /patch/795/
State Superseded
Headers show

Comments

Antonio Zanardo - Feb. 1, 2013, 11:30 p.m.
# HG changeset patch
# User Antonio Zanardo <zanardo@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.

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.
Matt Mackall - Feb. 1, 2013, 11:40 p.m.
On Fri, 2013-02-01 at 21:30 -0200, Antonio Zanardo wrote:
> # HG changeset patch
> # User Antonio Zanardo <zanardo@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.

> 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:
> +        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])
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel@selenic.com
> http://selenic.com/mailman/listinfo/mercurial-devel
Pierre-Yves David - Feb. 3, 2013, 10:09 a.m.
On Fri, Feb 01, 2013 at 09:30:59PM -0200, Antonio Zanardo wrote:
> # HG changeset patch
> # User Antonio Zanardo <zanardo@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.
> 
> 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 feature makes a lot of sense and code looks good.  However your patch lack
test. We need a simple test making a bookmark appear in the editor to make sure
the feature won't be broken in the future.

For details see: http://mercurial.selenic.com/wiki/WritingTests

> 
> 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:
> +        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])
Pierre-Yves David - Feb. 3, 2013, 10:13 a.m.
On Sun, Feb 03, 2013 at 11:09:12AM +0100, Pierre-Yves David wrote:
> On Fri, Feb 01, 2013 at 09:30:59PM -0200, Antonio Zanardo wrote:
> > # HG changeset patch
> > # User Antonio Zanardo <zanardo@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.
> > 
> > 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 feature makes a lot of sense and code looks good.  However your patch lack
> test. We need a simple test making a bookmark appear in the editor to make sure
> the feature won't be broken in the future.
> 
> For details see: http://mercurial.selenic.com/wiki/WritingTests

I see it is already addressed later in the thread.
Ignore this email.

Patch

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:
+        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])