From 8822aa34e9647fa8f73b0f4a2509a0268d0b0078 Mon Sep 17 00:00:00 2001 From: "Kyle J. McKay" Date: Sat, 15 Mar 2014 16:48:10 -0700 Subject: [PATCH] hg-fast-export.py: improve authors file compatibility The authors file format accepted by git-svnimport and git-cvsimport actually allows blank lines and comment lines that start with '#'. Ignore blank lines and lines starting with '#' as the first non-whitespace character to be compatible with the authors file format accepted by the referenced tools. --- hg-fast-export.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/hg-fast-export.py b/hg-fast-export.py index 0ce14a6..18bf9a0 100755 --- a/hg-fast-export.py +++ b/hg-fast-export.py @@ -255,17 +255,22 @@ def load_authors(filename): return cache f=open(filename,'r') l=0 + a=0 lre=re.compile('^([^=]+)[ ]*=[ ]*(.+)$') for line in f.readlines(): l+=1 + line=line.strip() + if line=='' or line[0]=='#': + continue m=lre.match(line) if m==None: sys.stderr.write('Invalid file format in [%s], line %d\n' % (filename,l)) continue # put key:value in cache, key without ^: cache[m.group(1).strip()]=m.group(2).strip() + a+=1 f.close() - sys.stderr.write('Loaded %d authors\n' % l) + sys.stderr.write('Loaded %d authors\n' % a) return cache def branchtip(repo, heads): -- 2.11.4.GIT