summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 602015e)
raw | patch | inline | side by side (parent: 602015e)
author | Michael Gebetsroither <michael.geb@gmx.at> | |
Sat, 6 Oct 2007 21:16:51 +0000 (23:16 +0200) | ||
committer | Shawn O. Pearce <spearce@spearce.org> | |
Tue, 16 Oct 2007 01:30:00 +0000 (21:30 -0400) |
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
contrib/hg-to-git/hg-to-git.py | patch | blob | history |
index 37337ff01fa56783cadeb3df685580101f92554c..7a1c3e497f00fd886a0602551bfa933931a995be 100755 (executable)
hgchildren = {}
# Current branch for each hg revision
hgbranch = {}
+# Number of new changesets converted from hg
+hgnewcsets = 0
#------------------------------------------------------------------------------
options:
-s, --gitstate=FILE: name of the state to be saved/read
for incrementals
+ -n, --nrepack=INT: number of changesets that will trigger
+ a repack (default=0, -1 to deactivate)
required:
hgprj: name of the HG project to import (directory)
#------------------------------------------------------------------------------
state = ''
+opt_nrepack = 0
try:
- opts, args = getopt.getopt(sys.argv[1:], 's:t:', ['gitstate=', 'tempdir='])
+ opts, args = getopt.getopt(sys.argv[1:], 's:t:n:', ['gitstate=', 'tempdir=', 'nrepack='])
for o, a in opts:
if o in ('-s', '--gitstate'):
state = a
state = os.path.abspath(state)
-
+ if o in ('-n', '--nrepack'):
+ opt_nrepack = int(a)
if len(args) != 1:
raise('params')
except:
# incremental, already seen
if hgvers.has_key(str(cset)):
continue
+ hgnewcsets += 1
# get info
prnts = os.popen('hg log -r %d | grep ^parent: | cut -f 2 -d :' % cset).readlines()
print 'record', cset, '->', vvv
hgvers[str(cset)] = vvv
-os.system('git-repack -a -d')
+if hgnewcsets >= opt_nrepack and opt_nrepack != -1:
+ os.system('git-repack -a -d')
# write the state for incrementals
if state: