Patchwork bisect: allow resetting with unfinished graft/rebase/etc

login
register
mail settings
Submitter via Mercurial-devel
Date May 3, 2017, 4:22 p.m.
Message ID <296ef8a3dfb5f665c5ce.1493828527@martinvonz.svl.corp.google.com>
Download mbox | patch
Permalink /patch/20405/
State Accepted
Headers show

Comments

via Mercurial-devel - May 3, 2017, 4:22 p.m.
# HG changeset patch
# User Martin von Zweigbergk <martinvonz@google.com>
# Date 1493827784 25200
#      Wed May 03 09:09:44 2017 -0700
# Node ID 296ef8a3dfb5f665c5ce54184d219b4174daa04b
# Parent  5f8450df55625fb0be8e40eacb662717fef33de2
bisect: allow resetting with unfinished graft/rebase/etc

"hg bisect --reset" just deletes the state file (it doesn't move back
to the starting point like rebase does); it can not conlict with an
ongoing rebase etc.

checkunfinished() has this documentation:

  It's probably good to check this right before bailifchanged().

So that's where I moved it.
Yuya Nishihara - May 4, 2017, 3:43 a.m.
On Wed, 03 May 2017 09:22:07 -0700, Martin von Zweigbergk via Mercurial-devel wrote:
> # HG changeset patch
> # User Martin von Zweigbergk <martinvonz@google.com>
> # Date 1493827784 25200
> #      Wed May 03 09:09:44 2017 -0700
> # Node ID 296ef8a3dfb5f665c5ce54184d219b4174daa04b
> # Parent  5f8450df55625fb0be8e40eacb662717fef33de2
> bisect: allow resetting with unfinished graft/rebase/etc

Looks good. Queued, thanks.

Patch

diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -837,8 +837,6 @@ 
     elif extra or good + bad + skip + reset + extend + bool(command) > 1:
         raise error.Abort(_('incompatible arguments'))
 
-    cmdutil.checkunfinished(repo)
-
     if reset:
         hbisect.resetstate(repo)
         return
@@ -865,6 +863,7 @@ 
         """common used update sequence"""
         if noupdate:
             return
+        cmdutil.checkunfinished(repo)
         cmdutil.bailifchanged(repo)
         return hg.clean(repo, node, show_stats=show_stats)
 
diff --git a/tests/test-bisect.t b/tests/test-bisect.t
--- a/tests/test-bisect.t
+++ b/tests/test-bisect.t
@@ -551,7 +551,14 @@ 
   date:        Thu Jan 01 00:00:06 1970 +0000
   summary:     msg 6
   
-
+  $ hg graft -q 15
+  warning: conflicts while merging a! (edit, then use 'hg resolve --mark')
+  abort: unresolved conflicts, can't continue
+  (use 'hg resolve' and 'hg graft --continue')
+  [255]
+  $ hg bisect --reset
+  $ hg up -C .
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
 
 Check that bisect does not break on obsolete changesets
 =========================================================