convert: ignore blank lines in mapfiles (issue3286)

This commit is contained in:
Patrick Mezard 2012-02-28 10:06:35 +01:00
parent 0aba016d12
commit a8beff44c2
3 changed files with 14 additions and 2 deletions

View File

@ -385,8 +385,12 @@ class mapfile(dict):
raise
return
for i, line in enumerate(fp):
line = line.splitlines()[0].rstrip()
if not line:
# Ignore blank lines
continue
try:
key, value = line.splitlines()[0].rstrip().rsplit(' ', 1)
key, value = line.rsplit(' ', 1)
except ValueError:
raise util.Abort(
_('syntax error in %s(%d): key/value pair expected')
@ -418,8 +422,12 @@ def parsesplicemap(path):
try:
fp = open(path, 'r')
for i, line in enumerate(fp):
line = line.splitlines()[0].rstrip()
if not line:
# Ignore blank lines
continue
try:
child, parents = line.splitlines()[0].rstrip().split(' ', 1)
child, parents = line.split(' ', 1)
parents = parents.replace(',', ' ').split()
except ValueError:
raise util.Abort(_('syntax error in %s(%d): child parent1'

View File

@ -67,10 +67,12 @@ splice repo2 on repo1
$ cat > splicemap <<EOF
> $CHILDID1 $PARENTID1
> $CHILDID2 $PARENTID2,$CHILDID1
>
> EOF
$ cat splicemap
527cdedf31fbd5ea708aa14eeecf53d4676f38db 6d4c2037ddc2cb2627ac3a244ecce35283268f8e
e4ea00df91897da3079a10fab658c1eddba6617b e55c719b85b60e5102fac26110ba626e7cb6b7dc,527cdedf31fbd5ea708aa14eeecf53d4676f38db
$ hg clone repo1 target1
updating to branch default
3 files updated, 0 files merged, 0 files removed, 0 files unresolved

View File

@ -14,6 +14,8 @@ Convert trunk and branches
$ cat > branchmap <<EOF
> old3 newbranch
>
>
> EOF
$ hg convert --branchmap=branchmap --datesort -r 10 svn-repo A-hg
initializing destination A-hg repository