##// END OF EJS Templates
fncache: clean up fncache during strips...
Durham Goode -
r20885:f49d60fa default
parent child Browse files
Show More
@@ -134,6 +134,8 b' def strip(ui, repo, nodelist, backup="al'
134 134 for i in xrange(offset, len(tr.entries)):
135 135 file, troffset, ignore = tr.entries[i]
136 136 repo.sopener(file, 'a').truncate(troffset)
137 if troffset == 0:
138 repo.store.markremoved(file)
137 139 tr.close()
138 140 except: # re-raises
139 141 tr.abort()
@@ -343,6 +343,9 b' class basicstore(object):'
343 343 def invalidatecaches(self):
344 344 pass
345 345
346 def markremoved(self, fn):
347 pass
348
346 349 def __contains__(self, path):
347 350 '''Checks if the store contains path'''
348 351 path = "/".join(("data", path))
@@ -421,6 +424,15 b' class fncache(object):'
421 424 self._dirty = True
422 425 self.entries.add(fn)
423 426
427 def remove(self, fn):
428 if self.entries is None:
429 self._load()
430 try:
431 self.entries.remove(fn)
432 self._dirty = True
433 except KeyError:
434 pass
435
424 436 def __contains__(self, fn):
425 437 if self.entries is None:
426 438 self._load()
@@ -495,6 +507,9 b' class fncachestore(basicstore):'
495 507 def invalidatecaches(self):
496 508 self.fncache.entries = None
497 509
510 def markremoved(self, fn):
511 self.fncache.remove(fn)
512
498 513 def _exists(self, f):
499 514 ef = self.encode(f)
500 515 try:
@@ -336,6 +336,19 b' 2 different branches and a common ancest'
336 336 saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob)
337 337 $ restore
338 338
339 verify fncache is kept up-to-date
340
341 $ touch a
342 $ hg ci -qAm a
343 $ cat .hg/store/fncache | sort
344 data/a.i
345 data/bar.i
346 $ hg strip tip
347 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
348 saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob)
349 $ cat .hg/store/fncache
350 data/bar.i
351
339 352 stripping an empty revset
340 353
341 354 $ hg strip "1 and not 1"
General Comments 0
You need to be logged in to leave comments. Login now