Patchwork [2,of,2,V2,stable?] rebase: prioritize indicating an interrupted rebase over update (issue5838)

login
register
mail settings
Submitter Matt Harbison
Date June 3, 2018, 10:44 p.m.
Message ID <c19516ec13215f08d30d.1528065854@Envy>
Download mbox | patch
Permalink /patch/31956/
State Accepted
Headers show

Comments

Matt Harbison - June 3, 2018, 10:44 p.m.
# HG changeset patch
# User Matt Harbison <matt_harbison@yahoo.com>
# Date 1527961484 14400
#      Sat Jun 02 13:44:44 2018 -0400
# Node ID c19516ec13215f08d30dcb30765e64abf8ba4d69
# Parent  e134101a72dfe7fb4d6a90a35bfa2103f76d07c8
rebase: prioritize indicating an interrupted rebase over update (issue5838)

This should also cover the transplant extension, and any other non clearable
states.

Patch

diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py
--- a/mercurial/cmdutil.py
+++ b/mercurial/cmdutil.py
@@ -3187,8 +3187,16 @@  def checkunfinished(repo, commit=False):
     if found. It's probably good to check this right before
     bailifchanged().
     '''
+    # Check for non-clearable states first, so things like rebase will take
+    # precedence over update.
     for f, clearable, allowcommit, msg, hint in unfinishedstates:
-        if commit and allowcommit:
+        if clearable or (commit and allowcommit):
+            continue
+        if repo.vfs.exists(f):
+            raise error.Abort(msg, hint=hint)
+
+    for f, clearable, allowcommit, msg, hint in unfinishedstates:
+        if not clearable or (commit and allowcommit):
             continue
         if repo.vfs.exists(f):
             raise error.Abort(msg, hint=hint)
diff --git a/tests/test-rebase-abort.t b/tests/test-rebase-abort.t
--- a/tests/test-rebase-abort.t
+++ b/tests/test-rebase-abort.t
@@ -387,10 +387,9 @@  New operations are blocked with the corr
   .hg/undo.dirstate
   .hg/updatestate
 
-XXX: This should complain about needing to abort/continue rebase
   $ hg rebase -s 3 -d tip
-  abort: last update was interrupted
-  (use 'hg update' to get a consistent checkout)
+  abort: rebase in progress
+  (use 'hg rebase --continue' or 'hg rebase --abort')
   [255]
   $ hg up .
   abort: rebase in progress
@@ -401,10 +400,9 @@  XXX: This should complain about needing 
   (use 'hg rebase --continue' or 'hg rebase --abort')
   [255]
 
-XXX: This should complain about needing to abort/continue rebase
   $ hg graft 3
-  abort: last update was interrupted
-  (use 'hg update' to get a consistent checkout)
+  abort: rebase in progress
+  (use 'hg rebase --continue' or 'hg rebase --abort')
   [255]
 
   $ hg rebase --abort