Show More
@@ -58,7 +58,6 b' from . import (' | |||||
58 | localrepo, |
|
58 | localrepo, | |
59 | lock as lockmod, |
|
59 | lock as lockmod, | |
60 | logcmdutil, |
|
60 | logcmdutil, | |
61 | mdiff, |
|
|||
62 | mergestate as mergestatemod, |
|
61 | mergestate as mergestatemod, | |
63 | metadata, |
|
62 | metadata, | |
64 | obsolete, |
|
63 | obsolete, | |
@@ -73,7 +72,6 b' from . import (' | |||||
73 | repoview, |
|
72 | repoview, | |
74 | requirements, |
|
73 | requirements, | |
75 | revlog, |
|
74 | revlog, | |
76 | revlogutils, |
|
|||
77 | revset, |
|
75 | revset, | |
78 | revsetlang, |
|
76 | revsetlang, | |
79 | scmutil, |
|
77 | scmutil, | |
@@ -1029,54 +1027,22 b' def debugdeltafind(ui, repo, arg_1, arg_' | |||||
1029 | rev = int(rev) |
|
1027 | rev = int(rev) | |
1030 |
|
1028 | |||
1031 | revlog = cmdutil.openrevlog(repo, b'debugdeltachain', file_, opts) |
|
1029 | revlog = cmdutil.openrevlog(repo, b'debugdeltachain', file_, opts) | |
1032 |
|
||||
1033 | deltacomputer = deltautil.deltacomputer( |
|
|||
1034 | revlog, |
|
|||
1035 | write_debug=ui.write, |
|
|||
1036 | debug_search=not ui.quiet, |
|
|||
1037 | ) |
|
|||
1038 |
|
||||
1039 | node = revlog.node(rev) |
|
|||
1040 | p1r, p2r = revlog.parentrevs(rev) |
|
1030 | p1r, p2r = revlog.parentrevs(rev) | |
1041 | p1 = revlog.node(p1r) |
|
1031 | ||
1042 | p2 = revlog.node(p2r) |
|
1032 | if source == b'full': | |
1043 | full_text = revlog.revision(rev) |
|
1033 | base_rev = nullrev | |
1044 | btext = [full_text] |
|
1034 | elif source == b'storage': | |
1045 | textlen = len(btext[0]) |
|
1035 | base_rev = revlog.deltaparent(rev) | |
1046 | cachedelta = None |
|
1036 | elif source == b'p1': | |
1047 | flags = revlog.flags(rev) |
|
1037 | base_rev = p1r | |
1048 |
|
1038 | elif source == b'p2': | ||
1049 | if source != b'full': |
|
1039 | base_rev = p2r | |
1050 |
|
|
1040 | elif source == b'prev': | |
1051 |
|
|
1041 | base_rev = rev - 1 | |
1052 | elif source == b'p1': |
|
1042 | else: | |
1053 | base_rev = p1r |
|
1043 | raise error.InputError(b"invalid --source value: %s" % source) | |
1054 | elif source == b'p2': |
|
1044 | ||
1055 | base_rev = p2r |
|
1045 | revlog_debug.debug_delta_find(ui, revlog, rev, base_rev=base_rev) | |
1056 | elif source == b'prev': |
|
|||
1057 | base_rev = rev - 1 |
|
|||
1058 | else: |
|
|||
1059 | raise error.InputError(b"invalid --source value: %s" % source) |
|
|||
1060 |
|
||||
1061 | if base_rev != nullrev: |
|
|||
1062 | base_text = revlog.revision(base_rev) |
|
|||
1063 | delta = mdiff.textdiff(base_text, full_text) |
|
|||
1064 |
|
||||
1065 | cachedelta = (base_rev, delta) |
|
|||
1066 | btext = [None] |
|
|||
1067 |
|
||||
1068 | revinfo = revlogutils.revisioninfo( |
|
|||
1069 | node, |
|
|||
1070 | p1, |
|
|||
1071 | p2, |
|
|||
1072 | btext, |
|
|||
1073 | textlen, |
|
|||
1074 | cachedelta, |
|
|||
1075 | flags, |
|
|||
1076 | ) |
|
|||
1077 |
|
||||
1078 | fh = revlog._datafp() |
|
|||
1079 | deltacomputer.finddeltainfo(revinfo, fh, target_rev=rev) |
|
|||
1080 |
|
1046 | |||
1081 |
|
1047 | |||
1082 | @command( |
|
1048 | @command( |
@@ -10,12 +10,15 b' import collections' | |||||
10 | import string |
|
10 | import string | |
11 |
|
11 | |||
12 | from .. import ( |
|
12 | from .. import ( | |
|
13 | mdiff, | |||
13 | node as nodemod, |
|
14 | node as nodemod, | |
|
15 | revlogutils, | |||
14 | util, |
|
16 | util, | |
15 | ) |
|
17 | ) | |
16 |
|
18 | |||
17 | from . import ( |
|
19 | from . import ( | |
18 | constants, |
|
20 | constants, | |
|
21 | deltas as deltautil, | |||
19 | ) |
|
22 | ) | |
20 |
|
23 | |||
21 | INDEX_ENTRY_DEBUG_COLUMN = [] |
|
24 | INDEX_ENTRY_DEBUG_COLUMN = [] | |
@@ -619,3 +622,42 b' def debug_revlog(ui, revlog):' | |||||
619 | b'deltas against other : ' |
|
622 | b'deltas against other : ' | |
620 | + fmt % pcfmt(numother_nad, numdeltas) |
|
623 | + fmt % pcfmt(numother_nad, numdeltas) | |
621 | ) |
|
624 | ) | |
|
625 | ||||
|
626 | ||||
|
627 | def debug_delta_find(ui, revlog, rev, base_rev=nodemod.nullrev): | |||
|
628 | """display the search process for a delta""" | |||
|
629 | deltacomputer = deltautil.deltacomputer( | |||
|
630 | revlog, | |||
|
631 | write_debug=ui.write, | |||
|
632 | debug_search=not ui.quiet, | |||
|
633 | ) | |||
|
634 | ||||
|
635 | node = revlog.node(rev) | |||
|
636 | p1r, p2r = revlog.parentrevs(rev) | |||
|
637 | p1 = revlog.node(p1r) | |||
|
638 | p2 = revlog.node(p2r) | |||
|
639 | full_text = revlog.revision(rev) | |||
|
640 | btext = [full_text] | |||
|
641 | textlen = len(btext[0]) | |||
|
642 | cachedelta = None | |||
|
643 | flags = revlog.flags(rev) | |||
|
644 | ||||
|
645 | if base_rev != nodemod.nullrev: | |||
|
646 | base_text = revlog.revision(base_rev) | |||
|
647 | delta = mdiff.textdiff(base_text, full_text) | |||
|
648 | ||||
|
649 | cachedelta = (base_rev, delta) | |||
|
650 | btext = [None] | |||
|
651 | ||||
|
652 | revinfo = revlogutils.revisioninfo( | |||
|
653 | node, | |||
|
654 | p1, | |||
|
655 | p2, | |||
|
656 | btext, | |||
|
657 | textlen, | |||
|
658 | cachedelta, | |||
|
659 | flags, | |||
|
660 | ) | |||
|
661 | ||||
|
662 | fh = revlog._datafp() | |||
|
663 | deltacomputer.finddeltainfo(revinfo, fh, target_rev=rev) |
General Comments 0
You need to be logged in to leave comments.
Login now