equal
deleted
inserted
replaced
7 |
7 |
8 from __future__ import absolute_import |
8 from __future__ import absolute_import |
9 |
9 |
10 from .i18n import _ |
10 from .i18n import _ |
11 from . import ( |
11 from . import ( |
12 bdiff, |
|
13 mdiff, |
12 mdiff, |
14 ) |
13 ) |
15 |
14 |
16 def _findexactmatches(repo, added, removed): |
15 def _findexactmatches(repo, added, removed): |
17 '''find renamed files that have no changes |
16 '''find renamed files that have no changes |
54 return orig, mdiff.splitnewlines(orig) |
53 return orig, mdiff.splitnewlines(orig) |
55 |
54 |
56 def _score(fctx, otherdata): |
55 def _score(fctx, otherdata): |
57 orig, lines = otherdata |
56 orig, lines = otherdata |
58 text = fctx.data() |
57 text = fctx.data() |
59 # bdiff.blocks() returns blocks of matching lines |
58 # mdiff.blocks() returns blocks of matching lines |
60 # count the number of bytes in each |
59 # count the number of bytes in each |
61 equal = 0 |
60 equal = 0 |
62 matches = bdiff.blocks(text, orig) |
61 matches = mdiff.blocks(text, orig) |
63 for x1, x2, y1, y2 in matches: |
62 for x1, x2, y1, y2 in matches: |
64 for line in lines[y1:y2]: |
63 for line in lines[y1:y2]: |
65 equal += len(line) |
64 equal += len(line) |
66 |
65 |
67 lengths = len(text) + len(orig) |
66 lengths = len(text) + len(orig) |