changeset 31302:681046de87f1

rebase: abort if *any* commit in rebase set is public
author Martin von Zweigbergk <martinvonz@google.com>
date Sat, 11 Mar 2017 10:35:44 -0800
parents 295625f1296b
children 90f439823b99
files hgext/rebase.py tests/test-rebase-scenario-global.t
diffstat 2 files changed, 9 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- 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"