histedit: make check for unresolved conflicts explicit (issue5545) stable
authorSiddharth Agarwal <sid0@fb.com>
Thu, 20 Apr 2017 17:18:08 -0700
branchstable
changeset 32057 e5ffc91a2276
parent 32056 59afb0750aec
child 32058 0bb157bebb43
histedit: make check for unresolved conflicts explicit (issue5545) Previously, we'd rely on the implicit check that `localrepo.commit` did. The problem is that that check only happened when the working copy was dirty. With a "clean" working copy but unresolved conflicts we'd get into a broken state. To fix that, do what rebase does and check for unresolved conflicts at the start of histedit --continue.
hgext/histedit.py
tests/test-histedit-non-commute.t
--- a/hgext/histedit.py	Tue Apr 18 14:51:30 2017 -0500
+++ b/hgext/histedit.py	Thu Apr 20 17:18:08 2017 -0700
@@ -198,6 +198,7 @@
     hg,
     lock,
     merge as mergemod,
+    mergeutil,
     node,
     obsolete,
     repair,
@@ -1297,6 +1298,10 @@
 
 def bootstrapcontinue(ui, state, opts):
     repo = state.repo
+
+    ms = mergemod.mergestate.read(repo)
+    mergeutil.checkunresolved(ms)
+
     if state.actions:
         actobj = state.actions.pop(0)
 
--- a/tests/test-histedit-non-commute.t	Tue Apr 18 14:51:30 2017 -0500
+++ b/tests/test-histedit-non-commute.t	Thu Apr 20 17:18:08 2017 -0700
@@ -161,12 +161,17 @@
   warning: conflicts while merging e! (edit, then use 'hg resolve --mark')
   Fix up the change (pick 7b4e2f4b7bcd)
   (hg histedit --continue to resume)
+  $ hg histedit --continue 2>&1 | fixbundle
+  abort: unresolved merge conflicts (see 'hg help resolve')
 
 This failure is caused by 7b4e2f4b7bcd "e" not rebasing the non commutative
 former children.
 
 just continue this time
   $ hg revert -r 'p1()' e
+make sure the to-be-empty commit doesn't screw up the state (issue5545)
+  $ hg histedit --continue 2>&1 | fixbundle
+  abort: unresolved merge conflicts (see 'hg help resolve')
   $ hg resolve --mark e
   (no more unresolved files)
   continue: hg histedit --continue