diff hgext/convert/filemap.py @ 11680:7fefef3ce791

convert: warn on superfluous / in paths shlex is really a bad parser for this line-based format ...
author Mads Kiilerich <mads@kiilerich.com>
date Tue, 20 Jul 2010 15:49:28 +0200
parents a2f11188e2d2
children 82845434e974
line wrap: on
line diff
--- 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 += '!@#$%^&*()-=+[]{}|;:,./<>?'