comparison mercurial/manifest.py @ 29056:e2178f7d17c0

manifest: improve filesnotin performance by using lazymanifest diff lazymanifests can compute diffs significantly faster than taking the set of two manifests and calculating the delta. when running hg diff --git -c . on Facebook's big repo, this reduces the run time from 2.1s to 1.5s.
author Tony Tung <tonytung@merly.org>
date Mon, 02 May 2016 15:22:16 -0700
parents 1ac8ce137377
children 98e8313dcd9e
comparison
equal deleted inserted replaced
29055:4a65c9c6cd3f 29056:e2178f7d17c0
209 def keys(self): 209 def keys(self):
210 return list(self.iterkeys()) 210 return list(self.iterkeys())
211 211
212 def filesnotin(self, m2): 212 def filesnotin(self, m2):
213 '''Set of files in this manifest that are not in the other''' 213 '''Set of files in this manifest that are not in the other'''
214 files = set(self) 214 diff = self.diff(m2)
215 files.difference_update(m2) 215 files = set(filepath
216 for filepath, hashflags in diff.iteritems()
217 if hashflags[1][0] is None)
216 return files 218 return files
217 219
218 @propertycache 220 @propertycache
219 def _dirs(self): 221 def _dirs(self):
220 return util.dirs(self) 222 return util.dirs(self)