Patchwork [10,of,10] rebase: tell when reopening a closed branch head

login
register
mail settings
Submitter Mads Kiilerich
Date Jan. 12, 2014, 4:08 p.m.
Message ID <bfabe840bde50753f385.1389542888@localhost.localdomain>
Download mbox | patch
Permalink /patch/3304/
State Superseded
Headers show

Comments

Mads Kiilerich - Jan. 12, 2014, 4:08 p.m.
# HG changeset patch
# User Mads Kiilerich <madski@unity3d.com>
# Date 1385432336 -3600
#      Tue Nov 26 03:18:56 2013 +0100
# Node ID bfabe840bde50753f38507074644716c62399734
# Parent  7731c6d3de0db683cfc4f0f2846556732b790b8e
rebase: tell when reopening a closed branch head

Give same 'reopening closed branch head X' message as commit gives.
Pierre-Yves David - Jan. 13, 2014, 8:30 a.m.
On Sun, Jan 12, 2014 at 05:08:08PM +0100, Mads Kiilerich wrote:
> # HG changeset patch
> # User Mads Kiilerich <madski@unity3d.com>
> # Date 1385432336 -3600
> #      Tue Nov 26 03:18:56 2013 +0100
> # Node ID bfabe840bde50753f38507074644716c62399734
> # Parent  7731c6d3de0db683cfc4f0f2846556732b790b8e
> rebase: tell when reopening a closed branch head

I like the idea, but the implementation seems to fall a bit short.

> Give same 'reopening closed branch head X' message as commit gives.
> 
> diff --git a/hgext/rebase.py b/hgext/rebase.py
> --- a/hgext/rebase.py
> +++ b/hgext/rebase.py
> @@ -295,6 +295,9 @@ def rebase(ui, repo, **opts):
>                                                             inclusive=True)
>                  external = externalparent(repo, state, targetancestors)
>  
> +            if dest.closesbranch():
> +                ui.status(_('reopening closed branch head %s\n') % dest)
> +

This is not as simple if --keepbranches is used. we may rebase changeset from
different branch only.

>          if keepbranchesf:
>              # insert _savebranch at the start of extrafns so if
>              # there's a user-provided extrafn it can clobber branch if
> diff --git a/tests/test-rebase-named-branches.t b/tests/test-rebase-named-branches.t
> --- a/tests/test-rebase-named-branches.t
> +++ b/tests/test-rebase-named-branches.t
> @@ -316,6 +316,7 @@ rebase 'c1' to the branch head 'c2' that
>    o  0: '0'
>    
>    $ hg rebase
> +  reopening closed branch head 8427af5d86f2
>    saved backup bundle to $TESTTMP/case2/.hg/strip-backup/c062e3ecd6c6-backup.hg (glob)
>    $ hg tglog
>    @  3: 'c2 closed' c
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel@selenic.com
> http://selenic.com/mailman/listinfo/mercurial-devel

Patch

diff --git a/hgext/rebase.py b/hgext/rebase.py
--- a/hgext/rebase.py
+++ b/hgext/rebase.py
@@ -295,6 +295,9 @@  def rebase(ui, repo, **opts):
                                                            inclusive=True)
                 external = externalparent(repo, state, targetancestors)
 
+            if dest.closesbranch():
+                ui.status(_('reopening closed branch head %s\n') % dest)
+
         if keepbranchesf:
             # insert _savebranch at the start of extrafns so if
             # there's a user-provided extrafn it can clobber branch if
diff --git a/tests/test-rebase-named-branches.t b/tests/test-rebase-named-branches.t
--- a/tests/test-rebase-named-branches.t
+++ b/tests/test-rebase-named-branches.t
@@ -316,6 +316,7 @@  rebase 'c1' to the branch head 'c2' that
   o  0: '0'
   
   $ hg rebase
+  reopening closed branch head 8427af5d86f2
   saved backup bundle to $TESTTMP/case2/.hg/strip-backup/c062e3ecd6c6-backup.hg (glob)
   $ hg tglog
   @  3: 'c2 closed' c