Moved blocks and --no-moves
A block that moved shows as a deletion and an insertion in the diff. Rift also tells you it moved.
A dump written in a different order, or a function cut from one place and pasted into another, is a deletion at one end and an insertion at the other in any line-based diff. Rift keeps that output, because the diff must still apply with patch. It adds a list of the blocks that moved.
Where the list appears
--summaryand--statsprint it.- The terminal view marks both ends of a block, and
mjumps from one end to the other. - The unified diff does not change, byte for byte.
A block counts as moved when it has at least three lines and appears in both files at different positions. In the summary of the generated pair:
$ rift --summary a.sql b.sql a: 843633 lines, 67108879 bytes b: 845034 lines, 67182379 bytes stratum 0, 830263 anchors equal 436 segments, 835632 lines in a, 835632 in b differs 435 segments, 8001 lines in a, 9402 in b first differing ranges (0-based, end exclusive): a 381..383 b 381..382 a 1005..1011 b 1004..1010 a 1280..1281 b 1279..1281 a 8109..8119 b 8109..8110 a 9618..9619 b 9609..9618 a 11782..11783 b 11781..11790 a 17463..17784 b 17470..17471 a 21556..21560 b 21243..21244 a 22749..22750 b 22433..22437 a 25037..25048 b 24724..24725 ... and 425 more moved 62 blocks, 2737 lines a 21557..21560 b 22434..22437 a 25038..25048 b 26389..26399 a 27627..27952 b 28206..28531 a 36864..36874 b 36680..36690 a 48226..48235 b 49457..49466 a 50776..50780 b 50896..50900 a 59441..59445 b 61396..61400 a 65493..65499 b 65178..65184 a 99590..99595 b 99830..99835 a 110203..110209 b 111213..111219 ... and 52 more peak heap 78.6 MiB of 256.0 MiB (82397510 bytes) time 0.13 s
Each range is a start..end b start..end, counted from 0 with the end excluded.
What it misses
Detection starts from sampled lines, so it finds only the blocks that contain a sampled line. Some moves are missed. Do not use the list to prove that nothing else moved.
When the budget leaves no room for the search, the output says so.
Turn it off
--no-moves skips the search. The unified diff is the same. The summary, the stats and the terminal view say that detection was off:
$ rift --no-moves --summary a.sql b.sql | tail -n 6 a 22749..22750 b 22433..22437 a 25037..25048 b 24724..24725 ... and 425 more moved not searched, --no-moves peak heap 78.6 MiB of 256.0 MiB (82397510 bytes) time 0.17 s
--no-moves cannot be combined with --key: key mode ignores order and has no moves to find.