Mercurial > public > mercurial-scm > hg
comparison mercurial/cmdutil.py @ 9927:2ae4d0865629
findrenames: speedup exact match
benchmarked on crew repo with:
rm -rf * ; hg up -C ; for i in `find . -name "*.py"` ; do mv $i $i.new;done
followed by:
hg addremove -s 100
before: Time: real 28.890 secs (user 26.920+0.000 sys 1.450+0.000)
after : Time: real 6.790 secs (user 5.310+0.000 sys 1.350+0.000)
author | Benoit Boissinot <benoit.boissinot@ens-lyon.org> |
---|---|
date | Tue, 24 Nov 2009 18:21:47 +0100 |
parents | 4b044b81cb54 |
children | a92539567ef3 |
comparison
equal
deleted
inserted
replaced
9926:4b044b81cb54 | 9927:2ae4d0865629 |
---|---|
274 ctx = repo['.'] | 274 ctx = repo['.'] |
275 for r in removed: | 275 for r in removed: |
276 if r not in ctx: | 276 if r not in ctx: |
277 continue | 277 continue |
278 fctx = ctx.filectx(r) | 278 fctx = ctx.filectx(r) |
279 orig = fctx.data() | |
280 | 279 |
281 def score(text): | 280 def score(text): |
282 if not len(text): | 281 if not len(text): |
283 return 0.0 | 282 return 0.0 |
283 if not fctx.cmp(text): | |
284 return 1.0 | |
285 if threshold == 1.0: | |
286 return 0.0 | |
287 orig = fctx.data() | |
284 # bdiff.blocks() returns blocks of matching lines | 288 # bdiff.blocks() returns blocks of matching lines |
285 # count the number of bytes in each | 289 # count the number of bytes in each |
286 equal = 0 | 290 equal = 0 |
287 alines = mdiff.splitnewlines(text) | 291 alines = mdiff.splitnewlines(text) |
288 matches = bdiff.blocks(text, orig) | 292 matches = bdiff.blocks(text, orig) |