[PATCH 3 of 6 V2] similar: use common names for changectx variables
Yuya Nishihara
yuya at tcha.org
Thu Mar 23 10:13:45 EDT 2017
# HG changeset patch
# User Yuya Nishihara <yuya at tcha.org>
# Date 1490271045 -32400
# Thu Mar 23 21:10:45 2017 +0900
# Node ID f1b08899545270dea26ac954d21a02ebd5beb5f3
# Parent 8b33a51771425d2623aa37dbcff05cdb5cc8e2fa
similar: use common names for changectx variables
We generally use 'wctx' and 'pctx' for working context and its parent
respectively.
diff --git a/mercurial/similar.py b/mercurial/similar.py
--- a/mercurial/similar.py
+++ b/mercurial/similar.py
@@ -95,16 +95,16 @@ def _findsimilarmatches(repo, added, rem
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()
More information about the Mercurial-devel
mailing list