Mercurial > public > mercurial-scm > hg
comparison mercurial/cmdutil.py @ 8568:4fa1618bf495
match: refactor patkind
add patkind(pat) to match
change external users
change util.patkind to _patsplit
author | Matt Mackall <mpm@selenic.com> |
---|---|
date | Sun, 24 May 2009 02:56:14 -0500 |
parents | 5b6a6ed4f185 |
children | 573734e7e6d0 |
comparison
equal
deleted
inserted
replaced
8567:fea40a677d43 | 8568:4fa1618bf495 |
---|---|
445 # pat: ossep | 445 # pat: ossep |
446 # dest ossep | 446 # dest ossep |
447 # srcs: list of (hgsep, hgsep, ossep, bool) | 447 # srcs: list of (hgsep, hgsep, ossep, bool) |
448 # return: function that takes hgsep and returns ossep | 448 # return: function that takes hgsep and returns ossep |
449 def targetpathafterfn(pat, dest, srcs): | 449 def targetpathafterfn(pat, dest, srcs): |
450 if util.patkind(pat, None)[0]: | 450 if _match.patkind(pat): |
451 # a mercurial pattern | 451 # a mercurial pattern |
452 res = lambda p: os.path.join(dest, | 452 res = lambda p: os.path.join(dest, |
453 os.path.basename(util.localpath(p))) | 453 os.path.basename(util.localpath(p))) |
454 else: | 454 else: |
455 abspfx = util.canonpath(repo.root, cwd, pat) | 455 abspfx = util.canonpath(repo.root, cwd, pat) |
493 if len(pats) == 1: | 493 if len(pats) == 1: |
494 raise util.Abort(_('no destination specified')) | 494 raise util.Abort(_('no destination specified')) |
495 dest = pats.pop() | 495 dest = pats.pop() |
496 destdirexists = os.path.isdir(dest) and not os.path.islink(dest) | 496 destdirexists = os.path.isdir(dest) and not os.path.islink(dest) |
497 if not destdirexists: | 497 if not destdirexists: |
498 if len(pats) > 1 or util.patkind(pats[0], None)[0]: | 498 if len(pats) > 1 or _match.patkind(pats[0]): |
499 raise util.Abort(_('with multiple sources, destination must be an ' | 499 raise util.Abort(_('with multiple sources, destination must be an ' |
500 'existing directory')) | 500 'existing directory')) |
501 if util.endswithsep(dest): | 501 if util.endswithsep(dest): |
502 raise util.Abort(_('destination %s is not a directory') % dest) | 502 raise util.Abort(_('destination %s is not a directory') % dest) |
503 | 503 |