##// END OF EJS Templates
copies: make _backwardrenames() filter out copies by destination...
Martin von Zweigbergk -
r41903:3f94deee default draft
parent child Browse files
Show More
@@ -228,16 +228,21 b' def _forwardcopies(a, b, match=None):'
228 return _chain(a, b, cm, _dirstatecopies(b._repo, match))
228 return _chain(a, b, cm, _dirstatecopies(b._repo, match))
229 return _committedforwardcopies(a, b, match)
229 return _committedforwardcopies(a, b, match)
230
230
231 def _backwardrenames(a, b):
231 def _backwardrenames(a, b, match):
232 if a._repo.ui.config('experimental', 'copytrace') == 'off':
232 if a._repo.ui.config('experimental', 'copytrace') == 'off':
233 return {}
233 return {}
234
234
235 # Even though we're not taking copies into account, 1:n rename situations
235 # Even though we're not taking copies into account, 1:n rename situations
236 # can still exist (e.g. hg cp a b; hg mv a c). In those cases we
236 # can still exist (e.g. hg cp a b; hg mv a c). In those cases we
237 # arbitrarily pick one of the renames.
237 # arbitrarily pick one of the renames.
238 # We don't want to pass in "match" here, since that would filter
239 # the destination by it. Since we're reversing the copies, we want
240 # to filter the source instead.
238 f = _forwardcopies(b, a)
241 f = _forwardcopies(b, a)
239 r = {}
242 r = {}
240 for k, v in sorted(f.iteritems()):
243 for k, v in sorted(f.iteritems()):
244 if match and not match(v):
245 continue
241 # remove copies
246 # remove copies
242 if v in a:
247 if v in a:
243 continue
248 continue
@@ -261,10 +266,10 b' def pathcopies(x, y, match=None):'
261 if a == y:
266 if a == y:
262 if debug:
267 if debug:
263 repo.ui.debug('debug.copies: search mode: backward\n')
268 repo.ui.debug('debug.copies: search mode: backward\n')
264 return _backwardrenames(x, y)
269 return _backwardrenames(x, y, match=match)
265 if debug:
270 if debug:
266 repo.ui.debug('debug.copies: search mode: combined\n')
271 repo.ui.debug('debug.copies: search mode: combined\n')
267 return _chain(x, y, _backwardrenames(x, a),
272 return _chain(x, y, _backwardrenames(x, a, match=match),
268 _forwardcopies(a, y, match=match))
273 _forwardcopies(a, y, match=match))
269
274
270 def _computenonoverlap(repo, c1, c2, addedinm1, addedinm2, baselabel=''):
275 def _computenonoverlap(repo, c1, c2, addedinm1, addedinm2, baselabel=''):
@@ -33,9 +33,7 b' Test filtering copies by path. We do fil'
33 y -> x
33 y -> x
34 $ hg debugpathcopies 0 1 y
34 $ hg debugpathcopies 0 1 y
35 x -> y
35 x -> y
36 BROKEN: the following command should not include the copy
37 $ hg debugpathcopies 1 0 y
36 $ hg debugpathcopies 1 0 y
38 y -> x
39
37
40 Copy a file onto another file
38 Copy a file onto another file
41 $ newrepo
39 $ newrepo
General Comments 0
You need to be logged in to leave comments. Login now