Submitter | Simon Heimberg |
---|---|
Date | Aug. 2, 2013, 5:44 p.m. |
Message ID | <4f3e001cf78ad24b05c2.1375465452@lapsi.heimberg.home> |
Download | mbox | patch |
Permalink | /patch/832/ |
State | Superseded |
Headers | show |
Comments
queued both, with a tweak to the log message in #1. Thanks! On Aug 3, 2013, at 3:41 PM, Simon Heimberg <simohe@besonet.ch> wrote: > Simplified the patch by removing the unreachable code. (We are two who are > almost sure it is unreachable. I guess this is sure enough.) > And use the clearer abort message suggested by Augie Fackler. In the 2nd > patch also use it for the other message which reports the same failure.
# HG changeset patch # User Simon Heimberg <simohe@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
Simplified the patch by removing the unreachable code. (We are two who are almost sure it is unreachable. I guess this is sure enough.) And use the clearer abort message suggested by Augie Fackler. In the 2nd patch also use it for the other message which reports the same failure.
Patch
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]