Mercurial > hg-stable
changeset 4055:e37786b29bed
docopy: deal with globs on windows in a better way
author | Alexis S. L. Carvalho <alexis@cecm.usp.br> |
---|---|
date | Tue, 30 Jan 2007 18:32:20 -0200 |
parents | e6d54283c090 |
children | f1622b4f467d |
files | mercurial/cmdutil.py mercurial/commands.py mercurial/util.py |
diffstat | 3 files changed, 13 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/cmdutil.py Tue Jan 30 18:32:18 2007 -0200 +++ b/mercurial/cmdutil.py Tue Jan 30 18:32:20 2007 -0200 @@ -127,7 +127,7 @@ pathname), mode) -def matchpats(repo, pats=[], opts={}, head=''): +def matchpats(repo, pats=[], opts={}, head='', globbed=False): cwd = repo.getcwd() if not pats and cwd: opts['include'] = [os.path.join(cwd, i) @@ -136,10 +136,12 @@ for x in opts.get('exclude', [])] cwd = '' return util.cmdmatcher(repo.root, cwd, pats or ['.'], opts.get('include'), - opts.get('exclude'), head) + opts.get('exclude'), head, globbed=globbed) -def walk(repo, pats=[], opts={}, node=None, head='', badmatch=None): - files, matchfn, anypats = matchpats(repo, pats, opts, head) +def walk(repo, pats=[], opts={}, node=None, head='', badmatch=None, + globbed=False): + files, matchfn, anypats = matchpats(repo, pats, opts, head, + globbed=globbed) exact = dict.fromkeys(files) for src, fn in repo.walk(node=node, files=files, match=matchfn, badmatch=badmatch):
--- a/mercurial/commands.py Tue Jan 30 18:32:18 2007 -0200 +++ b/mercurial/commands.py Tue Jan 30 18:32:20 2007 -0200 @@ -605,7 +605,7 @@ return res - pats = list(pats) + pats = util.expand_glob(pats) if not pats: raise util.Abort(_('no source or destination specified')) if len(pats) == 1: @@ -622,7 +622,8 @@ copylist = [] for pat in pats: srcs = [] - for tag, abssrc, relsrc, exact in cmdutil.walk(repo, [pat], opts): + for tag, abssrc, relsrc, exact in cmdutil.walk(repo, [pat], opts, + globbed=True): origsrc = okaytocopy(abssrc, relsrc, exact) if origsrc: srcs.append((origsrc, abssrc, relsrc, exact))
--- a/mercurial/util.py Tue Jan 30 18:32:18 2007 -0200 +++ b/mercurial/util.py Tue Jan 30 18:32:20 2007 -0200 @@ -375,8 +375,10 @@ def matcher(canonroot, cwd='', names=['.'], inc=[], exc=[], head='', src=None): return _matcher(canonroot, cwd, names, inc, exc, head, 'glob', src) -def cmdmatcher(canonroot, cwd='', names=['.'], inc=[], exc=[], head='', src=None): - names = expand_glob(names) +def cmdmatcher(canonroot, cwd='', names=['.'], inc=[], exc=[], head='', + src=None, globbed=False): + if not globbed: + names = expand_glob(names) return _matcher(canonroot, cwd, names, inc, exc, head, 'relpath', src) def _matcher(canonroot, cwd, names, inc, exc, head, dflt_pat, src):