# HG changeset patch # User Alexis S. L. Carvalho # Date 1170189140 7200 # Node ID e37786b29bedaae173b9549dd447e658fd6497ef # Parent e6d54283c0905704c29f14425fe64423d5e93a38 docopy: deal with globs on windows in a better way diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py --- a/mercurial/cmdutil.py +++ b/mercurial/cmdutil.py @@ -127,7 +127,7 @@ def make_file(repo, pat, node=None, 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 @@ def matchpats(repo, pats=[], opts={}, he 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): diff --git a/mercurial/commands.py b/mercurial/commands.py --- a/mercurial/commands.py +++ b/mercurial/commands.py @@ -605,7 +605,7 @@ def docopy(ui, repo, pats, opts, wlock): 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 @@ def docopy(ui, repo, pats, opts, wlock): 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)) diff --git a/mercurial/util.py b/mercurial/util.py --- a/mercurial/util.py +++ b/mercurial/util.py @@ -375,8 +375,10 @@ def canonpath(root, cwd, myname): 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):