convert: tolerate spaces between splicemap parent ids (
issue3203)
Splicemap lines are documented in hg help convert like:
key parent1, parent2
but parsed like:
key, parents = line.strip().rsplit(' ', 1)
parents = parents.replace(',', ' ').split()
The rsplit() call was introduced to handle spaces in keys for the generic
mapfile format. Spaces can appear in svn identifiers since they contain path
components. This logic makes less sense with splicemap since svn identifiers
can also appear on the right side, even if it is a bit less likely. Given the
parsing is theorically broken, I would rather follow what is documented already
and is correct in the main case where all identifiers are hg hashes. Also,
using svn identifiers in a splicemap sounds difficult as they are not easily
accessible.
--- a/hgext/convert/common.py Thu Feb 16 01:23:45 2012 +0200
+++ b/hgext/convert/common.py Wed Feb 15 11:21:24 2012 +0100
@@ -419,7 +419,7 @@
fp = open(path, 'r')
for i, line in enumerate(fp):
try:
- child, parents = line.splitlines()[0].rstrip().rsplit(' ', 1)
+ child, parents = line.splitlines()[0].rstrip().split(' ', 1)
parents = parents.replace(',', ' ').split()
except ValueError:
raise util.Abort(_('syntax error in %s(%d): child parent1'
--- a/tests/test-convert-splicemap.t Thu Feb 16 01:23:45 2012 +0200
+++ b/tests/test-convert-splicemap.t Wed Feb 15 11:21:24 2012 +0100
@@ -123,11 +123,11 @@
the bug should be exhibited with all conversion orders.
$ cat > ../splicemap <<EOF
- > $(hg id -r 2 -i --debug) $(hg id -r 1 -i --debug),$(hg id -r 3 -i --debug)
+ > $(hg id -r 2 -i --debug) $(hg id -r 1 -i --debug), $(hg id -r 3 -i --debug)
> EOF
$ cd ..
$ cat splicemap
- 7c364e7fa7d70ae525610c016317ed717b519d97 717d54d67e6c31fd75ffef2ff3042bdd98418437,102a90ea7b4a3361e4082ed620918c261189a36a
+ 7c364e7fa7d70ae525610c016317ed717b519d97 717d54d67e6c31fd75ffef2ff3042bdd98418437, 102a90ea7b4a3361e4082ed620918c261189a36a
Test regular conversion