# HG changeset patch # User Mads Kiilerich # Date 2010-07-20 13:49:28 # Node ID 7fefef3ce791f3c071498f3b1ce024237e0172ab # Parent b5f61da929c8fab29b69d4acbb75d4829af3c72d convert: warn on superfluous / in paths shlex is really a bad parser for this line-based format ... diff --git a/hgext/convert/filemap.py b/hgext/convert/filemap.py --- a/hgext/convert/filemap.py +++ b/hgext/convert/filemap.py @@ -33,10 +33,20 @@ class filemapper(object): 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 --git a/tests/test-convert-filemap b/tests/test-convert-filemap --- a/tests/test-convert-filemap +++ b/tests/test-convert-filemap @@ -128,3 +128,14 @@ echo 'copied:' hg --cwd source cat copied echo 'copied2:' hg --cwd renames.repo cat copied2 + +echo % filemap errors +cat > errors.fmap <