Show More
|
1 | NO CONTENT: new file 100644, binary diff hidden |
|
1 | NO CONTENT: new file 100644, binary diff hidden |
@@ -20,6 +20,7 b' from .interfaces import (' | |||
|
20 | 20 | from .utils import storageutil |
|
21 | 21 | from .revlogutils import ( |
|
22 | 22 | constants as revlog_constants, |
|
23 | rewrite, | |
|
23 | 24 | ) |
|
24 | 25 | |
|
25 | 26 | |
@@ -158,6 +159,9 b' class filelog(object):' | |||
|
158 | 159 | ) |
|
159 | 160 | |
|
160 | 161 | with self._revlog._writing(transaction): |
|
162 | ||
|
163 | deltas = rewrite.filter_delta_issue6528(self._revlog, deltas) | |
|
164 | ||
|
161 | 165 | return self._revlog.addgroup( |
|
162 | 166 | deltas, |
|
163 | 167 | linkmapper, |
@@ -29,6 +29,7 b' from .constants import (' | |||
|
29 | 29 | ENTRY_SIDEDATA_COMPRESSED_LENGTH, |
|
30 | 30 | ENTRY_SIDEDATA_COMPRESSION_MODE, |
|
31 | 31 | ENTRY_SIDEDATA_OFFSET, |
|
32 | REVIDX_ISCENSORED, | |
|
32 | 33 | REVLOGV0, |
|
33 | 34 | REVLOGV1, |
|
34 | 35 | ) |
@@ -36,6 +37,7 b' from ..i18n import _' | |||
|
36 | 37 | |
|
37 | 38 | from .. import ( |
|
38 | 39 | error, |
|
40 | mdiff, | |
|
39 | 41 | pycompat, |
|
40 | 42 | revlogutils, |
|
41 | 43 | util, |
@@ -719,6 +721,88 b' def _from_report(ui, repo, context, from' | |||
|
719 | 721 | _reorder_filelog_parents(repo, fl, sorted(to_fix)) |
|
720 | 722 | |
|
721 | 723 | |
|
724 | def filter_delta_issue6528(revlog, deltas_iter): | |
|
725 | """filter incomind deltas to repaire issue 6528 on the fly""" | |
|
726 | metadata_cache = {} | |
|
727 | ||
|
728 | deltacomputer = deltas.deltacomputer(revlog) | |
|
729 | ||
|
730 | for rev, d in enumerate(deltas_iter, len(revlog)): | |
|
731 | ( | |
|
732 | node, | |
|
733 | p1_node, | |
|
734 | p2_node, | |
|
735 | linknode, | |
|
736 | deltabase, | |
|
737 | delta, | |
|
738 | flags, | |
|
739 | sidedata, | |
|
740 | ) = d | |
|
741 | ||
|
742 | if not revlog.index.has_node(deltabase): | |
|
743 | raise error.LookupError( | |
|
744 | deltabase, revlog.radix, _(b'unknown parent') | |
|
745 | ) | |
|
746 | base_rev = revlog.rev(deltabase) | |
|
747 | if not revlog.index.has_node(p1_node): | |
|
748 | raise error.LookupError(p1_node, revlog.radix, _(b'unknown parent')) | |
|
749 | p1_rev = revlog.rev(p1_node) | |
|
750 | if not revlog.index.has_node(p2_node): | |
|
751 | raise error.LookupError(p2_node, revlog.radix, _(b'unknown parent')) | |
|
752 | p2_rev = revlog.rev(p2_node) | |
|
753 | ||
|
754 | is_censored = lambda: bool(flags & REVIDX_ISCENSORED) | |
|
755 | delta_base = lambda: revlog.rev(delta_base) | |
|
756 | delta_base = lambda: base_rev | |
|
757 | parent_revs = lambda: (p1_rev, p2_rev) | |
|
758 | ||
|
759 | def full_text(): | |
|
760 | # note: being able to reuse the full text computation in the | |
|
761 | # underlying addrevision would be useful however this is a bit too | |
|
762 | # intrusive the for the "quick" issue6528 we are writing before the | |
|
763 | # 5.8 release | |
|
764 | textlen = mdiff.patchedsize(revlog.size(base_rev), delta) | |
|
765 | ||
|
766 | revinfo = revlogutils.revisioninfo( | |
|
767 | node, | |
|
768 | p1_node, | |
|
769 | p2_node, | |
|
770 | [None], | |
|
771 | textlen, | |
|
772 | (base_rev, delta), | |
|
773 | flags, | |
|
774 | ) | |
|
775 | # cached by the global "writing" context | |
|
776 | assert revlog._writinghandles is not None | |
|
777 | if revlog._inline: | |
|
778 | fh = revlog._writinghandles[0] | |
|
779 | else: | |
|
780 | fh = revlog._writinghandles[1] | |
|
781 | return deltacomputer.buildtext(revinfo, fh) | |
|
782 | ||
|
783 | is_affected = _is_revision_affected_fast_inner( | |
|
784 | is_censored, | |
|
785 | delta_base, | |
|
786 | lambda: delta, | |
|
787 | full_text, | |
|
788 | parent_revs, | |
|
789 | rev, | |
|
790 | metadata_cache, | |
|
791 | ) | |
|
792 | if is_affected: | |
|
793 | d = ( | |
|
794 | node, | |
|
795 | p2_node, | |
|
796 | p1_node, | |
|
797 | linknode, | |
|
798 | deltabase, | |
|
799 | delta, | |
|
800 | flags, | |
|
801 | sidedata, | |
|
802 | ) | |
|
803 | yield d | |
|
804 | ||
|
805 | ||
|
722 | 806 | def repair_issue6528( |
|
723 | 807 | ui, repo, dry_run=False, to_report=None, from_report=None, paranoid=False |
|
724 | 808 | ): |
@@ -431,3 +431,96 b' Check that it worked' | |||
|
431 | 431 | $ hg debug-repair-issue6528 |
|
432 | 432 | no affected revisions were found |
|
433 | 433 | $ hg st |
|
434 | ||
|
435 | $ cd .. | |
|
436 | ||
|
437 | Applying a bad bundle should fix it on the fly | |
|
438 | ---------------------------------------------- | |
|
439 | ||
|
440 | from a v1 bundle | |
|
441 | ~~~~~~~~~~~~~~~~ | |
|
442 | ||
|
443 | $ hg debugbundle --spec "$TESTDIR"/bundles/issue6528.hg-v1 | |
|
444 | bzip2-v1 | |
|
445 | ||
|
446 | $ hg init unbundle-v1 | |
|
447 | $ cd unbundle-v1 | |
|
448 | ||
|
449 | $ hg unbundle "$TESTDIR"/bundles/issue6528.hg-v1 | |
|
450 | adding changesets | |
|
451 | adding manifests | |
|
452 | adding file changes | |
|
453 | added 8 changesets with 12 changes to 4 files | |
|
454 | new changesets f5a5a568022f:3beabb508514 (8 drafts) | |
|
455 | (run 'hg update' to get a working copy) | |
|
456 | ||
|
457 | Check that revision were fixed on the fly | |
|
458 | ||
|
459 | $ hg debugrevlogindex b.txt | |
|
460 | rev linkrev nodeid p1 p2 | |
|
461 | 0 2 05b806ebe5ea 000000000000 000000000000 | |
|
462 | 1 3 a58b36ad6b65 000000000000 05b806ebe5ea | |
|
463 | 2 6 216a5fe8b8ed 000000000000 000000000000 | |
|
464 | 3 7 ea4f2f2463cc 000000000000 216a5fe8b8ed | |
|
465 | ||
|
466 | $ hg debugrevlogindex D.txt | |
|
467 | rev linkrev nodeid p1 p2 | |
|
468 | 0 6 2a8d3833f2fb 000000000000 000000000000 | |
|
469 | 1 7 2a80419dfc31 000000000000 2a8d3833f2fb | |
|
470 | ||
|
471 | That we don't see the symptoms of the bug | |
|
472 | ||
|
473 | $ hg up -- -1 | |
|
474 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
|
475 | $ hg status | |
|
476 | ||
|
477 | And that the repair command does not find anything to fix | |
|
478 | ||
|
479 | $ hg debug-repair-issue6528 | |
|
480 | no affected revisions were found | |
|
481 | ||
|
482 | $ cd .. | |
|
483 | ||
|
484 | from a v2 bundle | |
|
485 | ~~~~~~~~~~~~~~~~ | |
|
486 | ||
|
487 | $ hg debugbundle --spec "$TESTDIR"/bundles/issue6528.hg-v2 | |
|
488 | bzip2-v2 | |
|
489 | ||
|
490 | $ hg init unbundle-v2 | |
|
491 | $ cd unbundle-v2 | |
|
492 | ||
|
493 | $ hg unbundle "$TESTDIR"/bundles/issue6528.hg-v2 | |
|
494 | adding changesets | |
|
495 | adding manifests | |
|
496 | adding file changes | |
|
497 | added 8 changesets with 12 changes to 4 files | |
|
498 | new changesets f5a5a568022f:3beabb508514 (8 drafts) | |
|
499 | (run 'hg update' to get a working copy) | |
|
500 | ||
|
501 | Check that revision were fixed on the fly | |
|
502 | ||
|
503 | $ hg debugrevlogindex b.txt | |
|
504 | rev linkrev nodeid p1 p2 | |
|
505 | 0 2 05b806ebe5ea 000000000000 000000000000 | |
|
506 | 1 3 a58b36ad6b65 000000000000 05b806ebe5ea | |
|
507 | 2 6 216a5fe8b8ed 000000000000 000000000000 | |
|
508 | 3 7 ea4f2f2463cc 000000000000 216a5fe8b8ed | |
|
509 | ||
|
510 | $ hg debugrevlogindex D.txt | |
|
511 | rev linkrev nodeid p1 p2 | |
|
512 | 0 6 2a8d3833f2fb 000000000000 000000000000 | |
|
513 | 1 7 2a80419dfc31 000000000000 2a8d3833f2fb | |
|
514 | ||
|
515 | That we don't see the symptoms of the bug | |
|
516 | ||
|
517 | $ hg up -- -1 | |
|
518 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
|
519 | $ hg status | |
|
520 | ||
|
521 | And that the repair command does not find anything to fix | |
|
522 | ||
|
523 | $ hg debug-repair-issue6528 | |
|
524 | no affected revisions were found | |
|
525 | ||
|
526 | $ cd .. |
General Comments 0
You need to be logged in to leave comments.
Login now