Show More
@@ -270,15 +270,16 b' def matchfiles(repo, files):' | |||
|
270 | 270 | |
|
271 | 271 | def findrenames(repo, added, removed, threshold): |
|
272 | 272 | '''find renamed files -- yields (before, after, score) tuples''' |
|
273 | copies = {} | |
|
273 | 274 | ctx = repo['.'] |
|
274 |
for |
|
|
275 | aa = repo.wread(a) | |
|
276 | bestname, bestscore = None, threshold | |
|
277 | for r in removed: | |
|
278 | if r not in ctx: | |
|
279 | continue | |
|
280 | rr = ctx.filectx(r).data() | |
|
281 | ||
|
275 | for r in removed: | |
|
276 | if r not in ctx: | |
|
277 | continue | |
|
278 | fctx = ctx.filectx(r) | |
|
279 | rr = fctx.data() | |
|
280 | for a in added: | |
|
281 | bestscore = copies.get(a, (None, threshold))[1] | |
|
282 | aa = repo.wread(a) | |
|
282 | 283 | # bdiff.blocks() returns blocks of matching lines |
|
283 | 284 | # count the number of bytes in each |
|
284 | 285 | equal = 0 |
@@ -292,9 +293,10 b' def findrenames(repo, added, removed, th' | |||
|
292 | 293 | if lengths: |
|
293 | 294 | myscore = equal*2.0 / lengths |
|
294 | 295 | if myscore >= bestscore: |
|
295 |
|
|
|
296 | if bestname: | |
|
297 | yield bestname, a, bestscore | |
|
296 | copies[a] = (r, myscore) | |
|
297 | for dest, v in copies.iteritems(): | |
|
298 | source, score = v | |
|
299 | yield source, dest, score | |
|
298 | 300 | |
|
299 | 301 | def addremove(repo, pats=[], opts={}, dry_run=None, similarity=None): |
|
300 | 302 | if dry_run is None: |
General Comments 0
You need to be logged in to leave comments.
Login now