##// END OF EJS Templates
merge with stable
Yuya Nishihara -
r42962:7013c7ce merge default
parent child Browse files
Show More
@@ -392,9 +392,7 b' def rebuildfncache(ui, repo):'
392
392
393 with repo.lock():
393 with repo.lock():
394 fnc = repo.store.fncache
394 fnc = repo.store.fncache
395 # Trigger load of fncache.
395 fnc.ensureloaded(warn=ui.warn)
396 if 'irrelevant' in fnc:
397 pass
398
396
399 oldentries = set(fnc.entries)
397 oldentries = set(fnc.entries)
400 newentries = set()
398 newentries = set()
@@ -458,7 +458,15 b' class fncache(object):'
458 # set of new additions to fncache
458 # set of new additions to fncache
459 self.addls = set()
459 self.addls = set()
460
460
461 def _load(self):
461 def ensureloaded(self, warn=None):
462 '''read the fncache file if not already read.
463
464 If the file on disk is corrupted, raise. If warn is provided,
465 warn and keep going instead.'''
466 if self.entries is None:
467 self._load(warn)
468
469 def _load(self, warn=None):
462 '''fill the entries from the fncache file'''
470 '''fill the entries from the fncache file'''
463 self._dirty = False
471 self._dirty = False
464 try:
472 try:
@@ -482,20 +490,27 b' class fncache(object):'
482 pass
490 pass
483
491
484 if chunk:
492 if chunk:
485 raise error.Abort(_("fncache does not ends with a newline"),
493 msg = _("fncache does not ends with a newline")
486 hint=_("use 'hg debugrebuildfncache' to rebuild"
494 if warn:
487 " the fncache"))
495 warn(msg + '\n')
488 self._checkentries(fp)
496 else:
497 raise error.Abort(msg,
498 hint=_("use 'hg debugrebuildfncache' to "
499 "rebuild the fncache"))
500 self._checkentries(fp, warn)
489 fp.close()
501 fp.close()
490
502
491 def _checkentries(self, fp):
503 def _checkentries(self, fp, warn):
492 """ make sure there is no empty string in entries """
504 """ make sure there is no empty string in entries """
493 if '' in self.entries:
505 if '' in self.entries:
494 fp.seek(0)
506 fp.seek(0)
495 for n, line in enumerate(util.iterfile(fp)):
507 for n, line in enumerate(util.iterfile(fp)):
496 if not line.rstrip('\n'):
508 if not line.rstrip('\n'):
497 t = _('invalid entry in fncache, line %d') % (n + 1)
509 t = _('invalid entry in fncache, line %d') % (n + 1)
498 raise error.Abort(t)
510 if warn:
511 warn(t + '\n')
512 else:
513 raise error.Abort(t)
499
514
500 def write(self, tr):
515 def write(self, tr):
501 if self._dirty:
516 if self._dirty:
@@ -435,6 +435,19 b' A single missing file should get restore'
435 data/.bar.i
435 data/.bar.i
436 data/foo.i
436 data/foo.i
437
437
438 debugrebuildfncache recovers from truncated line in fncache
439
440 $ printf a > .hg/store/fncache
441 $ hg debugrebuildfncache
442 fncache does not ends with a newline
443 adding data/.bar.i
444 adding data/foo.i
445 2 items added, 0 removed from fncache
446
447 $ cat .hg/store/fncache | sort
448 data/.bar.i
449 data/foo.i
450
438 $ cd ..
451 $ cd ..
439
452
440 Try a simple variation without dotencode to ensure fncache is ignorant of encoding
453 Try a simple variation without dotencode to ensure fncache is ignorant of encoding
@@ -1030,7 +1030,7 b' test for --time'
1030 # Ran 1 tests, 0 skipped, 0 failed.
1030 # Ran 1 tests, 0 skipped, 0 failed.
1031 # Producing time report
1031 # Producing time report
1032 start end cuser csys real Test
1032 start end cuser csys real Test
1033 \s*[\d\.]{5,8} \s*[\d\.]{5,8} \s*[\d\.]{5,8} \s*[\d\.]{5,8} \s*[\d\.]{5,8} test-success.t (re)
1033 \s*[\d\.]{5,8} \s*[\d\.]{5,8} \s*[\d\.]{5,8} \s*[\d\.]{5,8} \s*[\d\.]{5,8} test-success.t (re)
1034
1034
1035 test for --time with --job enabled
1035 test for --time with --job enabled
1036 ====================================
1036 ====================================
@@ -1041,7 +1041,7 b' test for --time with --job enabled'
1041 # Ran 1 tests, 0 skipped, 0 failed.
1041 # Ran 1 tests, 0 skipped, 0 failed.
1042 # Producing time report
1042 # Producing time report
1043 start end cuser csys real Test
1043 start end cuser csys real Test
1044 \s*[\d\.]{5,8} \s*[\d\.]{5,8} \s*[\d\.]{5,8} \s*[\d\.]{5,8} \s*[\d\.]{5,8} test-success.t (re)
1044 \s*[\d\.]{5,8} \s*[\d\.]{5,8} \s*[\d\.]{5,8} \s*[\d\.]{5,8} \s*[\d\.]{5,8} test-success.t (re)
1045
1045
1046 Skips
1046 Skips
1047 ================
1047 ================
General Comments 0
You need to be logged in to leave comments. Login now