Mercurial > hg-stable
changeset 27718:6e1fba0fe453
convert: replace cache of (m,a,r) by (ma,r)
The next commit will rewrite the way we find changes between two
manifests. By making the cache not care about the difference between
added and modified files, we don't require the rewritten code to care
about that difference either. Also extract the call to ctx.status() to
simplify the next commit.
author | Martin von Zweigbergk <martinvonz@google.com> |
---|---|
date | Sun, 10 Jan 2016 21:07:34 -0800 |
parents | 5deff127286f |
children | 7ce8a13b8d77 |
files | hgext/convert/hg.py |
diffstat | 1 files changed, 13 insertions(+), 9 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext/convert/hg.py Sat Jan 09 21:42:48 2016 -0800 +++ b/hgext/convert/hg.py Sun Jan 10 21:07:34 2016 -0800 @@ -507,6 +507,10 @@ except error.LookupError: return None, None + def _changedfiles(self, ctx1, ctx2): + m, a, r = ctx1.status(ctx2)[:3] + return (m + a, r) + def getchanges(self, rev, full): ctx = self._changectx(rev) parents = self._parents(ctx) @@ -514,12 +518,12 @@ files = copyfiles = ctx.manifest() if parents: if self._changescache[0] == rev: - m, a, r = self._changescache[1] + ma, r = self._changescache[1] else: - m, a, r = self.repo.status(parents[0].node(), ctx.node())[:3] + ma, r = self._changedfiles(parents[0], ctx) if not full: - files = m + a + r - copyfiles = m + a + files = ma + r + copyfiles = ma # _getcopies() is also run for roots and before filtering so missing # revlogs are detected early copies = self._getcopies(ctx, parents, copyfiles) @@ -582,16 +586,16 @@ parents = self._parents(ctx) if not parents and i is None: i = 0 - changes = [], ctx.manifest().keys(), [] + ma, r = ctx.manifest().keys(), [] else: i = i or 0 - changes = self.repo.status(parents[i].node(), ctx.node())[:3] - changes = [[f for f in l if f not in self.ignored] for l in changes] + ma, r = self._changedfiles(parents[i], ctx) + ma, r = [[f for f in l if f not in self.ignored] for l in (ma, r)] if i == 0: - self._changescache = (rev, changes) + self._changescache = (rev, (ma, r)) - return changes[0] + changes[1] + changes[2] + return ma + r def converted(self, rev, destrev): if self.convertfp is None: