mirror of
https://github.com/frej/fast-export.git
synced 2026-07-07 01:18:13 +02:00
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.
This commit is contained in:
committed by
Frej Drejhammar
parent
0e4142955a
commit
8822aa34e9
@@ -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):
|
||||
|
||||
Reference in New Issue
Block a user