changeset 15608:63ff8fe3a8f0 stable

convert: tolerate trailing spaces on map files A convert run with a branchmap made with echo default namedbranch > branchmap on Windows fails silently and surprisingly; it actually adds a space after 'namedbranch', so it ends up mapping "default namedbranch" to "". This also affects splicemaps, since the same parser is used for both.
author Wagner Bruna <wbruna@softwareexpress.com.br>
date Fri, 02 Dec 2011 21:38:57 -0200
parents fab28a577a38
children 8f4bad72d8b1
files hgext/convert/common.py tests/test-convert-splicemap.t
diffstat 2 files changed, 2 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/convert/common.py	Fri Dec 02 16:50:48 2011 +0100
+++ b/hgext/convert/common.py	Fri Dec 02 21:38:57 2011 -0200
@@ -384,7 +384,7 @@
             return
         for i, line in enumerate(fp):
             try:
-                key, value = line.splitlines()[0].rsplit(' ', 1)
+                key, value = line.splitlines()[0].rstrip().rsplit(' ', 1)
             except ValueError:
                 raise util.Abort(
                     _('syntax error in %s(%d): key/value pair expected')
--- a/tests/test-convert-splicemap.t	Fri Dec 02 16:50:48 2011 +0100
+++ b/tests/test-convert-splicemap.t	Fri Dec 02 21:38:57 2011 -0200
@@ -49,7 +49,7 @@
 splice repo2 on repo1
 
   $ cat > splicemap <<EOF
-  > $CHILDID1 $PARENTID1
+  > $CHILDID1 $PARENTID1 
   > $CHILDID2 $PARENTID2,$CHILDID1
   > EOF
   $ hg clone repo1 target1