##// 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 for i in xrange(offset, len(tr.entries)):
134 for i in xrange(offset, len(tr.entries)):
135 file, troffset, ignore = tr.entries[i]
135 file, troffset, ignore = tr.entries[i]
136 repo.sopener(file, 'a').truncate(troffset)
136 repo.sopener(file, 'a').truncate(troffset)
137 if troffset == 0:
138 repo.store.markremoved(file)
137 tr.close()
139 tr.close()
138 except: # re-raises
140 except: # re-raises
139 tr.abort()
141 tr.abort()
@@ -343,6 +343,9 b' class basicstore(object):'
343 def invalidatecaches(self):
343 def invalidatecaches(self):
344 pass
344 pass
345
345
346 def markremoved(self, fn):
347 pass
348
346 def __contains__(self, path):
349 def __contains__(self, path):
347 '''Checks if the store contains path'''
350 '''Checks if the store contains path'''
348 path = "/".join(("data", path))
351 path = "/".join(("data", path))
@@ -421,6 +424,15 b' class fncache(object):'
421 self._dirty = True
424 self._dirty = True
422 self.entries.add(fn)
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 def __contains__(self, fn):
436 def __contains__(self, fn):
425 if self.entries is None:
437 if self.entries is None:
426 self._load()
438 self._load()
@@ -495,6 +507,9 b' class fncachestore(basicstore):'
495 def invalidatecaches(self):
507 def invalidatecaches(self):
496 self.fncache.entries = None
508 self.fncache.entries = None
497
509
510 def markremoved(self, fn):
511 self.fncache.remove(fn)
512
498 def _exists(self, f):
513 def _exists(self, f):
499 ef = self.encode(f)
514 ef = self.encode(f)
500 try:
515 try:
@@ -336,6 +336,19 b' 2 different branches and a common ancest'
336 saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob)
336 saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob)
337 $ restore
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 stripping an empty revset
352 stripping an empty revset
340
353
341 $ hg strip "1 and not 1"
354 $ hg strip "1 and not 1"
General Comments 0
You need to be logged in to leave comments. Login now