Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/cmdutil.py @ 13971:bfeaa88b875d
move canonpath from util to scmutil
author | Adrian Buehlmann <adrian@cadifra.com> |
---|---|
date | Wed, 20 Apr 2011 21:41:41 +0200 |
parents | 8b252e826c68 |
children | d1f4e7fd970a |
comparison
equal
deleted
inserted
replaced
13970:d13913355390 | 13971:bfeaa88b875d |
---|---|
427 | 427 |
428 # abssrc: hgsep | 428 # abssrc: hgsep |
429 # relsrc: ossep | 429 # relsrc: ossep |
430 # otarget: ossep | 430 # otarget: ossep |
431 def copyfile(abssrc, relsrc, otarget, exact): | 431 def copyfile(abssrc, relsrc, otarget, exact): |
432 abstarget = util.canonpath(repo.root, cwd, otarget) | 432 abstarget = scmutil.canonpath(repo.root, cwd, otarget) |
433 reltarget = repo.pathto(abstarget, cwd) | 433 reltarget = repo.pathto(abstarget, cwd) |
434 target = repo.wjoin(abstarget) | 434 target = repo.wjoin(abstarget) |
435 src = repo.wjoin(abssrc) | 435 src = repo.wjoin(abssrc) |
436 state = repo.dirstate[abstarget] | 436 state = repo.dirstate[abstarget] |
437 | 437 |
495 # dest ossep | 495 # dest ossep |
496 # srcs: list of (hgsep, hgsep, ossep, bool) | 496 # srcs: list of (hgsep, hgsep, ossep, bool) |
497 # return: function that takes hgsep and returns ossep | 497 # return: function that takes hgsep and returns ossep |
498 def targetpathfn(pat, dest, srcs): | 498 def targetpathfn(pat, dest, srcs): |
499 if os.path.isdir(pat): | 499 if os.path.isdir(pat): |
500 abspfx = util.canonpath(repo.root, cwd, pat) | 500 abspfx = scmutil.canonpath(repo.root, cwd, pat) |
501 abspfx = util.localpath(abspfx) | 501 abspfx = util.localpath(abspfx) |
502 if destdirexists: | 502 if destdirexists: |
503 striplen = len(os.path.split(abspfx)[0]) | 503 striplen = len(os.path.split(abspfx)[0]) |
504 else: | 504 else: |
505 striplen = len(abspfx) | 505 striplen = len(abspfx) |
521 if matchmod.patkind(pat): | 521 if matchmod.patkind(pat): |
522 # a mercurial pattern | 522 # a mercurial pattern |
523 res = lambda p: os.path.join(dest, | 523 res = lambda p: os.path.join(dest, |
524 os.path.basename(util.localpath(p))) | 524 os.path.basename(util.localpath(p))) |
525 else: | 525 else: |
526 abspfx = util.canonpath(repo.root, cwd, pat) | 526 abspfx = scmutil.canonpath(repo.root, cwd, pat) |
527 if len(abspfx) < len(srcs[0][0]): | 527 if len(abspfx) < len(srcs[0][0]): |
528 # A directory. Either the target path contains the last | 528 # A directory. Either the target path contains the last |
529 # component of the source path or it does not. | 529 # component of the source path or it does not. |
530 def evalpath(striplen): | 530 def evalpath(striplen): |
531 score = 0 | 531 score = 0 |