##// END OF EJS Templates
convert: warn on superfluous / in paths...
Mads Kiilerich -
r11680:7fefef3c default
parent child Browse files
Show More
@@ -33,10 +33,20 b' class filemapper(object):'
33 def parse(self, path):
33 def parse(self, path):
34 errs = 0
34 errs = 0
35 def check(name, mapping, listname):
35 def check(name, mapping, listname):
36 if not name:
37 self.ui.warn(_('%s:%d: path to %s is missing\n') %
38 (lex.infile, lex.lineno, listname))
39 return 1
36 if name in mapping:
40 if name in mapping:
37 self.ui.warn(_('%s:%d: %r already in %s list\n') %
41 self.ui.warn(_('%s:%d: %r already in %s list\n') %
38 (lex.infile, lex.lineno, name, listname))
42 (lex.infile, lex.lineno, name, listname))
39 return 1
43 return 1
44 if (name.startswith('/') or
45 name.endswith('/') or
46 '//' in name):
47 self.ui.warn(_('%s:%d: superfluous / in %s %r\n') %
48 (lex.infile, lex.lineno, listname, name))
49 return 1
40 return 0
50 return 0
41 lex = shlex.shlex(open(path), path, True)
51 lex = shlex.shlex(open(path), path, True)
42 lex.wordchars += '!@#$%^&*()-=+[]{}|;:,./<>?'
52 lex.wordchars += '!@#$%^&*()-=+[]{}|;:,./<>?'
@@ -128,3 +128,14 b" echo 'copied:'"
128 hg --cwd source cat copied
128 hg --cwd source cat copied
129 echo 'copied2:'
129 echo 'copied2:'
130 hg --cwd renames.repo cat copied2
130 hg --cwd renames.repo cat copied2
131
132 echo % filemap errors
133 cat > errors.fmap <<EOF
134 include dir/ # beware that comments changes error line numbers!
135 exclude /dir
136 rename dir//dir /dir//dir/ "out of sync"
137 include
138 EOF
139 hg -q convert --filemap errors.fmap source errors.repo
140
141 true # happy ending
@@ -157,3 +157,11 b' copied:'
157 foo
157 foo
158 copied2:
158 copied2:
159 foo
159 foo
160 % filemap errors
161 errors.fmap:1: superfluous / in exclude 'dir/'
162 errors.fmap:3: superfluous / in include '/dir'
163 errors.fmap:3: superfluous / in rename '/dir'
164 errors.fmap:3: superfluous / in exclude 'dir//dir'
165 errors.fmap:4: unknown directive 'out of sync'
166 errors.fmap:5: path to exclude is missing
167 abort: errors in filemap
General Comments 0
You need to be logged in to leave comments. Login now