Show More
@@ -212,13 +212,15 def dodiff(ui, repo, cmdline, pats, opts | |||||
212 | 'clabel': label2, 'child': dir2, |
|
212 | 'clabel': label2, 'child': dir2, | |
213 | 'root': repo.root} |
|
213 | 'root': repo.root} | |
214 | def quote(match): |
|
214 | def quote(match): | |
215 |
|
|
215 | pre = match.group(2) | |
|
216 | key = match.group(3) | |||
216 | if not do3way and key == 'parent2': |
|
217 | if not do3way and key == 'parent2': | |
217 |
return |
|
218 | return pre | |
218 | return util.shellquote(replace[key]) |
|
219 | return pre + util.shellquote(replace[key]) | |
219 |
|
220 | |||
220 | # Match parent2 first, so 'parent1?' will match both parent1 and parent |
|
221 | # Match parent2 first, so 'parent1?' will match both parent1 and parent | |
221 | regex = '\$(parent2|parent1?|child|plabel1|plabel2|clabel|root)' |
|
222 | regex = (r'''(['"]?)([^\s'"$]*)''' | |
|
223 | r'\$(parent2|parent1?|child|plabel1|plabel2|clabel|root)\1') | |||
222 | if not do3way and not re.search(regex, cmdline): |
|
224 | if not do3way and not re.search(regex, cmdline): | |
223 | cmdline += ' $parent1 $child' |
|
225 | cmdline += ' $parent1 $child' | |
224 | cmdline = re.sub(regex, quote, cmdline) |
|
226 | cmdline = re.sub(regex, quote, cmdline) |
@@ -160,6 +160,28 issue4463: usage of command line configu | |||||
160 | running "echo echo-naked 'being quoted' */a $TESTTMP/a/a" in */extdiff.* (glob) |
|
160 | running "echo echo-naked 'being quoted' */a $TESTTMP/a/a" in */extdiff.* (glob) | |
161 | #endif |
|
161 | #endif | |
162 |
|
162 | |||
|
163 | $ touch 'sp ace' | |||
|
164 | $ hg add 'sp ace' | |||
|
165 | $ hg ci -m 'sp ace' | |||
|
166 | created new head | |||
|
167 | $ echo > 'sp ace' | |||
|
168 | ||||
|
169 | Test pre-72a89cf86fcd backward compatibility with half-baked manual quoting | |||
|
170 | ||||
|
171 | $ cat <<EOF >> $HGRCPATH | |||
|
172 | > [extdiff] | |||
|
173 | > odd = | |||
|
174 | > [merge-tools] | |||
|
175 | > odd.diffargs = --foo='\$clabel' '\$clabel' "--bar=\$clabel" "\$clabel" | |||
|
176 | > odd.executable = echo | |||
|
177 | > EOF | |||
|
178 | #if windows | |||
|
179 | TODO | |||
|
180 | #else | |||
|
181 | $ hg --debug odd | grep '^running' | |||
|
182 | running "/bin/echo --foo='sp ace' 'sp ace' --bar='sp ace' 'sp ace'" in * (glob) | |||
|
183 | #endif | |||
|
184 | ||||
163 | #if execbit |
|
185 | #if execbit | |
164 |
|
186 | |||
165 | Test extdiff of multiple files in tmp dir: |
|
187 | Test extdiff of multiple files in tmp dir: |
General Comments 0
You need to be logged in to leave comments.
Login now