Mercurial > public > mercurial-scm > hg
comparison mercurial/localrepo.py @ 42620:d98ec36be808
convert: add a config option to help doing identity hg->hg conversion
I want to change the computation of the list of files modified by a
commit. In principle, this would simply change a cache. But since this
information is stored in commits rather than a cache, changing it
means changing commit hashes (going forward).
Some users rely on the convert extension from hg to hg not changing
hashes when nothing changes (usually). Allow these users to preserve
hashes despite changes to the changelog files computation by reusing
these files lists when the manifest is unchanged (since these files
list are derived from the manifest).
Differential Revision: https://phab.mercurial-scm.org/D6643
author | Valentin Gatien-Baron <valentin.gatienbaron@gmail.com> |
---|---|
date | Sat, 13 Jul 2019 23:45:32 -0400 |
parents | 904e0da2e195 |
children | 99ebde4fec99 |
comparison
equal
deleted
inserted
replaced
42619:20d0e59be79b | 42620:d98ec36be808 |
---|---|
2576 parent2=hookp2) | 2576 parent2=hookp2) |
2577 self._afterlock(commithook) | 2577 self._afterlock(commithook) |
2578 return ret | 2578 return ret |
2579 | 2579 |
2580 @unfilteredmethod | 2580 @unfilteredmethod |
2581 def commitctx(self, ctx, error=False): | 2581 def commitctx(self, ctx, error=False, origctx=None): |
2582 """Add a new revision to current repository. | 2582 """Add a new revision to current repository. |
2583 Revision information is passed via the context argument. | 2583 Revision information is passed via the context argument. |
2584 | 2584 |
2585 ctx.files() should list all files involved in this commit, i.e. | 2585 ctx.files() should list all files involved in this commit, i.e. |
2586 modified/added/removed files. On merge, it may be wider than the | 2586 modified/added/removed files. On merge, it may be wider than the |
2587 ctx.files() to be committed, since any file nodes derived directly | 2587 ctx.files() to be committed, since any file nodes derived directly |
2588 from p1 or p2 are excluded from the committed ctx.files(). | 2588 from p1 or p2 are excluded from the committed ctx.files(). |
2589 | |
2590 origctx is for convert to work around the problem that bug | |
2591 fixes to the files list in changesets change hashes. For | |
2592 convert to be the identity, it can pass an origctx and this | |
2593 function will use the same files list when it makes sense to | |
2594 do so. | |
2589 """ | 2595 """ |
2590 | 2596 |
2591 p1, p2 = ctx.p1(), ctx.p2() | 2597 p1, p2 = ctx.p1(), ctx.p2() |
2592 user = ctx.user() | 2598 user = ctx.user() |
2593 | 2599 |
2699 p1copies = p1copies or None | 2705 p1copies = p1copies or None |
2700 p2copies = p2copies or None | 2706 p2copies = p2copies or None |
2701 filesadded = filesadded or None | 2707 filesadded = filesadded or None |
2702 filesremoved = filesremoved or None | 2708 filesremoved = filesremoved or None |
2703 | 2709 |
2710 if origctx and origctx.manifestnode() == mn: | |
2711 files = origctx.files() | |
2712 | |
2704 # update changelog | 2713 # update changelog |
2705 self.ui.note(_("committing changelog\n")) | 2714 self.ui.note(_("committing changelog\n")) |
2706 self.changelog.delayupdate(tr) | 2715 self.changelog.delayupdate(tr) |
2707 n = self.changelog.add(mn, files, ctx.description(), | 2716 n = self.changelog.add(mn, files, ctx.description(), |
2708 trp, p1.node(), p2.node(), | 2717 trp, p1.node(), p2.node(), |