648 hg cp sym x -> x is symlink |
648 hg cp sym x -> x is symlink |
649 cp sym x; hg cp -A sym x -> x is file (maybe expanded keywords) |
649 cp sym x; hg cp -A sym x -> x is file (maybe expanded keywords) |
650 For the latter we have to follow the symlink to find out whether its |
650 For the latter we have to follow the symlink to find out whether its |
651 target is configured for expansion and we therefore must unexpand the |
651 target is configured for expansion and we therefore must unexpand the |
652 keywords in the destination.''' |
652 keywords in the destination.''' |
653 orig(ui, repo, pats, opts, rename) |
653 wlock = repo.wlock() |
654 if opts.get('dry_run'): |
654 try: |
655 return |
655 orig(ui, repo, pats, opts, rename) |
656 wctx = repo[None] |
656 if opts.get('dry_run'): |
657 cwd = repo.getcwd() |
657 return |
658 |
658 wctx = repo[None] |
659 def haskwsource(dest): |
659 cwd = repo.getcwd() |
660 '''Returns true if dest is a regular file and configured for |
660 |
661 expansion or a symlink which points to a file configured for |
661 def haskwsource(dest): |
662 expansion. ''' |
662 '''Returns true if dest is a regular file and configured for |
663 source = repo.dirstate.copied(dest) |
663 expansion or a symlink which points to a file configured for |
664 if 'l' in wctx.flags(source): |
664 expansion. ''' |
665 source = scmutil.canonpath(repo.root, cwd, |
665 source = repo.dirstate.copied(dest) |
666 os.path.realpath(source)) |
666 if 'l' in wctx.flags(source): |
667 return kwt.match(source) |
667 source = scmutil.canonpath(repo.root, cwd, |
668 |
668 os.path.realpath(source)) |
669 candidates = [f for f in repo.dirstate.copies() if |
669 return kwt.match(source) |
670 'l' not in wctx.flags(f) and haskwsource(f)] |
670 |
671 kwt.overwrite(wctx, candidates, False, False) |
671 candidates = [f for f in repo.dirstate.copies() if |
|
672 'l' not in wctx.flags(f) and haskwsource(f)] |
|
673 kwt.overwrite(wctx, candidates, False, False) |
|
674 finally: |
|
675 wlock.release() |
672 |
676 |
673 def kw_dorecord(orig, ui, repo, commitfunc, *pats, **opts): |
677 def kw_dorecord(orig, ui, repo, commitfunc, *pats, **opts): |
674 '''Wraps record.dorecord expanding keywords after recording.''' |
678 '''Wraps record.dorecord expanding keywords after recording.''' |
675 wlock = repo.wlock() |
679 wlock = repo.wlock() |
676 try: |
680 try: |