[issue3203] convert: either mapfile is parsed incorrectly, or the splicemap docs is wrong

Andrei Polushin 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`:

  hgext/convert/__init__.py:
  108: Each entry
  109: contains a key, followed by a space, followed by one or two
  110: comma-separated values::
  111:
  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:

  hgext/convert/convcmd.py:
  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():

  hgext/convert/common.py:
  385:    key, value = line.splitlines()[0].rstrip().rsplit(' ', 1)

Using the example from the documentation, this code will produce:

	key   => 'key parent1,'
	value => 'parent2'

Result:
  During `hg convert`, splicemap cannot contain any spaces between
  'parent1,' and 'parent2'. It can contain any number of commas, though.

Expected result:
  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

----------
messages: 18629
nosy: polushin
priority: bug
status: unread
title: convert: either mapfile is parsed incorrectly, or the splicemap docs is wrong

____________________________________________________
Mercurial issue tracker <bugs at mercurial.selenic.com>
<http://mercurial.selenic.com/bts/issue3203>
____________________________________________________


More information about the Mercurial-devel mailing list