Show More
@@ -392,9 +392,7 b' def rebuildfncache(ui, repo):' | |||
|
392 | 392 | |
|
393 | 393 | with repo.lock(): |
|
394 | 394 | fnc = repo.store.fncache |
|
395 | # Trigger load of fncache. | |
|
396 | if 'irrelevant' in fnc: | |
|
397 | pass | |
|
395 | fnc.ensureloaded(warn=ui.warn) | |
|
398 | 396 | |
|
399 | 397 | oldentries = set(fnc.entries) |
|
400 | 398 | newentries = set() |
@@ -458,7 +458,15 b' class fncache(object):' | |||
|
458 | 458 | # set of new additions to fncache |
|
459 | 459 | self.addls = set() |
|
460 | 460 | |
|
461 |
def |
|
|
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 | 470 | '''fill the entries from the fncache file''' |
|
463 | 471 | self._dirty = False |
|
464 | 472 | try: |
@@ -482,20 +490,27 b' class fncache(object):' | |||
|
482 | 490 | pass |
|
483 | 491 | |
|
484 | 492 | if chunk: |
|
485 |
|
|
|
486 | hint=_("use 'hg debugrebuildfncache' to rebuild" | |
|
487 | " the fncache")) | |
|
488 | self._checkentries(fp) | |
|
493 | msg = _("fncache does not ends with a newline") | |
|
494 | if warn: | |
|
495 | warn(msg + '\n') | |
|
496 | else: | |
|
497 | raise error.Abort(msg, | |
|
498 | hint=_("use 'hg debugrebuildfncache' to " | |
|
499 | "rebuild the fncache")) | |
|
500 | self._checkentries(fp, warn) | |
|
489 | 501 | fp.close() |
|
490 | 502 | |
|
491 | def _checkentries(self, fp): | |
|
503 | def _checkentries(self, fp, warn): | |
|
492 | 504 | """ make sure there is no empty string in entries """ |
|
493 | 505 | if '' in self.entries: |
|
494 | 506 | fp.seek(0) |
|
495 | 507 | for n, line in enumerate(util.iterfile(fp)): |
|
496 | 508 | if not line.rstrip('\n'): |
|
497 | 509 | t = _('invalid entry in fncache, line %d') % (n + 1) |
|
498 |
|
|
|
510 | if warn: | |
|
511 | warn(t + '\n') | |
|
512 | else: | |
|
513 | raise error.Abort(t) | |
|
499 | 514 | |
|
500 | 515 | def write(self, tr): |
|
501 | 516 | if self._dirty: |
@@ -435,6 +435,19 b' A single missing file should get restore' | |||
|
435 | 435 | data/.bar.i |
|
436 | 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 | 451 | $ cd .. |
|
439 | 452 | |
|
440 | 453 | Try a simple variation without dotencode to ensure fncache is ignorant of encoding |
@@ -1030,7 +1030,7 b' test for --time' | |||
|
1030 | 1030 | # Ran 1 tests, 0 skipped, 0 failed. |
|
1031 | 1031 | # Producing time report |
|
1032 | 1032 | start end cuser csys real Test |
|
1033 |
\s*[\d\.]{5,8} |
|
|
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 | 1035 | test for --time with --job enabled |
|
1036 | 1036 | ==================================== |
@@ -1041,7 +1041,7 b' test for --time with --job enabled' | |||
|
1041 | 1041 | # Ran 1 tests, 0 skipped, 0 failed. |
|
1042 | 1042 | # Producing time report |
|
1043 | 1043 | start end cuser csys real Test |
|
1044 |
\s*[\d\.]{5,8} |
|
|
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 | 1046 | Skips |
|
1047 | 1047 | ================ |
General Comments 0
You need to be logged in to leave comments.
Login now