# HG changeset patch # User Patrick Mezard # Date 2012-02-15 10:21:24 # Node ID d554a3dcae5a81d7c3fe1ed739b2d29238d14d75 # Parent 6ecf5fb2a475c5bab0b218fdedaf0a3b01e66a4e 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. diff --git a/hgext/convert/common.py b/hgext/convert/common.py --- a/hgext/convert/common.py +++ b/hgext/convert/common.py @@ -419,7 +419,7 @@ def parsesplicemap(path): 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' diff --git a/tests/test-convert-splicemap.t b/tests/test-convert-splicemap.t --- a/tests/test-convert-splicemap.t +++ b/tests/test-convert-splicemap.t @@ -123,11 +123,11 @@ We want 2 to depend on 1 and 3. Since 3 the bug should be exhibited with all conversion orders. $ cat > ../splicemap < $(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