mercurial/similar.py
changeset 31579 3a383caa97f4
parent 31210 e1d035905b2e
child 31580 d3e2af4e0128
equal deleted inserted replaced
31578:6262e30b0c09 31579:3a383caa97f4
    99     workingctx = repo[None]
    99     workingctx = repo[None]
   100 
   100 
   101     # Zero length files will be frequently unrelated to each other, and
   101     # Zero length files will be frequently unrelated to each other, and
   102     # tracking the deletion/addition of such a file will probably cause more
   102     # tracking the deletion/addition of such a file will probably cause more
   103     # harm than good. We strip them out here to avoid matching them later on.
   103     # harm than good. We strip them out here to avoid matching them later on.
   104     addedfiles = set([workingctx[fp] for fp in added
   104     addedfiles = [workingctx[fp] for fp in sorted(added)
   105             if workingctx[fp].size() > 0])
   105                   if workingctx[fp].size() > 0]
   106     removedfiles = set([parentctx[fp] for fp in removed
   106     removedfiles = [parentctx[fp] for fp in sorted(removed)
   107             if fp in parentctx and parentctx[fp].size() > 0])
   107                     if fp in parentctx and parentctx[fp].size() > 0]
   108 
   108 
   109     # Find exact matches.
   109     # Find exact matches.
   110     for (a, b) in _findexactmatches(repo,
   110     for (a, b) in _findexactmatches(repo, addedfiles[:], removedfiles):
   111             sorted(addedfiles), sorted(removedfiles)):
       
   112         addedfiles.remove(b)
   111         addedfiles.remove(b)
   113         yield (a.path(), b.path(), 1.0)
   112         yield (a.path(), b.path(), 1.0)
   114 
   113 
   115     # If the user requested similar files to be matched, search for them also.
   114     # If the user requested similar files to be matched, search for them also.
   116     if threshold < 1.0:
   115     if threshold < 1.0:
   117         for (a, b, score) in _findsimilarmatches(repo,
   116         for (a, b, score) in _findsimilarmatches(repo, addedfiles,
   118                 sorted(addedfiles), sorted(removedfiles), threshold):
   117                                                  removedfiles, threshold):
   119             yield (a.path(), b.path(), score)
   118             yield (a.path(), b.path(), score)