mercurial/similar.py
changeset 45942 89a2afe31e82
parent 43106 d783f945a701
child 46819 d4ba4d51f85f
equal deleted inserted replaced
45941:346af7687c6f 45942:89a2afe31e82
    13     pycompat,
    13     pycompat,
    14 )
    14 )
    15 
    15 
    16 
    16 
    17 def _findexactmatches(repo, added, removed):
    17 def _findexactmatches(repo, added, removed):
    18     '''find renamed files that have no changes
    18     """find renamed files that have no changes
    19 
    19 
    20     Takes a list of new filectxs and a list of removed filectxs, and yields
    20     Takes a list of new filectxs and a list of removed filectxs, and yields
    21     (before, after) tuples of exact matches.
    21     (before, after) tuples of exact matches.
    22     '''
    22     """
    23     # Build table of removed files: {hash(fctx.data()): [fctx, ...]}.
    23     # Build table of removed files: {hash(fctx.data()): [fctx, ...]}.
    24     # We use hash() to discard fctx.data() from memory.
    24     # We use hash() to discard fctx.data() from memory.
    25     hashes = {}
    25     hashes = {}
    26     progress = repo.ui.makeprogress(
    26     progress = repo.ui.makeprogress(
    27         _(b'searching for exact renames'),
    27         _(b'searching for exact renames'),
    75 def score(fctx1, fctx2):
    75 def score(fctx1, fctx2):
    76     return _score(fctx1, _ctxdata(fctx2))
    76     return _score(fctx1, _ctxdata(fctx2))
    77 
    77 
    78 
    78 
    79 def _findsimilarmatches(repo, added, removed, threshold):
    79 def _findsimilarmatches(repo, added, removed, threshold):
    80     '''find potentially renamed files based on similar file content
    80     """find potentially renamed files based on similar file content
    81 
    81 
    82     Takes a list of new filectxs and a list of removed filectxs, and yields
    82     Takes a list of new filectxs and a list of removed filectxs, and yields
    83     (before, after, score) tuples of partial matches.
    83     (before, after, score) tuples of partial matches.
    84     '''
    84     """
    85     copies = {}
    85     copies = {}
    86     progress = repo.ui.makeprogress(
    86     progress = repo.ui.makeprogress(
    87         _(b'searching for similar files'), unit=_(b'files'), total=len(removed)
    87         _(b'searching for similar files'), unit=_(b'files'), total=len(removed)
    88     )
    88     )
    89     for r in removed:
    89     for r in removed: