# HG changeset patch # User Martin von Zweigbergk # Date 2015-02-27 22:26:22 # Node ID 30219bd46ed738b4d689f6d73f1467bf7da40009 # Parent 61aadba2396e07b3a6f2b19a65d4d4f0b8a0024f copies: only calculate 'addedinm[12]' sets once Pass the addedinm1 and addedinm2 instead of m1, m2, ma into _computenonoverlap() instead of calculating the sets twice. diff --git a/mercurial/copies.py b/mercurial/copies.py --- a/mercurial/copies.py +++ b/mercurial/copies.py @@ -209,13 +209,11 @@ def pathcopies(x, y): return _backwardrenames(x, y) return _chain(x, y, _backwardrenames(x, a), _forwardcopies(a, y)) -def _computenonoverlap(repo, m1, m2, ma): - """Computes the files exclusive to m1 and m2. - This is its own function so extensions can easily wrap this call to see what - files mergecopies is about to process. +def _computenonoverlap(repo, addedinm1, addedinm2): + """Computes, based on addedinm1 and addedinm2, the files exclusive to m1 + and m2. This is its own function so extensions can easily wrap this call + to see what files mergecopies is about to process. """ - addedinm1 = m1.filesnotin(ma) - addedinm2 = m2.filesnotin(ma) u1 = sorted(addedinm1 - addedinm2) u2 = sorted(addedinm2 - addedinm1) @@ -280,7 +278,9 @@ def mergecopies(repo, c1, c2, ca): repo.ui.debug(" searching for copies back to rev %d\n" % limit) - u1, u2 = _computenonoverlap(repo, m1, m2, ma) + addedinm1 = m1.filesnotin(ma) + addedinm2 = m2.filesnotin(ma) + u1, u2 = _computenonoverlap(repo, addedinm1, addedinm2) for f in u1: checkcopies(ctx, f, m1, m2, ca, limit, diverge, copy, fullcopy) @@ -302,8 +302,6 @@ def mergecopies(repo, c1, c2, ca): else: diverge2.update(fl) # reverse map for below - addedinm1 = m1.filesnotin(ma) - addedinm2 = m2.filesnotin(ma) bothnew = sorted(addedinm1 & addedinm2) if bothnew: repo.ui.debug(" unmatched files new in both:\n %s\n"