[PATCH] amend: support amending merge changesets (issue3778)
Kevin Bullock
kbullock+mercurial at ringworld.org
Fri Feb 8 21:21:31 UTC 2013
On 8 Feb 2013, at 9:14 PM, Brodie Rao wrote:
> # HG changeset patch
> # User Brodie Rao <brodie at sf.io>
> # Date 1360357714 0
> # Node ID ac4b064dde742fbdeaea4818569ca3d134ed92bf
> # Parent 2fefd1170bf269e26bb304553009f38e0117c342
> amend: support amending merge changesets (issue3778)
>
> diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py
> --- a/mercurial/cmdutil.py
> +++ b/mercurial/cmdutil.py
> @@ -1644,7 +1644,13 @@ def amend(ui, repo, commitfunc, old, ext
> # Also update it from the intermediate commit or from the wctx
> extra.update(ctx.extra())
>
> - files = set(old.files())
> + if len(old.parents()) > 1:
> + # ctx.files() isn't reliable for merges, so fall back to the
> + # slower repo.status() method
> + files = set([fn for st in repo.status(base, old)[:3]
> + for fn in st])
> + else:
> + files = set(old.files())
Seems reasonable, although the double-looping list comprehension is a bit twisty.
pacem in terris / мир / शान्ति / سَلاَم / 平和
Kevin R. Bullock
More information about the Mercurial-devel
mailing list