##// END OF EJS Templates
cmdutil.py: use contexts in findrenames
Benoit Boissinot -
r3971:68a0fa81 default
parent child Browse files
Show More
@@ -146,13 +146,12 b' def walk(repo, pats=[], opts={}, node=No'
146 def findrenames(repo, added=None, removed=None, threshold=0.5):
146 def findrenames(repo, added=None, removed=None, threshold=0.5):
147 if added is None or removed is None:
147 if added is None or removed is None:
148 added, removed = repo.status()[1:3]
148 added, removed = repo.status()[1:3]
149 changes = repo.changelog.read(repo.dirstate.parents()[0])
149 ctx = repo.changectx()
150 mf = repo.manifest.read(changes[0])
151 for a in added:
150 for a in added:
152 aa = repo.wread(a)
151 aa = repo.wread(a)
153 bestscore, bestname = None, None
152 bestscore, bestname = None, None
154 for r in removed:
153 for r in removed:
155 rr = repo.file(r).read(mf[r])
154 rr = ctx.filectx(r).data()
156 delta = mdiff.textdiff(aa, rr)
155 delta = mdiff.textdiff(aa, rr)
157 if len(delta) < len(aa):
156 if len(delta) < len(aa):
158 myscore = 1.0 - (float(len(delta)) / len(aa))
157 myscore = 1.0 - (float(len(delta)) / len(aa))
General Comments 0
You need to be logged in to leave comments. Login now