histedit: allow histedit --continue when not on a descendant (BC)
Previously we would not allow --continue if the current working copy parent was
not a descendant of the commit produced by the previous histedit step. There's
nothing really blocking us from continuing the histedit in this situation, so
let's stop aborting in this case.
This is technically a BC change, but it is making things more forgiving so I
think it's ok.
In the future we will likely add an 'exec' action to histedit, which means the
user can do whatever they want during the middle of a histedit (like perhaps
calling 'hg update'), which means we'll need to support this case eventually
anyway.
--- a/hgext/histedit.py Thu Apr 16 11:59:36 2015 -0400
+++ b/hgext/histedit.py Sat Apr 04 01:00:05 2015 -0700
@@ -833,11 +833,7 @@
newchildren = [c.node() for c in repo.set('(%d::.)', ctx)]
if ctx.node() != node.nullid:
if not newchildren:
- # `ctx` should match but no result. This means that
- # currentnode is not a descendant from ctx.
- msg = _('%s is not an ancestor of working directory')
- hint = _('use "histedit --abort" to clear broken state')
- raise util.Abort(msg % ctx, hint=hint)
+ return []
newchildren.pop(0) # remove ctx
return newchildren
--- a/tests/test-histedit-arguments.t Thu Apr 16 11:59:36 2015 -0400
+++ b/tests/test-histedit-arguments.t Sat Apr 04 01:00:05 2015 -0700
@@ -120,6 +120,13 @@
Mercurial earlier than 2.7 by renaming ".hg/histedit-state"
temporarily.
+ $ hg log -G -T '{rev} {shortest(node)} {desc}\n' -r 2::
+ @ 4 08d9 five
+ |
+ o 3 c8e6 four
+ |
+ o 2 eb57 three
+ |
$ HGEDITOR=cat hg histedit -r 4 --commands - << EOF
> edit 08d98a8350f3 4 five
> EOF
@@ -131,15 +138,23 @@
$ mv .hg/histedit-state .hg/histedit-state.back
$ hg update --quiet --clean 2
+ $ echo alpha >> alpha
$ mv .hg/histedit-state.back .hg/histedit-state
$ hg histedit --continue
- abort: c8e68270e35a is not an ancestor of working directory
- (use "histedit --abort" to clear broken state)
- [255]
+ 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+ saved backup bundle to $TESTTMP/foo/.hg/strip-backup/08d98a8350f3-02594089-backup.hg (glob)
+ $ hg log -G -T '{rev} {shortest(node)} {desc}\n' -r 2::
+ @ 4 f5ed five
+ |
+ | o 3 c8e6 four
+ |/
+ o 2 eb57 three
+ |
- $ hg histedit --abort
- $ hg update --quiet --clean
+ $ hg unbundle -q $TESTTMP/foo/.hg/strip-backup/08d98a8350f3-02594089-backup.hg
+ $ hg strip -q -r f5ed --config extensions.strip=
+ $ hg up -q 08d98a8350f3
Test that missing revisions are detected
---------------------------------------