Mercurial > public > mercurial-scm > hg
diff hgext/convert/hg.py @ 5379:d3e51dc804f8
mercurial_source: add --filemap support
author | Alexis S. L. Carvalho <alexis@cecm.usp.br> |
---|---|
date | Thu, 04 Oct 2007 23:21:37 -0300 |
parents | 8a2915f57dfc |
children | ad0b580cad35 |
line wrap: on
line diff
--- a/hgext/convert/hg.py Thu Oct 04 23:21:37 2007 -0300 +++ b/hgext/convert/hg.py Thu Oct 04 23:21:37 2007 -0300 @@ -177,6 +177,7 @@ raise NoRepo("could not open hg repo %s as source" % path) self.lastrev = None self.lastctx = None + self._changescache = None def changectx(self, rev): if self.lastrev != rev: @@ -202,7 +203,10 @@ def getchanges(self, rev): ctx = self.changectx(rev) - m, a, r = self.repo.status(ctx.parents()[0].node(), ctx.node())[:3] + if self._changescache and self._changescache[0] == rev: + m, a, r = self._changescache[1] + else: + m, a, r = self.repo.status(ctx.parents()[0].node(), ctx.node())[:3] changes = [(name, rev) for name in m + a + r] changes.sort() return (changes, self.getcopies(ctx, m + a)) @@ -226,3 +230,14 @@ def gettags(self): tags = [t for t in self.repo.tagslist() if t[0] != 'tip'] return dict([(name, hex(node)) for name, node in tags]) + + def getchangedfiles(self, rev, i): + ctx = self.changectx(rev) + i = i or 0 + changes = self.repo.status(ctx.parents()[i].node(), ctx.node())[:3] + + if i == 0: + self._changescache = (rev, changes) + + return changes[0] + changes[1] + changes[2] +