Patchwork rebase: check no-op before checking phase (issue3891)

login
register
mail settings
Submitter Siddharth Agarwal
Date April 18, 2013, 9:29 p.m.
Message ID <a77758d82ce0091c677b.1366320574@sid0x220>
Download mbox | patch
Permalink /patch/1445/
State Accepted, archived
Headers show

Comments

Siddharth Agarwal - April 18, 2013, 9:29 p.m.
# HG changeset patch
# User Siddharth Agarwal <sid0@fb.com>
# Date 1366320486 25200
#      Thu Apr 18 14:28:06 2013 -0700
# Node ID a77758d82ce0091c677bbf362592a69a4af522b0
# Parent  47f18c9d3989b677fba570f43f03405849eb6804
rebase: check no-op before checking phase (issue3891)

This could lead to user confusion, because phases aren't really involved at
all when attempting to perform a no-op rebase.
Matt Mackall - April 18, 2013, 10:34 p.m.
On Thu, 2013-04-18 at 14:29 -0700, Siddharth Agarwal wrote:
> # HG changeset patch
> # User Siddharth Agarwal <sid0@fb.com>
> # Date 1366320486 25200
> #      Thu Apr 18 14:28:06 2013 -0700
> # Node ID a77758d82ce0091c677bbf362592a69a4af522b0
> # Parent  47f18c9d3989b677fba570f43f03405849eb6804
> rebase: check no-op before checking phase (issue3891)

Queued for default, thanks.

Patch

diff -r 47f18c9d3989 -r a77758d82ce0 hgext/rebase.py
--- a/hgext/rebase.py	Thu Mar 28 00:30:40 2013 -0700
+++ b/hgext/rebase.py	Thu Apr 18 14:28:06 2013 -0700
@@ -209,10 +209,6 @@  def rebase(ui, repo, **opts):
                     _("can't remove original changesets with"
                       " unrebased descendants"),
                     hint=_('use --keep to keep original changesets'))
-            elif not keepf and not repo[root].mutable():
-                raise util.Abort(_("can't rebase immutable changeset %s")
-                                 % repo[root],
-                                 hint=_('see hg help phases for details'))
             else:
                 result = buildstate(repo, dest, rebaseset, collapsef)
 
@@ -220,6 +216,10 @@  def rebase(ui, repo, **opts):
                 # Empty state built, nothing to rebase
                 ui.status(_('nothing to rebase\n'))
                 return 1
+            elif not keepf and not repo[root].mutable():
+                raise util.Abort(_("can't rebase immutable changeset %s")
+                                 % repo[root],
+                                 hint=_('see hg help phases for details'))
             else:
                 originalwd, target, state = result
                 if collapsef:
diff -r 47f18c9d3989 -r a77758d82ce0 tests/test-rebase-scenario-global.t
--- a/tests/test-rebase-scenario-global.t	Thu Mar 28 00:30:40 2013 -0700
+++ b/tests/test-rebase-scenario-global.t	Thu Apr 18 14:28:06 2013 -0700
@@ -276,6 +276,9 @@  C onto A - rebase onto an ancestor:
 Check rebasing public changeset
 
   $ hg pull --config phases.publish=True -q -r 6 . # update phase of 6
+  $ hg rebase -d 0 -b 6
+  nothing to rebase
+  [1]
   $ hg rebase -d 5 -b 6
   abort: can't rebase immutable changeset e1c4361dd923
   (see hg help phases for details)