Mercurial > hg
comparison mercurial/copies.py @ 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 |
comparison
equal
deleted
inserted
replaced
24184:cd66080ef6d4 | 24185:3a3806fe3ddf |
---|---|
5 # This software may be used and distributed according to the terms of the | 5 # This software may be used and distributed according to the terms of the |
6 # GNU General Public License version 2 or any later version. | 6 # GNU General Public License version 2 or any later version. |
7 | 7 |
8 import util | 8 import util |
9 import heapq | 9 import heapq |
10 | |
11 def _nonoverlap(d1, d2, d3): | |
12 "Return list of elements in d1 not in d2 or d3" | |
13 return sorted([d for d in d1 if d not in d3 and d not in d2]) | |
14 | 10 |
15 def _dirname(f): | 11 def _dirname(f): |
16 s = f.rfind("/") | 12 s = f.rfind("/") |
17 if s == -1: | 13 if s == -1: |
18 return "" | 14 return "" |
216 def _computenonoverlap(repo, m1, m2, ma): | 212 def _computenonoverlap(repo, m1, m2, ma): |
217 """Computes the files exclusive to m1 and m2. | 213 """Computes the files exclusive to m1 and m2. |
218 This is its own function so extensions can easily wrap this call to see what | 214 This is its own function so extensions can easily wrap this call to see what |
219 files mergecopies is about to process. | 215 files mergecopies is about to process. |
220 """ | 216 """ |
221 u1 = _nonoverlap(m1, m2, ma) | 217 addedinm1 = m1.filesnotin(ma) |
222 u2 = _nonoverlap(m2, m1, ma) | 218 addedinm2 = m2.filesnotin(ma) |
219 u1 = sorted(addedinm1 - addedinm2) | |
220 u2 = sorted(addedinm2 - addedinm1) | |
223 | 221 |
224 if u1: | 222 if u1: |
225 repo.ui.debug(" unmatched files in local:\n %s\n" | 223 repo.ui.debug(" unmatched files in local:\n %s\n" |
226 % "\n ".join(u1)) | 224 % "\n ".join(u1)) |
227 if u2: | 225 if u2: |