diff --git a/hgext/convert/hg.py b/hgext/convert/hg.py --- a/hgext/convert/hg.py +++ b/hgext/convert/hg.py @@ -301,7 +301,7 @@ class mercurial_source(converter_source) raise NoRepo(_("%s is not a local Mercurial repository") % path) self.lastrev = None self.lastctx = None - self._changescache = None + self._changescache = None, None self.convertfp = None # Restrict converted revisions to startrev descendants startnode = ui.config('convert', 'hg.startrev') @@ -360,22 +360,20 @@ class mercurial_source(converter_source) ctx = self.changectx(rev) parents = self.parents(ctx) if not parents: - files = sorted(ctx.manifest()) - # getcopies() is not needed for roots, but it is a simple way to - # detect missing revlogs and abort on errors or populate - # self.ignored - self.getcopies(ctx, parents, files) - return [(f, rev) for f in files if f not in self.ignored], {} - if self._changescache and self._changescache[0] == rev: - m, a, r = self._changescache[1] + files = copyfiles = ctx.manifest() else: - m, a, r = self.repo.status(parents[0].node(), ctx.node())[:3] - # getcopies() detects missing revlogs early, run it before - # filtering the changes. - copies = self.getcopies(ctx, parents, m + a) - changes = [(name, rev) for name in m + a + r - if name not in self.ignored] - return sorted(changes), copies + if self._changescache[0] == rev: + m, a, r = self._changescache[1] + else: + m, a, r = self.repo.status(parents[0].node(), ctx.node())[:3] + files = m + a + r + copyfiles = m + a + # getcopies() is also run for roots and before filtering so missing + # revlogs are detected early + copies = self.getcopies(ctx, parents, copyfiles) + changes = [(f, rev) for f in files if f not in self.ignored] + changes.sort() + return changes, copies def getcopies(self, ctx, parents, files): copies = {}