Don't use checkpoint
authorRocco Rutte <pdmef@gmx.net>
Thu, 8 Mar 2007 09:37:23 +0000 (09:37 +0000)
committerRocco Rutte <pdmef@gmx.net>
Thu, 8 Mar 2007 09:37:23 +0000 (09:37 +0000)
As git-fast-import already generates at least one pack per run, don't
even further split these up on a (default) 1k changeset boundary. Also
rework the documentation on that one a little.

Signed-off-by: Rocco Rutte <pdmef@gmx.net>
README.txt
hg2git.py

index e25075b..368e7ea 100644 (file)
@@ -22,12 +22,6 @@ Incremental imports to track hg repos is supported, too.
 Notes
 =====
 
-As there's no real config interface to hg2git.py (the worker script),
-checkpointing each 1000 changesets is hard-coded. "checkpointing" means
-to issue the "checkpoint" command of git-fast-import which then flushes
-the current pack file and starts a new one. This is sufficient for the
-initial import.
-
-However, per incremental import with fewer than 1000 changesets (read:
-most likely always), a new pack file will be created. Every time. As a
-consequence, the git repo should be repacked quite often.
+As each git-fast-import run creates a new pack file, it may be required
+to repack the repository quite often for incremental imports (especially
+when importing a small number of changesets per incremental import).
index a081b87..ee95dfb 100644 (file)
--- a/hg2git.py
+++ b/hg2git.py
@@ -17,8 +17,8 @@ import os
 user_re=re.compile('[^<]+ <[^>]+>$')
 # git branch for hg's default 'HEAD' branch
 cfg_master='master'
-# insert 'checkpoint' command after this many commits
-cfg_checkpoint_count=1000
+# insert 'checkpoint' command after this many commits or none at all if 0
+cfg_checkpoint_count=0
 
 def usage(ret):
   sys.stderr.write(__doc__)
@@ -54,7 +54,7 @@ def wr(msg=''):
 
 def checkpoint(count):
   count=count+1
-  if count%cfg_checkpoint_count==0:
+  if cfg_checkpoint_count>0 and count%cfg_checkpoint_count==0:
     sys.stderr.write("Checkpoint after %d commits\n" % count)
     wr('checkpoint')
     wr()