Mercurial > hg
changeset 31581:b1528d195a13
similar: use common names for changectx variables
We generally use 'wctx' and 'pctx' for working context and its parent
respectively.
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Thu, 23 Mar 2017 21:10:45 +0900 |
parents | d3e2af4e0128 |
children | 2e254165a37c |
files | mercurial/similar.py |
diffstat | 1 files changed, 6 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/similar.py Thu Mar 23 20:50:33 2017 +0900 +++ b/mercurial/similar.py Thu Mar 23 21:10:45 2017 +0900 @@ -95,16 +95,16 @@ def findrenames(repo, added, removed, threshold): '''find renamed files -- yields (before, after, score) tuples''' - parentctx = repo['.'] - workingctx = repo[None] + wctx = repo[None] + pctx = wctx.p1() # Zero length files will be frequently unrelated to each other, and # tracking the deletion/addition of such a file will probably cause more # harm than good. We strip them out here to avoid matching them later on. - addedfiles = [workingctx[fp] for fp in sorted(added) - if workingctx[fp].size() > 0] - removedfiles = [parentctx[fp] for fp in sorted(removed) - if fp in parentctx and parentctx[fp].size() > 0] + addedfiles = [wctx[fp] for fp in sorted(added) + if wctx[fp].size() > 0] + removedfiles = [pctx[fp] for fp in sorted(removed) + if fp in pctx and pctx[fp].size() > 0] # Find exact matches. matchedfiles = set()