contrib/convert-repo
changeset 1656 14d73fff4c45
parent 1655 7bfd4724932a
child 1715 40346aa66b0f
--- a/contrib/convert-repo	Sun Jan 29 17:22:03 2006 +1300
+++ b/contrib/convert-repo	Sun Jan 29 18:38:56 2006 +1300
@@ -21,7 +21,7 @@
 # interrupted and can be run repeatedly to copy new commits.
 
 import sys, os, zlib, sha, time
-from mercurial import hg, ui, util
+from mercurial import hg, ui, util, commands
 
 class convert_git:
     def __init__(self, path):
@@ -113,7 +113,7 @@
         except:
             pass
 
-    def putcommit(self, files, parents, author, dest, text):
+    def putcommit(self, files, parents, author, date, text):
         seen = {}
         pl = []
         for p in parents:
@@ -129,8 +129,13 @@
         while parents:
             p1 = p2
             p2 = parents.pop(0)
-            self.repo.rawcommit(files, text, author, dest,
-                                hg.bin(p1), hg.bin(p2))
+            self.repo.dirstate.setparents(hg.bin(p1), hg.bin(p2))
+            if len(files) > 0:
+                olddir = os.getcwd()
+                os.chdir(self.path)
+                commands.addremove(self.repo.ui, self.repo, *files)
+                os.chdir(olddir)
+            self.repo.commit(files, text, author, date)
             text = "(octopus merge fixup)\n"
             p2 = hg.hex(self.repo.changelog.tip())