[PATCH 2 of 4] copies: replace _nonoverlap() by calls to manifestdict.filesnotin()
Martin von Zweigbergk
martinvonz at google.com
Fri Feb 27 22:46:50 UTC 2015
# HG changeset patch
# User Martin von Zweigbergk <martinvonz at google.com>
# Date 1425074550 28800
# Fri Feb 27 14:02:30 2015 -0800
# Node ID 89f810fb00184d3a1dd49412d0c3256a596ddca8
# Parent 53f0a056475d56b7b33f8f8b8b7ebadec047ca40
copies: replace _nonoverlap() by calls to manifestdict.filesnotin()
Now that we have manifestdict.filesnotin(), we can write _nonoverlap()
in terms of that method instead, enabling future speedups when
filesnotin() gets optimized, and perhaps making the code a little
clearer at the same time.
diff -r 53f0a056475d -r 89f810fb0018 mercurial/copies.py
--- a/mercurial/copies.py Fri Feb 27 13:57:37 2015 -0800
+++ b/mercurial/copies.py Fri Feb 27 14:02:30 2015 -0800
@@ -8,10 +8,6 @@
import util
import heapq
-def _nonoverlap(d1, d2, d3):
- "Return list of elements in d1 not in d2 or d3"
- return sorted([d for d in d1 if d not in d3 and d not in d2])
-
def _dirname(f):
s = f.rfind("/")
if s == -1:
@@ -218,8 +214,10 @@
This is its own function so extensions can easily wrap this call to see what
files mergecopies is about to process.
"""
- u1 = _nonoverlap(m1, m2, ma)
- u2 = _nonoverlap(m2, m1, ma)
+ addedinm1 = m1.filesnotin(ma)
+ addedinm2 = m2.filesnotin(ma)
+ u1 = sorted(addedinm1 - addedinm2)
+ u2 = sorted(addedinm2 - addedinm1)
if u1:
repo.ui.debug(" unmatched files in local:\n %s\n"
More information about the Mercurial-devel
mailing list