Skip to content

Commit 13bf1a9

Browse files
stelian42gitster
authored andcommitted
hg-to-git: fix parent analysis
Fix a bug in the hg-to-git convertor introduced by commit 1bc7c13: when searching the changeset parents, 'hg log' returns an extra space at the end of the line, which confuses the .split(' ') based tokenizer: Traceback (most recent call last): File "hg-to-git.py", line 123, in <module> hgchildren[mparent] += ( str(cset), ) KeyError: '' Signed-off-by: Stelian Pop <stelian@popies.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 parent 87f1b88 commit 13bf1a9

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

contrib/hg-to-git/hg-to-git.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ def getgitenv(user, date):
111111
hgbranch["0"] = "master"
112112
for cset in range(1, int(tip) + 1):
113113
hgchildren[str(cset)] = ()
114-
prnts = os.popen('hg log -r %d --template "{parents}"' % cset).read().split(' ')
114+
prnts = os.popen('hg log -r %d --template "{parents}"' % cset).read().strip().split(' ')
115115
prnts = map(lambda x: x[:x.find(':')], prnts)
116116
if prnts[0] != '':
117117
parent = prnts[0].strip()

0 commit comments

Comments
 (0)