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