Mercurial > hg-stable
changeset 16190:9479c28a22bf stable
convert: ignore blank lines in mapfiles (issue3286)
author | Patrick Mezard <patrick@mezard.eu> |
---|---|
date | Tue, 28 Feb 2012 10:06:35 +0100 |
parents | 41bef17e6ad8 |
children | 7c75924a6926 |
files | hgext/convert/common.py tests/test-convert-splicemap.t tests/test-convert-svn-branches.t |
diffstat | 3 files changed, 14 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext/convert/common.py Tue Feb 28 01:07:55 2012 +0200 +++ b/hgext/convert/common.py Tue Feb 28 10:06:35 2012 +0100 @@ -385,8 +385,12 @@ 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 @@ 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'
--- a/tests/test-convert-splicemap.t Tue Feb 28 01:07:55 2012 +0200 +++ b/tests/test-convert-splicemap.t Tue Feb 28 10:06:35 2012 +0100 @@ -67,10 +67,12 @@ $ 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
--- a/tests/test-convert-svn-branches.t Tue Feb 28 01:07:55 2012 +0200 +++ b/tests/test-convert-svn-branches.t Tue Feb 28 10:06:35 2012 +0100 @@ -14,6 +14,8 @@ $ cat > branchmap <<EOF > old3 newbranch + > + > > EOF $ hg convert --branchmap=branchmap --datesort -r 10 svn-repo A-hg initializing destination A-hg repository