diff hgext/rebase.py @ 14897:b9daa5b7a3af stable

rebase: block collapse with keepbranches on multiple named branches (issue2112) Collapse and keepbranches should be blocked when there is more than one named branch on the branch that's going to be rebased.
author Stefano Tortarolo <stefano.tortarolo@gmail.com>
date Mon, 18 Jul 2011 22:58:21 +0200
parents c0ccd70df52c
children 2957b8b1e809
line wrap: on
line diff
--- a/hgext/rebase.py	Sat Jul 16 15:24:28 2011 +0300
+++ b/hgext/rebase.py	Mon Jul 18 22:58:21 2011 +0200
@@ -175,6 +175,14 @@
             assert not extrafn, 'cannot use both keepbranches and extrafn'
             def extrafn(ctx, extra):
                 extra['branch'] = ctx.branch()
+            if collapsef:
+                branches = set()
+                for rev in state:
+                    branches.add(repo[rev].branch())
+                    if len(branches) > 1:
+                        raise util.Abort(_('cannot collapse multiple named ' 
+                            'branches'))
+
 
         # Rebase
         if not targetancestors: