convert: allow synthetic history to be spliced in.
authorBryan O'Sullivan <bos@serpentine.com>
Fri, 01 Feb 2008 13:11:03 -0800
changeset 5996 3f9ce63da18c
parent 5995 b913d3aacddc
child 5997 637d4c089834
convert: allow synthetic history to be spliced in. Useful for recreating history in the face of SVN lossage.
hgext/convert/common.py
hgext/convert/convcmd.py
--- a/hgext/convert/common.py	Fri Feb 01 13:09:45 2008 -0800
+++ b/hgext/convert/common.py	Fri Feb 01 13:11:03 2008 -0800
@@ -311,6 +311,8 @@
         self._read()
 
     def _read(self):
+        if self.path is None:
+            return
         try:
             fp = open(self.path, 'r')
         except IOError, err:
--- a/hgext/convert/convcmd.py	Fri Feb 01 13:09:45 2008 -0800
+++ b/hgext/convert/convcmd.py	Fri Feb 01 13:11:03 2008 -0800
@@ -74,6 +74,8 @@
             self.readauthormap(opts.get('authors'))
             self.authorfile = self.dest.authorfile()
 
+        self.splicemap = mapfile(ui, ui.config('convert', 'splicemap'))
+
     def walktree(self, heads):
         '''Return a mapping that identifies the uncommitted parents of every
         uncommitted changeset.'''
@@ -224,7 +226,12 @@
                         # Merely marks that a copy happened.
                         self.dest.copyfile(copyf, f)
 
-        parents = [b[0] for b in pbranches]
+        try:
+            parents = [self.splicemap[rev]]
+            self.ui.debug('spliced in %s as parents of %s\n' %
+                          (parents, rev))
+        except KeyError:
+            parents = [b[0] for b in pbranches]
         newnode = self.dest.putcommit(filenames, parents, commit)
         self.source.converted(rev, newnode)
         self.map[rev] = newnode