Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/cmdutil.py @ 18909:3a72c89a83ec
amend: support amending merge changesets (issue3778)
author | Brodie Rao <brodie@sf.io> |
---|---|
date | Fri, 08 Feb 2013 21:08:34 +0000 |
parents | 78d760aa3607 |
children | c1af1fb314bc |
comparison
equal
deleted
inserted
replaced
18908:779e3d9b7a1d | 18909:3a72c89a83ec |
---|---|
1658 extra.update(old.extra()) | 1658 extra.update(old.extra()) |
1659 | 1659 |
1660 # Also update it from the intermediate commit or from the wctx | 1660 # Also update it from the intermediate commit or from the wctx |
1661 extra.update(ctx.extra()) | 1661 extra.update(ctx.extra()) |
1662 | 1662 |
1663 files = set(old.files()) | 1663 if len(old.parents()) > 1: |
1664 # ctx.files() isn't reliable for merges, so fall back to the | |
1665 # slower repo.status() method | |
1666 files = set([fn for st in repo.status(base, old)[:3] | |
1667 for fn in st]) | |
1668 else: | |
1669 files = set(old.files()) | |
1664 | 1670 |
1665 # Second, we use either the commit we just did, or if there were no | 1671 # Second, we use either the commit we just did, or if there were no |
1666 # changes the parent of the working directory as the version of the | 1672 # changes the parent of the working directory as the version of the |
1667 # files in the final amend commit | 1673 # files in the final amend commit |
1668 if node: | 1674 if node: |
1723 | 1729 |
1724 pureextra = extra.copy() | 1730 pureextra = extra.copy() |
1725 extra['amend_source'] = old.hex() | 1731 extra['amend_source'] = old.hex() |
1726 | 1732 |
1727 new = context.memctx(repo, | 1733 new = context.memctx(repo, |
1728 parents=[base.node(), nullid], | 1734 parents=[base.node(), old.p2().node()], |
1729 text=message, | 1735 text=message, |
1730 files=files, | 1736 files=files, |
1731 filectxfn=filectxfn, | 1737 filectxfn=filectxfn, |
1732 user=user, | 1738 user=user, |
1733 date=date, | 1739 date=date, |