##// END OF EJS Templates
dirstate: add a method to efficiently filter by match...
Siddharth Agarwal -
r21984:977a0b9a default
parent child Browse files
Show More
@@ -873,3 +873,21 b' class dirstate(object):'
873
873
874 return (lookup, modified, added, removed, deleted, unknown, ignored,
874 return (lookup, modified, added, removed, deleted, unknown, ignored,
875 clean)
875 clean)
876
877 def matches(self, match):
878 '''
879 return files in the dirstate (in whatever state) filtered by match
880 '''
881 dmap = self._map
882 if match.always():
883 return dmap.keys()
884 files = match.files()
885 if match.matchfn == match.exact:
886 # fast path -- filter the other way around, since typically files is
887 # much smaller than dmap
888 return [f for f in files if f in dmap]
889 if not match.anypats() and util.all(fn in dmap for fn in files):
890 # fast path -- all the values are known to be files, so just return
891 # that
892 return list(files)
893 return [f for f in dmap if match(f)]
General Comments 0
You need to be logged in to leave comments. Login now