comparison mercurial/copies.py @ 30193:368e27eb1ffa

copies: detect graft-like merges Right now, nothing changes as a result of this, but we want to handle grafts differently from ordinary merges later. (Series developed together with Pierre-Yves David)
author Gábor Stefanik <gabor.stefanik@nng.com>
date Thu, 13 Oct 2016 01:47:33 +0200
parents 8a864844d5a0
children 8c69c52ced98
comparison
equal deleted inserted replaced
30192:509d29255c04 30193:368e27eb1ffa
319 # because the logic above is required for a simple copy to be kept across a 319 # because the logic above is required for a simple copy to be kept across a
320 # rebase. 320 # rebase.
321 if repo.ui.configbool('experimental', 'disablecopytrace'): 321 if repo.ui.configbool('experimental', 'disablecopytrace'):
322 return {}, {}, {}, {} 322 return {}, {}, {}, {}
323 323
324 # In certain scenarios (e.g. graft, update or rebase), base can be
325 # overridden We still need to know a real common ancestor in this case We
326 # can't just compute _c1.ancestor(_c2) and compare it to ca, because there
327 # can be multiple common ancestors, e.g. in case of bidmerge. Because our
328 # caller may not know if the revision passed in lieu of the CA is a genuine
329 # common ancestor or not without explicitly checking it, it's better to
330 # determine that here.
331 #
332 # base.descendant(wc) and base.descendant(base) are False, work around that
333 _c1 = c1.p1() if c1.rev() is None else c1
334 _c2 = c2.p1() if c2.rev() is None else c2
335 # an endpoint is "dirty" if it isn't a descendant of the merge base
336 # if we have a dirty endpoint, we need to trigger graft logic, and also
337 # keep track of which endpoint is dirty
338 dirtyc1 = not (base == _c1 or base.descendant(_c1))
339 dirtyc2 = not (base== _c2 or base.descendant(_c2))
340 graft = dirtyc1 or dirtyc2
324 limit = _findlimit(repo, c1.rev(), c2.rev()) 341 limit = _findlimit(repo, c1.rev(), c2.rev())
325 if limit is None: 342 if limit is None:
326 # no common ancestor, no copies 343 # no common ancestor, no copies
327 return {}, {}, {}, {} 344 return {}, {}, {}, {}
328 repo.ui.debug(" searching for copies back to rev %d\n" % limit) 345 repo.ui.debug(" searching for copies back to rev %d\n" % limit)