Mercurial > hg
comparison hgext/fix.py @ 44090:2f0a44c69e07
copies: replace duplicatecopies() by function that takes contexts
The callers mostly have context objects, so let's avoid looking up the
same context objects inside `duplicatecopies()`.
I also renamed the function to `graftcopies()` since I think that
better matches its purpose. I did it in the same commit so it's easier
for extensions to switch between the functions.
Differential Revision: https://phab.mercurial-scm.org/D7858
author | Martin von Zweigbergk <martinvonz@google.com> |
---|---|
date | Mon, 06 Jan 2020 15:24:36 -0800 |
parents | eebdd6709868 |
children | 833210fbd900 |
comparison
equal
deleted
inserted
replaced
44089:bd22e90c54b3 | 44090:2f0a44c69e07 |
---|---|
732 | 732 |
733 extra = ctx.extra().copy() | 733 extra = ctx.extra().copy() |
734 extra[b'fix_source'] = ctx.hex() | 734 extra[b'fix_source'] = ctx.hex() |
735 | 735 |
736 wctx = context.overlayworkingctx(repo) | 736 wctx = context.overlayworkingctx(repo) |
737 wctx.setbase(repo[newp1node]) | 737 newp1ctx = repo[newp1node] |
738 wctx.setbase(newp1ctx) | |
738 merge.update( | 739 merge.update( |
739 repo, | 740 repo, |
740 ctx.rev(), | 741 ctx.rev(), |
741 branchmerge=False, | 742 branchmerge=False, |
742 force=True, | 743 force=True, |
743 ancestor=p1rev, | 744 ancestor=p1rev, |
744 mergeancestor=False, | 745 mergeancestor=False, |
745 wc=wctx, | 746 wc=wctx, |
746 ) | 747 ) |
747 copies.duplicatecopies( | 748 copies.graftcopies(repo, wctx, ctx, ctx.p1(), skip=newp1ctx) |
748 repo, wctx, ctx.rev(), ctx.p1().rev(), skiprev=newp1node | |
749 ) | |
750 | 749 |
751 for path in filedata.keys(): | 750 for path in filedata.keys(): |
752 fctx = ctx[path] | 751 fctx = ctx[path] |
753 copysource = fctx.copysource() | 752 copysource = fctx.copysource() |
754 wctx.write(path, filedata[path], flags=fctx.flags()) | 753 wctx.write(path, filedata[path], flags=fctx.flags()) |