# HG changeset patch # User Mads Kiilerich # Date 1279633768 -7200 # Node ID 7fefef3ce791f3c071498f3b1ce024237e0172ab # Parent b5f61da929c8fab29b69d4acbb75d4829af3c72d convert: warn on superfluous / in paths shlex is really a bad parser for this line-based format ... diff -r b5f61da929c8 -r 7fefef3ce791 hgext/convert/filemap.py --- a/hgext/convert/filemap.py Sat Jul 24 22:15:22 2010 +0200 +++ b/hgext/convert/filemap.py Tue Jul 20 15:49:28 2010 +0200 @@ -33,10 +33,20 @@ def parse(self, path): errs = 0 def check(name, mapping, listname): + if not name: + self.ui.warn(_('%s:%d: path to %s is missing\n') % + (lex.infile, lex.lineno, listname)) + return 1 if name in mapping: self.ui.warn(_('%s:%d: %r already in %s list\n') % (lex.infile, lex.lineno, name, listname)) return 1 + if (name.startswith('/') or + name.endswith('/') or + '//' in name): + self.ui.warn(_('%s:%d: superfluous / in %s %r\n') % + (lex.infile, lex.lineno, listname, name)) + return 1 return 0 lex = shlex.shlex(open(path), path, True) lex.wordchars += '!@#$%^&*()-=+[]{}|;:,./<>?' diff -r b5f61da929c8 -r 7fefef3ce791 tests/test-convert-filemap --- a/tests/test-convert-filemap Sat Jul 24 22:15:22 2010 +0200 +++ b/tests/test-convert-filemap Tue Jul 20 15:49:28 2010 +0200 @@ -128,3 +128,14 @@ hg --cwd source cat copied echo 'copied2:' hg --cwd renames.repo cat copied2 + +echo % filemap errors +cat > errors.fmap <