[PATCH] histedit: report when working dir is not a descendant of the revsions to rebase
Augie Fackler
raf at durin42.com
Fri Feb 8 13:19:51 CST 2013
On Aug 2, 2013, at 6:44 PM, Simon Heimberg <simohe at besonet.ch> wrote:
> # 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
s/rebase/edit/ (we're not rebasing, we're editing history)
>
> 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
I'm 99% certain this is unreachable code.
> + else:
> + raise util.Abort(_('working directory parent is not a '
> + 'descendant of %s') % node.short(parent))
Given that, could we phrase it like this (and drop the other branch of the if statement):
abort(_("%s is not an ancestor of working directory") % (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]
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel at selenic.com
> http://selenic.com/mailman/listinfo/mercurial-devel
More information about the Mercurial-devel
mailing list