Show More
@@ -15,7 +15,7 b' platform-specific details from the core.' | |||||
15 | from i18n import gettext as _ |
|
15 | from i18n import gettext as _ | |
16 | from demandload import * |
|
16 | from demandload import * | |
17 | demandload(globals(), "cStringIO errno getpass popen2 re shutil sys tempfile") |
|
17 | demandload(globals(), "cStringIO errno getpass popen2 re shutil sys tempfile") | |
18 | demandload(globals(), "os threading time calendar ConfigParser locale") |
|
18 | demandload(globals(), "os threading time calendar ConfigParser locale glob") | |
19 |
|
19 | |||
20 | _encoding = os.environ.get("HGENCODING") or locale.getpreferredencoding() \ |
|
20 | _encoding = os.environ.get("HGENCODING") or locale.getpreferredencoding() \ | |
21 | or "ascii" |
|
21 | or "ascii" | |
@@ -234,6 +234,22 b' class UnexpectedOutput(Abort):' | |||||
234 | def always(fn): return True |
|
234 | def always(fn): return True | |
235 | def never(fn): return False |
|
235 | def never(fn): return False | |
236 |
|
236 | |||
|
237 | def expand_glob(pats): | |||
|
238 | '''On Windows, expand the implicit globs in a list of patterns''' | |||
|
239 | if os.name != 'nt': | |||
|
240 | return list(pats) | |||
|
241 | ret = [] | |||
|
242 | for p in pats: | |||
|
243 | kind, name = patkind(p, None) | |||
|
244 | if kind is None: | |||
|
245 | globbed = glob.glob(name) | |||
|
246 | if globbed: | |||
|
247 | ret.extend(globbed) | |||
|
248 | continue | |||
|
249 | # if we couldn't expand the glob, just keep it around | |||
|
250 | ret.append(p) | |||
|
251 | return ret | |||
|
252 | ||||
237 | def patkind(name, dflt_pat='glob'): |
|
253 | def patkind(name, dflt_pat='glob'): | |
238 | """Split a string into an optional pattern kind prefix and the |
|
254 | """Split a string into an optional pattern kind prefix and the | |
239 | actual pattern.""" |
|
255 | actual pattern.""" | |
@@ -360,11 +376,8 b" def matcher(canonroot, cwd='', names=['." | |||||
360 | return _matcher(canonroot, cwd, names, inc, exc, head, 'glob', src) |
|
376 | return _matcher(canonroot, cwd, names, inc, exc, head, 'glob', src) | |
361 |
|
377 | |||
362 | def cmdmatcher(canonroot, cwd='', names=['.'], inc=[], exc=[], head='', src=None): |
|
378 | def cmdmatcher(canonroot, cwd='', names=['.'], inc=[], exc=[], head='', src=None): | |
363 | if os.name == 'nt': |
|
379 | names = expand_glob(names) | |
364 | dflt_pat = 'glob' |
|
380 | return _matcher(canonroot, cwd, names, inc, exc, head, 'relpath', src) | |
365 | else: |
|
|||
366 | dflt_pat = 'relpath' |
|
|||
367 | return _matcher(canonroot, cwd, names, inc, exc, head, dflt_pat, src) |
|
|||
368 |
|
381 | |||
369 | def _matcher(canonroot, cwd, names, inc, exc, head, dflt_pat, src): |
|
382 | def _matcher(canonroot, cwd, names, inc, exc, head, dflt_pat, src): | |
370 | """build a function to match a set of file patterns |
|
383 | """build a function to match a set of file patterns |
General Comments 0
You need to be logged in to leave comments.
Login now