rebase: abort if *any* commit in rebase set is public
authorMartin von Zweigbergk <martinvonz@google.com>
Sat, 11 Mar 2017 10:35:44 -0800
changeset 31302 681046de87f1
parent 31301 295625f1296b
child 31303 90f439823b99
rebase: abort if *any* commit in rebase set is public
hgext/rebase.py
tests/test-rebase-scenario-global.t
--- a/hgext/rebase.py	Sat Mar 11 13:53:14 2017 -0500
+++ b/hgext/rebase.py	Sat Mar 11 10:35:44 2017 -0800
@@ -326,11 +326,11 @@
             self.ui.status(_('nothing to rebase\n'))
             return _nothingtorebase()
 
-        root = min(rebaseset)
-        if not self.keepf and not self.repo[root].mutable():
-            raise error.Abort(_("can't rebase public changeset %s")
-                             % self.repo[root],
-                             hint=_("see 'hg help phases' for details"))
+        for root in self.repo.set('roots(%ld)', rebaseset):
+            if not self.keepf and not root.mutable():
+                raise error.Abort(_("can't rebase public changeset %s")
+                                  % root,
+                                  hint=_("see 'hg help phases' for details"))
 
         (self.originalwd, self.target, self.state) = result
         if self.collapsef:
--- a/tests/test-rebase-scenario-global.t	Sat Mar 11 13:53:14 2017 -0500
+++ b/tests/test-rebase-scenario-global.t	Sat Mar 11 10:35:44 2017 -0800
@@ -329,6 +329,10 @@
   abort: can't rebase public changeset e1c4361dd923
   (see 'hg help phases' for details)
   [255]
+  $ hg rebase -d 5 -r '1 + (6::)'
+  abort: can't rebase public changeset e1c4361dd923
+  (see 'hg help phases' for details)
+  [255]
 
   $ hg rebase -d 5 -b 6 --keep
   rebasing 6:e1c4361dd923 "C"