Patchwork [STABLE] histedit: make check for unresolved conflicts explicit (issue5545)

login
register
mail settings
Submitter Siddharth Agarwal
Date April 21, 2017, 12:19 a.m.
Message ID <f368dbe9671ece414c84.1492733945@devvm028.frc2.facebook.com>
Download mbox | patch
Permalink /patch/20274/
State Accepted
Headers show

Comments

Siddharth Agarwal - April 21, 2017, 12:19 a.m.
# HG changeset patch
# User Siddharth Agarwal <sid0@fb.com>
# Date 1492733888 25200
#      Thu Apr 20 17:18:08 2017 -0700
# Node ID f368dbe9671ece414c842f164269e893521e3e5d
# Parent  ed42e00a5c4ec7a3bebaec699ef934429cdc2ddd
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.
Yuya Nishihara - April 21, 2017, 1:01 p.m.
On Thu, 20 Apr 2017 17:19:05 -0700, Siddharth Agarwal wrote:
> # HG changeset patch
> # User Siddharth Agarwal <sid0@fb.com>
> # Date 1492733888 25200
> #      Thu Apr 20 17:18:08 2017 -0700
> # Node ID f368dbe9671ece414c842f164269e893521e3e5d
> # Parent  ed42e00a5c4ec7a3bebaec699ef934429cdc2ddd
> 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.

Looks good. Queued, thanks.

Patch

diff --git a/hgext/histedit.py b/hgext/histedit.py
--- a/hgext/histedit.py
+++ b/hgext/histedit.py
@@ -198,6 +198,7 @@  from mercurial import (
     hg,
     lock,
     merge as mergemod,
+    mergeutil,
     node,
     obsolete,
     repair,
@@ -1297,6 +1298,10 @@  def _getsummary(ctx):
 
 def bootstrapcontinue(ui, state, opts):
     repo = state.repo
+
+    ms = mergemod.mergestate.read(repo)
+    mergeutil.checkunresolved(ms)
+
     if state.actions:
         actobj = state.actions.pop(0)
 
diff --git a/tests/test-histedit-non-commute.t b/tests/test-histedit-non-commute.t
--- a/tests/test-histedit-non-commute.t
+++ b/tests/test-histedit-non-commute.t
@@ -161,12 +161,17 @@  fix up
   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