Mercurial > hg
diff hgext/convert/convcmd.py @ 16106:d75aa756149b stable
convert: use splicemap entries when sorting revisions (issue1748)
When sorting revisions before converting them, we have to edit the revision
graph using splicemap entries. Otherwise, a spliced revision may be converted
before its synthetic parents. Invalid splicemap revisions are now detected
before starting the conversion.
author | Patrick Mezard <patrick@mezard.eu> |
---|---|
date | Fri, 10 Feb 2012 22:34:13 +0100 |
parents | ebaa0aa749e2 |
children | 67964cda8701 |
line wrap: on
line diff
--- a/hgext/convert/convcmd.py Fri Feb 10 22:25:49 2012 +0100 +++ b/hgext/convert/convcmd.py Fri Feb 10 22:34:13 2012 +0100 @@ -142,6 +142,29 @@ return parents + def mergesplicemap(self, parents, splicemap): + """A splicemap redefines child/parent relationships. Check the + map contains valid revision identifiers and merge the new + links in the source graph. + """ + for c in splicemap: + if c not in parents: + if not self.dest.hascommit(self.map.get(c, c)): + # Could be in source but not converted during this run + self.ui.warn(_('splice map revision %s is not being ' + 'converted, ignoring\n') % c) + continue + pc = [] + for p in splicemap[c]: + # We do not have to wait for nodes already in dest. + if self.dest.hascommit(self.map.get(p, p)): + continue + # Parent is not in dest and not being converted, not good + if p not in parents: + raise util.Abort(_('unknown splice map parent: %s') % p) + pc.append(p) + parents[c] = pc + def toposort(self, parents, sortmode): '''Return an ordering such that every uncommitted changeset is preceeded by all its uncommitted ancestors.''' @@ -340,6 +363,7 @@ self.ui.status(_("scanning source...\n")) heads = self.source.getheads() parents = self.walktree(heads) + self.mergesplicemap(parents, self.splicemap) self.ui.status(_("sorting...\n")) t = self.toposort(parents, sortmode) num = len(t)