##// END OF EJS Templates
revset: evaluate filesets against each revision for 'file()' (issue5778)...
Matt Harbison -
r35835:f6ca1e11 stable
parent child Browse files
Show More
@@ -1065,7 +1065,9 b' def _matchfiles(repo, subset, x):'
1065 1065 if rev is not None:
1066 1066 raise error.ParseError('_matchfiles expected at most one '
1067 1067 'revision')
1068 if value != '': # empty means working directory; leave rev as None
1068 if value == '': # empty means working directory
1069 rev = node.wdirrev
1070 else:
1069 1071 rev = value
1070 1072 elif prefix == 'd:':
1071 1073 if default is not None:
@@ -1076,9 +1078,9 b' def _matchfiles(repo, subset, x):'
1076 1078 raise error.ParseError('invalid _matchfiles prefix: %s' % prefix)
1077 1079 if not default:
1078 1080 default = 'glob'
1081 hasset = any(matchmod.patkind(p) == 'set' for p in pats + inc + exc)
1079 1082
1080 m = matchmod.match(repo.root, repo.getcwd(), pats, include=inc,
1081 exclude=exc, ctx=repo[rev], default=default)
1083 mcache = [None]
1082 1084
1083 1085 # This directly read the changelog data as creating changectx for all
1084 1086 # revisions is quite expensive.
@@ -1089,6 +1091,14 b' def _matchfiles(repo, subset, x):'
1089 1091 files = repo[x].files()
1090 1092 else:
1091 1093 files = getfiles(x)
1094
1095 if not mcache[0] or (hasset and rev is None):
1096 r = x if rev is None else rev
1097 mcache[0] = matchmod.match(repo.root, repo.getcwd(), pats,
1098 include=inc, exclude=exc, ctx=repo[r],
1099 default=default)
1100 m = mcache[0]
1101
1092 1102 for f in files:
1093 1103 if m(f):
1094 1104 return True
@@ -1675,7 +1675,7 b' Test falling back to slow path for non-e'
1675 1675 (string 'p:c')))
1676 1676 <filteredset
1677 1677 <spanset- 0:5>,
1678 <matchfiles patterns=['a', 'c'], include=[] exclude=[], default='relpath', rev=None>>
1678 <matchfiles patterns=['a', 'c'], include=[] exclude=[], default='relpath', rev=2147483647>>
1679 1679
1680 1680 Test multiple --include/--exclude/paths
1681 1681
@@ -1694,7 +1694,7 b' Test multiple --include/--exclude/paths'
1694 1694 (string 'x:e')))
1695 1695 <filteredset
1696 1696 <spanset- 0:5>,
1697 <matchfiles patterns=['a', 'e'], include=['a', 'e'] exclude=['b', 'e'], default='relpath', rev=None>>
1697 <matchfiles patterns=['a', 'e'], include=['a', 'e'] exclude=['b', 'e'], default='relpath', rev=2147483647>>
1698 1698
1699 1699 Test glob expansion of pats
1700 1700
@@ -1732,7 +1732,7 b' Test --follow on a directory'
1732 1732 (string 'p:dir')))
1733 1733 <filteredset
1734 1734 <generatorsetdesc->,
1735 <matchfiles patterns=['dir'], include=[] exclude=[], default='relpath', rev=None>>
1735 <matchfiles patterns=['dir'], include=[] exclude=[], default='relpath', rev=2147483647>>
1736 1736 $ hg up -q tip
1737 1737
1738 1738 Test --follow on file not in parent revision
@@ -1754,7 +1754,7 b' Test --follow and patterns'
1754 1754 (string 'p:glob:*')))
1755 1755 <filteredset
1756 1756 <generatorsetdesc->,
1757 <matchfiles patterns=['glob:*'], include=[] exclude=[], default='relpath', rev=None>>
1757 <matchfiles patterns=['glob:*'], include=[] exclude=[], default='relpath', rev=2147483647>>
1758 1758
1759 1759 Test --follow on a single rename
1760 1760
@@ -1875,7 +1875,7 b' Test "set:..." and parent revision'
1875 1875 (string 'p:set:copied()')))
1876 1876 <filteredset
1877 1877 <spanset- 0:7>,
1878 <matchfiles patterns=['set:copied()'], include=[] exclude=[], default='relpath', rev=None>>
1878 <matchfiles patterns=['set:copied()'], include=[] exclude=[], default='relpath', rev=2147483647>>
1879 1879 $ testlog --include "set:copied()"
1880 1880 []
1881 1881 (func
@@ -1886,11 +1886,13 b' Test "set:..." and parent revision'
1886 1886 (string 'i:set:copied()')))
1887 1887 <filteredset
1888 1888 <spanset- 0:7>,
1889 <matchfiles patterns=[], include=['set:copied()'] exclude=[], default='relpath', rev=None>>
1889 <matchfiles patterns=[], include=['set:copied()'] exclude=[], default='relpath', rev=2147483647>>
1890 1890 $ testlog -r "sort(file('set:copied()'), -rev)"
1891 1891 ["sort(file('set:copied()'), -rev)"]
1892 1892 []
1893 <baseset []>
1893 <filteredset
1894 <fullreposet- 0:7>,
1895 <matchfiles patterns=['set:copied()'], include=[] exclude=[], default='glob', rev=None>>
1894 1896
1895 1897 Test --removed
1896 1898
@@ -1908,7 +1910,7 b' Test --removed'
1908 1910 (string 'p:a')))
1909 1911 <filteredset
1910 1912 <spanset- 0:7>,
1911 <matchfiles patterns=['a'], include=[] exclude=[], default='relpath', rev=None>>
1913 <matchfiles patterns=['a'], include=[] exclude=[], default='relpath', rev=2147483647>>
1912 1914 $ testlog --removed --follow a
1913 1915 []
1914 1916 (func
@@ -1919,7 +1921,7 b' Test --removed'
1919 1921 (string 'p:a')))
1920 1922 <filteredset
1921 1923 <generatorsetdesc->,
1922 <matchfiles patterns=['a'], include=[] exclude=[], default='relpath', rev=None>>
1924 <matchfiles patterns=['a'], include=[] exclude=[], default='relpath', rev=2147483647>>
1923 1925
1924 1926 Test --patch and --stat with --follow and --follow-first
1925 1927
@@ -2290,7 +2292,7 b' Test subdir'
2290 2292 (string 'p:.')))
2291 2293 <filteredset
2292 2294 <spanset- 0:9>,
2293 <matchfiles patterns=['.'], include=[] exclude=[], default='relpath', rev=None>>
2295 <matchfiles patterns=['.'], include=[] exclude=[], default='relpath', rev=2147483647>>
2294 2296 $ testlog ../b
2295 2297 []
2296 2298 (func
@@ -726,6 +726,20 b' bit correctly on the platform being unaw'
726 726
727 727 #endif
728 728
729 The fileset revset is evaluated for each revision, instead of once on wdir(),
730 and then patterns matched on each revision. Here, no exec bits are set in
731 wdir(), but a matching revision is detected.
732
733 (Teach large2 is not an executable. Maybe this is a bug of largefiles.)
734 #if execbit
735 $ chmod -x .hglf/large2
736 #endif
737
738 $ hg files 'set:exec()'
739 [1]
740 $ hg log -qr 'file("set:exec()")'
741 9:be1b433a65b1
742
729 743 Test a fatal error interrupting an update. Verify that status report dirty
730 744 files correctly after an interrupted update. Also verify that checking all
731 745 hashes reveals it isn't clean.
General Comments 0
You need to be logged in to leave comments. Login now