[PATCH] histedit: print another warning when working dir is not a descandant of rev

Kevin Bullock kbullock+mercurial at ringworld.org
Tue Feb 5 10:35:33 CST 2013


On Feb 5, 2013, at 4:32 AM, Simon Heimberg wrote:

> # HG changeset patch
> # User Simon Heimberg <simohe at besonet.ch>
> # Date 1360058492 -3600
> # Node ID dc6c15283bf3194f9ed75abbc8d515e8d768fac5
> # Parent  1516d5624a2911fcb90ee051c6dc0679b49aef55
> histedit: print another warning when working dir is not a descandant of rev
> 
> It was not obvious to me that only ancestors of the working dir can be
> edited.

Sample output is generally wanted in the commit message. And did this really not break any tests? If not, you should fix that. :)

> diff -r 1516d5624a29 -r dc6c15283bf3 hgext/histedit.py
> --- a/hgext/histedit.py	Mon Feb 04 16:39:02 2013 -0600
> +++ b/hgext/histedit.py	Tue Feb 05 11:01:32 2013 +0100
> @@ -498,7 +498,11 @@
>         keep = opts.get('keep', False)
>         revs = between(repo, parent, topmost, keep)
>         if not revs:
> -            ui.warn(_('nothing to edit\n'))
> +            if repo.rev("ancestor(%s, %s) AND %s" % (topmost, parent,
> parent)):
> +            # is parent an ancestor of topmost?
> +                ui.warn(_('Working dir is not a descendant of parent. Can
> not edit.\n'))

1. Not our usual message style.
2. It's probably not clear to the user what 'parent' is in this case
3. Your added case should probably be an abort instead of a warn.

pacem in terris / мир / शान्ति / ‎‫سَلاَم‬ / 平和
Kevin R. Bullock



More information about the Mercurial-devel mailing list