comparison hgext/convert/common.py @ 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 4030630fb59c
children ec8a49c46d7e
comparison
equal deleted inserted replaced
15607:fab28a577a38 15608:63ff8fe3a8f0
382 if err.errno != errno.ENOENT: 382 if err.errno != errno.ENOENT:
383 raise 383 raise
384 return 384 return
385 for i, line in enumerate(fp): 385 for i, line in enumerate(fp):
386 try: 386 try:
387 key, value = line.splitlines()[0].rsplit(' ', 1) 387 key, value = line.splitlines()[0].rstrip().rsplit(' ', 1)
388 except ValueError: 388 except ValueError:
389 raise util.Abort( 389 raise util.Abort(
390 _('syntax error in %s(%d): key/value pair expected') 390 _('syntax error in %s(%d): key/value pair expected')
391 % (self.path, i + 1)) 391 % (self.path, i + 1))
392 if key not in self: 392 if key not in self: