##// END OF EJS Templates
docopy: deal with globs on windows in a better way
Alexis S. L. Carvalho -
r4055:e37786b2 default
parent child Browse files
Show More
@@ -127,7 +127,7 b' def make_file(repo, pat, node=None,'
127 127 pathname),
128 128 mode)
129 129
130 def matchpats(repo, pats=[], opts={}, head=''):
130 def matchpats(repo, pats=[], opts={}, head='', globbed=False):
131 131 cwd = repo.getcwd()
132 132 if not pats and cwd:
133 133 opts['include'] = [os.path.join(cwd, i)
@@ -136,10 +136,12 b' def matchpats(repo, pats=[], opts={}, he'
136 136 for x in opts.get('exclude', [])]
137 137 cwd = ''
138 138 return util.cmdmatcher(repo.root, cwd, pats or ['.'], opts.get('include'),
139 opts.get('exclude'), head)
139 opts.get('exclude'), head, globbed=globbed)
140 140
141 def walk(repo, pats=[], opts={}, node=None, head='', badmatch=None):
142 files, matchfn, anypats = matchpats(repo, pats, opts, head)
141 def walk(repo, pats=[], opts={}, node=None, head='', badmatch=None,
142 globbed=False):
143 files, matchfn, anypats = matchpats(repo, pats, opts, head,
144 globbed=globbed)
143 145 exact = dict.fromkeys(files)
144 146 for src, fn in repo.walk(node=node, files=files, match=matchfn,
145 147 badmatch=badmatch):
@@ -605,7 +605,7 b' def docopy(ui, repo, pats, opts, wlock):'
605 605 return res
606 606
607 607
608 pats = list(pats)
608 pats = util.expand_glob(pats)
609 609 if not pats:
610 610 raise util.Abort(_('no source or destination specified'))
611 611 if len(pats) == 1:
@@ -622,7 +622,8 b' def docopy(ui, repo, pats, opts, wlock):'
622 622 copylist = []
623 623 for pat in pats:
624 624 srcs = []
625 for tag, abssrc, relsrc, exact in cmdutil.walk(repo, [pat], opts):
625 for tag, abssrc, relsrc, exact in cmdutil.walk(repo, [pat], opts,
626 globbed=True):
626 627 origsrc = okaytocopy(abssrc, relsrc, exact)
627 628 if origsrc:
628 629 srcs.append((origsrc, abssrc, relsrc, exact))
@@ -375,8 +375,10 b' def canonpath(root, cwd, myname):'
375 375 def matcher(canonroot, cwd='', names=['.'], inc=[], exc=[], head='', src=None):
376 376 return _matcher(canonroot, cwd, names, inc, exc, head, 'glob', src)
377 377
378 def cmdmatcher(canonroot, cwd='', names=['.'], inc=[], exc=[], head='', src=None):
379 names = expand_glob(names)
378 def cmdmatcher(canonroot, cwd='', names=['.'], inc=[], exc=[], head='',
379 src=None, globbed=False):
380 if not globbed:
381 names = expand_glob(names)
380 382 return _matcher(canonroot, cwd, names, inc, exc, head, 'relpath', src)
381 383
382 384 def _matcher(canonroot, cwd, names, inc, exc, head, dflt_pat, src):
General Comments 0
You need to be logged in to leave comments. Login now