##// END OF EJS Templates
copies: inline _chainandfilter() to prepare for next patch...
Martin von Zweigbergk -
r42796:11ceb1b8 default
parent child Browse files
Show More
@@ -107,13 +107,13 b' def _findlimit(repo, ctxa, ctxb):'
107 # This only occurs when a is a descendent of b or visa-versa.
107 # This only occurs when a is a descendent of b or visa-versa.
108 return min(limit, a, b)
108 return min(limit, a, b)
109
109
110 def _chainandfilter(src, dst, a, b):
110 def _filter(src, dst, t):
111 """chain two sets of copies 'a' and 'b' and filter result"""
111 """filters out invalid copies after chaining"""
112
112
113 # When chaining copies in 'a' (from 'src' via some other commit 'mid') with
113 # When _chain()'ing copies in 'a' (from 'src' via some other commit 'mid')
114 # copies in 'b' (from 'mid' to 'dst'), we can get the different cases in the
114 # with copies in 'b' (from 'mid' to 'dst'), we can get the different cases
115 # following table (not including trivial cases). For example, case 2 is
115 # in the following table (not including trivial cases). For example, case 2
116 # where a file existed in 'src' and remained under that name in 'mid' and
116 # is where a file existed in 'src' and remained under that name in 'mid' and
117 # then was renamed between 'mid' and 'dst'.
117 # then was renamed between 'mid' and 'dst'.
118 #
118 #
119 # case src mid dst result
119 # case src mid dst result
@@ -129,12 +129,6 b' def _chainandfilter(src, dst, a, b):'
129 # between 5 and 6, so it includes all cases in its result.
129 # between 5 and 6, so it includes all cases in its result.
130 # Cases 1, 3, and 5 are then removed by _filter().
130 # Cases 1, 3, and 5 are then removed by _filter().
131
131
132 t = _chain(a, b)
133 _filter(src, dst, t)
134 return t
135
136 def _filter(src, dst, t):
137 """filters out invalid copies after chaining"""
138 for k, v in list(t.items()):
132 for k, v in list(t.items()):
139 # remove copies from files that didn't exist
133 # remove copies from files that didn't exist
140 if v not in src:
134 if v not in src:
@@ -326,7 +320,8 b' def _forwardcopies(a, b, match=None):'
326 if b.rev() is None:
320 if b.rev() is None:
327 cm = _committedforwardcopies(a, b.p1(), match)
321 cm = _committedforwardcopies(a, b.p1(), match)
328 # combine copies from dirstate if necessary
322 # combine copies from dirstate if necessary
329 copies = _chainandfilter(a, b, cm, _dirstatecopies(b._repo, match))
323 copies = _chain(cm, _dirstatecopies(b._repo, match))
324 _filter(a, b, copies)
330 else:
325 else:
331 copies = _committedforwardcopies(a, b, match)
326 copies = _committedforwardcopies(a, b, match)
332 return copies
327 return copies
@@ -376,8 +371,9 b' def pathcopies(x, y, match=None):'
376 else:
371 else:
377 if debug:
372 if debug:
378 repo.ui.debug('debug.copies: search mode: combined\n')
373 repo.ui.debug('debug.copies: search mode: combined\n')
379 copies = _chainandfilter(x, y, _backwardrenames(x, a, match=match),
374 copies = _chain(_backwardrenames(x, a, match=match),
380 _forwardcopies(a, y, match=match))
375 _forwardcopies(a, y, match=match))
376 _filter(x, y, copies)
381 return copies
377 return copies
382
378
383 def mergecopies(repo, c1, c2, base):
379 def mergecopies(repo, c1, c2, base):
General Comments 0
You need to be logged in to leave comments. Login now