[PATCH] histedit: report when working dir is not a descendant of the revsions to rebase
Simon Heimberg
simohe at besonet.ch
Fri Feb 8 11:46:12 CST 2013
# HG changeset patch
# User Simon Heimberg <simohe at besonet.ch>
# Date 1360215123 -3600
# Branch stable
# Node ID 4f3e001cf78ad24b05c2a2afdcc2a8b6e282868e
# Parent b31e0be96c79156b8236b12315a6f699c1bf992a
histedit: report when working dir is not a descendant of the revsions to rebase
Editing the history only is possible when the working dir is a descendant of
the revisions to edit. When this happens explain it by writing
abort: working directory parent is not a descendant of %s
which is the same message as when continuing is not possible
diff -r b31e0be96c79 -r 4f3e001cf78a hgext/histedit.py
--- a/hgext/histedit.py Mon Feb 04 23:41:11 2013 +0100
+++ b/hgext/histedit.py Don Feb 07 06:32:03 2013 +0100
@@ -498,8 +498,13 @@
keep = opts.get('keep', False)
revs = between(repo, parent, topmost, keep)
if not revs:
- ui.warn(_('nothing to edit\n'))
- return 1
+ if repo[parent].descendant(repo[topmost]):
+ # topmost is a descendant of parent, maybe never happens
+ ui.warn(_('nothing to edit\n'))
+ return 1
+ else:
+ raise util.Abort(_('working directory parent is not a '
+ 'descendant of %s') % node.short(parent))
ctxs = [repo[r] for r in revs]
rules = opts.get('commands', '')
diff -r b31e0be96c79 -r 4f3e001cf78a tests/test-histedit-revspec.t
--- a/tests/test-histedit-revspec.t Mon Feb 04 23:41:11 2013 +0100
+++ b/tests/test-histedit-revspec.t Don Feb 07 06:32:03 2013 +0100
@@ -65,5 +65,5 @@
$ hg up 2
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
$ hg histedit -r 4
- nothing to edit
- [1]
+ abort: working directory parent is not a descendant of 08d98a8350f3
+ [255]
More information about the Mercurial-devel
mailing list