changeset 24185:3a3806fe3ddf

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.
author Martin von Zweigbergk <martinvonz@google.com>
date Fri, 27 Feb 2015 14:02:30 -0800
parents cd66080ef6d4
children 61aadba2396e
files mercurial/copies.py
diffstat 1 files changed, 4 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- 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"