[issue3203] convert: either mapfile is parsed incorrectly, or the splicemap docs is wrong
bugs at mercurial.selenic.com
Sat Jan 14 06:53:38 CST 2012
New submission from Andrei Polushin <polushin at gmail.com>:
Here three pieces of code again:
(1) documentation displayed with `hg help convert`:
108: Each entry
109: contains a key, followed by a space, followed by one or two
110: comma-separated values::
112: key parent1, parent2
Note the example at line 112. It suggests there could be a space between
'parent1,' and 'parent2'.
(2) Parsing that pair of parents:
322: parents = self.splicemap[rev].replace(',', ' ').split()
It suggests there could be any number of commas and spaces between
'parent1' and 'parent2', as documented above.
(3) Parsing the line from the slicemap, code from the mapfile._read():
385: key, value = line.splitlines().rstrip().rsplit(' ', 1)
Using the example from the documentation, this code will produce:
key => 'key parent1,'
value => 'parent2'
During `hg convert`, splicemap cannot contain any spaces between
'parent1,' and 'parent2'. It can contain any number of commas, though.
Either code should behave as documented (use lsplit instead of rsplit),
or the documentation should be fixed up to the code.
I would suggest to fix the code, as long as rsplit is meaningless,
confusing, and could be the source of future documentation errors.
Related: issue1582 cset 025ca07351ea issue2083
title: convert: either mapfile is parsed incorrectly, or the splicemap docs is wrong
Mercurial issue tracker <bugs at mercurial.selenic.com>
More information about the Mercurial-devel