Mercurial > hg
comparison mercurial/dirstate.py @ 24537:2bb13f2b778c stable
dirstate: don't require exact case when adding dirs on icasefs (issue4578)
We don't require it when adding files on a case insensitive filesystem, so don't
require it to add directories for consistency.
The problem with the previous code was that _walkexplicit() was only returning
the normalized directory. The file(s) in the directory are then appended, and
passed to the matcher. But if the user asks for 'capsdir1/capsdir', the matcher
will not accept 'CapsDir1/CapsDir/AbC.txt', and the name is dropped. Matching
based on the non-normalized name is required.
If not normalizing, skip the extra string building for efficiency. '.' is
replaced with '' so that the path being tested when no file is specified, isn't
prefixed with './' (and therefore fail the match).
author | Matt Harbison <matt_harbison@yahoo.com> |
---|---|
date | Tue, 31 Mar 2015 11:11:39 -0400 |
parents | 3cc630be5f09 |
children | 9fbda55c68d7 1784ca148392 |
comparison
equal
deleted
inserted
replaced
24536:d09262d6ec23 | 24537:2bb13f2b778c |
---|---|
649 if nf in dmap: | 649 if nf in dmap: |
650 # file replaced by dir on disk but still in dirstate | 650 # file replaced by dir on disk but still in dirstate |
651 results[nf] = None | 651 results[nf] = None |
652 if matchedir: | 652 if matchedir: |
653 matchedir(nf) | 653 matchedir(nf) |
654 foundadd(nf) | 654 foundadd((nf, ff)) |
655 elif kind == regkind or kind == lnkkind: | 655 elif kind == regkind or kind == lnkkind: |
656 results[nf] = st | 656 results[nf] = st |
657 else: | 657 else: |
658 badfn(ff, badtype(kind)) | 658 badfn(ff, badtype(kind)) |
659 if nf in dmap: | 659 if nf in dmap: |
725 | 725 |
726 # step 1: find all explicit files | 726 # step 1: find all explicit files |
727 results, work, dirsnotfound = self._walkexplicit(match, subrepos) | 727 results, work, dirsnotfound = self._walkexplicit(match, subrepos) |
728 | 728 |
729 skipstep3 = skipstep3 and not (work or dirsnotfound) | 729 skipstep3 = skipstep3 and not (work or dirsnotfound) |
730 work = [d for d in work if not dirignore(d)] | 730 work = [d for d in work if not dirignore(d[0])] |
731 wadd = work.append | 731 wadd = work.append |
732 | 732 |
733 # step 2: visit subdirectories | 733 # step 2: visit subdirectories |
734 while work: | 734 while work: |
735 nd = work.pop() | 735 nd, d = work.pop() |
736 skip = None | 736 skip = None |
737 if nd == '.': | 737 if nd == '.': |
738 nd = '' | 738 nd = '' |
739 d = '' | |
739 else: | 740 else: |
740 skip = '.hg' | 741 skip = '.hg' |
741 try: | 742 try: |
742 entries = listdir(join(nd), stat=True, skip=skip) | 743 entries = listdir(join(nd), stat=True, skip=skip) |
743 except OSError, inst: | 744 except OSError, inst: |
746 continue | 747 continue |
747 raise | 748 raise |
748 for f, kind, st in entries: | 749 for f, kind, st in entries: |
749 if normalize: | 750 if normalize: |
750 nf = normalize(nd and (nd + "/" + f) or f, True, True) | 751 nf = normalize(nd and (nd + "/" + f) or f, True, True) |
752 f = d and (d + "/" + f) or f | |
751 else: | 753 else: |
752 nf = nd and (nd + "/" + f) or f | 754 nf = nd and (nd + "/" + f) or f |
755 f = nf | |
753 if nf not in results: | 756 if nf not in results: |
754 if kind == dirkind: | 757 if kind == dirkind: |
755 if not ignore(nf): | 758 if not ignore(nf): |
756 if matchtdir: | 759 if matchtdir: |
757 matchtdir(nf) | 760 matchtdir(nf) |
758 wadd(nf) | 761 wadd((nf, f)) |
759 if nf in dmap and (matchalways or matchfn(nf)): | 762 if nf in dmap and (matchalways or matchfn(nf)): |
760 results[nf] = None | 763 results[nf] = None |
761 elif kind == regkind or kind == lnkkind: | 764 elif kind == regkind or kind == lnkkind: |
762 if nf in dmap: | 765 if nf in dmap: |
763 if matchalways or matchfn(nf): | 766 if matchalways or matchfn(nf): |
764 results[nf] = st | 767 results[nf] = st |
765 elif (matchalways or matchfn(nf)) and not ignore(nf): | 768 elif (matchalways or matchfn(f)) and not ignore(nf): |
766 results[nf] = st | 769 results[nf] = st |
767 elif nf in dmap and (matchalways or matchfn(nf)): | 770 elif nf in dmap and (matchalways or matchfn(nf)): |
768 results[nf] = None | 771 results[nf] = None |
769 | 772 |
770 for s in subrepos: | 773 for s in subrepos: |