# HG changeset patch # User Patrick Mezard # Date 1254934321 -7200 # Node ID 989cb39d1df455cec0ec47ab6ccfcc4810bef9a4 # Parent a2f36a082449e7286d1beb5eb872c0b402dfffac convert/hg: handle bogus copy records (issue1843) diff -r a2f36a082449 -r 989cb39d1df4 hgext/convert/hg.py --- a/hgext/convert/hg.py Wed Oct 07 10:13:04 2009 +0200 +++ b/hgext/convert/hg.py Wed Oct 07 18:52:01 2009 +0200 @@ -274,7 +274,7 @@ if self.ignoreerrors: # calling getcopies() is a simple way to detect missing # revlogs and populate self.ignored - self.getcopies(ctx, files) + 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] @@ -282,12 +282,12 @@ 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, m + a) + 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 - def getcopies(self, ctx, files): + def getcopies(self, ctx, parents, files): copies = {} for name in files: if name in self.ignored: @@ -296,6 +296,14 @@ copysource, copynode = ctx.filectx(name).renamed() if copysource in self.ignored or not self.keep(copynode): continue + # Ignore copy sources not in parent revisions + found = False + for p in parents: + if copysource in p: + found = True + break + if not found: + continue copies[name] = copysource except TypeError: pass