Show More
@@ -653,7 +653,7 b' def _checkunknownfile(repo, wctx, mctx, ' | |||
|
653 | 653 | and repo.dirstate.normalize(f) not in repo.dirstate |
|
654 | 654 | and mctx[f2].cmp(wctx[f])) |
|
655 | 655 | |
|
656 | def _checkunknowndirs(repo, f): | |
|
656 | class _unknowndirschecker(object): | |
|
657 | 657 | """ |
|
658 | 658 | Look for any unknown files or directories that may have a path conflict |
|
659 | 659 | with a file. If any path prefix of the file exists as a file or link, |
@@ -663,13 +663,32 b' def _checkunknowndirs(repo, f):' | |||
|
663 | 663 | Returns the shortest path at which a conflict occurs, or None if there is |
|
664 | 664 | no conflict. |
|
665 | 665 | """ |
|
666 | def __init__(self): | |
|
667 | # A set of paths known to be good. This prevents repeated checking of | |
|
668 | # dirs. It will be updated with any new dirs that are checked and found | |
|
669 | # to be safe. | |
|
670 | self._unknowndircache = set() | |
|
666 | 671 | |
|
672 | # A set of paths that are known to be absent. This prevents repeated | |
|
673 | # checking of subdirectories that are known not to exist. It will be | |
|
674 | # updated with any new dirs that are checked and found to be absent. | |
|
675 | self._missingdircache = set() | |
|
676 | ||
|
677 | def __call__(self, repo, f): | |
|
667 | 678 | # Check for path prefixes that exist as unknown files. |
|
668 | 679 | for p in reversed(list(util.finddirs(f))): |
|
669 | if (repo.wvfs.audit.check(p) | |
|
670 | and repo.wvfs.isfileorlink(p) | |
|
680 | if p in self._missingdircache: | |
|
681 | return | |
|
682 | if p in self._unknowndircache: | |
|
683 | continue | |
|
684 | if repo.wvfs.audit.check(p): | |
|
685 | if (repo.wvfs.isfileorlink(p) | |
|
671 | 686 | and repo.dirstate.normalize(p) not in repo.dirstate): |
|
672 | 687 | return p |
|
688 | if not repo.wvfs.lexists(p): | |
|
689 | self._missingdircache.add(p) | |
|
690 | return | |
|
691 | self._unknowndircache.add(p) | |
|
673 | 692 | |
|
674 | 693 | # Check if the file conflicts with a directory containing unknown files. |
|
675 | 694 | if repo.wvfs.audit.check(f) and repo.wvfs.isdir(f): |
@@ -701,12 +720,13 b' def _checkunknownfiles(repo, wctx, mctx,' | |||
|
701 | 720 | elif config == 'warn': |
|
702 | 721 | warnconflicts.update(conflicts) |
|
703 | 722 | |
|
723 | checkunknowndirs = _unknowndirschecker() | |
|
704 | 724 | for f, (m, args, msg) in actions.iteritems(): |
|
705 | 725 | if m in ('c', 'dc'): |
|
706 | 726 | if _checkunknownfile(repo, wctx, mctx, f): |
|
707 | 727 | fileconflicts.add(f) |
|
708 | 728 | elif pathconfig and f not in wctx: |
|
709 |
path = |
|
|
729 | path = checkunknowndirs(repo, f) | |
|
710 | 730 | if path is not None: |
|
711 | 731 | pathconflicts.add(path) |
|
712 | 732 | elif m == 'dg': |
General Comments 0
You need to be logged in to leave comments.
Login now