Show More
@@ -1470,6 +1470,12 def debugfileset(ui, repo, expr, **opts) | |||
|
1470 | 1470 | _(b'repair revisions listed in this report file'), |
|
1471 | 1471 | _(b'FILE'), |
|
1472 | 1472 | ), |
|
1473 | ( | |
|
1474 | b'', | |
|
1475 | b'paranoid', | |
|
1476 | False, | |
|
1477 | _(b'check that both detection methods do the same thing'), | |
|
1478 | ), | |
|
1473 | 1479 | ] |
|
1474 | 1480 | + cmdutil.dryrunopts, |
|
1475 | 1481 | ) |
@@ -1491,6 +1497,11 def debug_repair_issue6528(ui, repo, **o | |||
|
1491 | 1497 | Note that this does *not* mean that this repairs future affected revisions, |
|
1492 | 1498 | that needs a separate fix at the exchange level that hasn't been written yet |
|
1493 | 1499 | (as of 5.9rc0). |
|
1500 | ||
|
1501 | There is a `--paranoid` flag to test that the fast implementation is correct | |
|
1502 | by checking it against the slow implementation. Since this matter is quite | |
|
1503 | urgent and testing every edge-case is probably quite costly, we use this | |
|
1504 | method to test on large repositories as a fuzzing method of sorts. | |
|
1494 | 1505 | """ |
|
1495 | 1506 | cmdutil.check_incompatible_arguments( |
|
1496 | 1507 | opts, 'to_report', ['from_report', 'dry_run'] |
@@ -1498,6 +1509,7 def debug_repair_issue6528(ui, repo, **o | |||
|
1498 | 1509 | dry_run = opts.get('dry_run') |
|
1499 | 1510 | to_report = opts.get('to_report') |
|
1500 | 1511 | from_report = opts.get('from_report') |
|
1512 | paranoid = opts.get('paranoid') | |
|
1501 | 1513 | # TODO maybe add filelog pattern and revision pattern parameters to help |
|
1502 | 1514 | # narrow down the search for users that know what they're looking for? |
|
1503 | 1515 | |
@@ -1506,7 +1518,12 def debug_repair_issue6528(ui, repo, **o | |||
|
1506 | 1518 | raise error.Abort(_(msg)) |
|
1507 | 1519 | |
|
1508 | 1520 | rewrite.repair_issue6528( |
|
1509 | ui, repo, dry_run=dry_run, to_report=to_report, from_report=from_report | |
|
1521 | ui, | |
|
1522 | repo, | |
|
1523 | dry_run=dry_run, | |
|
1524 | to_report=to_report, | |
|
1525 | from_report=from_report, | |
|
1526 | paranoid=paranoid, | |
|
1510 | 1527 | ) |
|
1511 | 1528 | |
|
1512 | 1529 |
@@ -672,7 +672,9 def _from_report(ui, repo, context, from | |||
|
672 | 672 | _reorder_filelog_parents(repo, fl, sorted(to_fix)) |
|
673 | 673 | |
|
674 | 674 | |
|
675 | def repair_issue6528(ui, repo, dry_run=False, to_report=None, from_report=None): | |
|
675 | def repair_issue6528( | |
|
676 | ui, repo, dry_run=False, to_report=None, from_report=None, paranoid=False | |
|
677 | ): | |
|
676 | 678 | from .. import store # avoid cycle |
|
677 | 679 | |
|
678 | 680 | @contextlib.contextmanager |
@@ -719,6 +721,12 def repair_issue6528(ui, repo, dry_run=F | |||
|
719 | 721 | affected = _is_revision_affected_fast( |
|
720 | 722 | repo, fl, filerev, metadata_cache |
|
721 | 723 | ) |
|
724 | if paranoid: | |
|
725 | slow = _is_revision_affected(fl, filerev) | |
|
726 | if slow != affected: | |
|
727 | msg = _(b"paranoid check failed for '%s' at node %s") | |
|
728 | node = binascii.hexlify(fl.node(filerev)) | |
|
729 | raise error.Abort(msg % (filename, node)) | |
|
722 | 730 | if affected: |
|
723 | 731 | msg = b"found affected revision %d for filelog '%s'\n" |
|
724 | 732 | ui.warn(msg % (filerev, path)) |
@@ -267,7 +267,7 Show all commands + options | |||
|
267 | 267 | config: untrusted, exp-all-known, edit, local, source, shared, non-shared, global, template |
|
268 | 268 | continue: dry-run |
|
269 | 269 | copy: forget, after, at-rev, force, include, exclude, dry-run |
|
270 | debug-repair-issue6528: to-report, from-report, dry-run | |
|
270 | debug-repair-issue6528: to-report, from-report, paranoid, dry-run | |
|
271 | 271 | debugancestor: |
|
272 | 272 | debugantivirusrunning: |
|
273 | 273 | debugapplystreamclonebundle: |
@@ -220,6 +220,25 Dry-run the fix | |||
|
220 | 220 | 0 6 2a8d3833f2fb 000000000000 000000000000 |
|
221 | 221 | 1 7 2a80419dfc31 2a8d3833f2fb 000000000000 |
|
222 | 222 | |
|
223 | Test the --paranoid option | |
|
224 | $ hg debug-repair-issue6528 --dry-run --paranoid | |
|
225 | found affected revision 1 for filelog 'data/D.txt.i' | |
|
226 | found affected revision 1 for filelog 'data/b.txt.i' | |
|
227 | found affected revision 3 for filelog 'data/b.txt.i' | |
|
228 | $ hg st | |
|
229 | M D.txt | |
|
230 | M b.txt | |
|
231 | $ hg debugrevlogindex b.txt | |
|
232 | rev linkrev nodeid p1 p2 | |
|
233 | 0 2 05b806ebe5ea 000000000000 000000000000 | |
|
234 | 1 3 a58b36ad6b65 05b806ebe5ea 000000000000 | |
|
235 | 2 6 216a5fe8b8ed 000000000000 000000000000 | |
|
236 | 3 7 ea4f2f2463cc 216a5fe8b8ed 000000000000 | |
|
237 | $ hg debugrevlogindex D.txt | |
|
238 | rev linkrev nodeid p1 p2 | |
|
239 | 0 6 2a8d3833f2fb 000000000000 000000000000 | |
|
240 | 1 7 2a80419dfc31 2a8d3833f2fb 000000000000 | |
|
241 | ||
|
223 | 242 | Run the fix |
|
224 | 243 | $ hg debug-repair-issue6528 |
|
225 | 244 | found affected revision 1 for filelog 'data/D.txt.i' |
General Comments 0
You need to be logged in to leave comments.
Login now