comparison mercurial/copies.py @ 41932:7694b685bb10

copies: handle a case when both merging csets are not descendant of merge base This patch fix the behaviour of fullcopytracing algorithm in the case when both the merging csets are not the descendant of merge base. Although it seems to be the rare case when both the csets are not descendant of merge base. But it can be seen in most of cases of content-divergence in evolve extension, where merge base is the common predecessor. Previous patch added a test where this algorithm can fail to continue because of an assumption that only one of the two csets can be dirty. This patch fix that error. For refrence I suggest you to look into the previous discussion held on a patch sent by Pulkit: https://phab.mercurial-scm.org/D3896 Differential Revision: https://phab.mercurial-scm.org/D5963
author Sushil khanchi <sushilkhanchi97@gmail.com>
date Wed, 13 Feb 2019 15:50:14 +0530
parents 49ad315b39ee
children a791623458ef
comparison
equal deleted inserted replaced
41931:fc4b7a46fda1 41932:7694b685bb10
606 fullcopy.update(data2['fullcopy']) 606 fullcopy.update(data2['fullcopy'])
607 607
608 if dirtyc1: 608 if dirtyc1:
609 _combinecopies(data2['incomplete'], data1['incomplete'], copy, diverge, 609 _combinecopies(data2['incomplete'], data1['incomplete'], copy, diverge,
610 incompletediverge) 610 incompletediverge)
611 else: 611 if dirtyc2:
612 _combinecopies(data1['incomplete'], data2['incomplete'], copy, diverge, 612 _combinecopies(data1['incomplete'], data2['incomplete'], copy, diverge,
613 incompletediverge) 613 incompletediverge)
614 614
615 renamedelete = {} 615 renamedelete = {}
616 renamedeleteset = set() 616 renamedeleteset = set()
645 'incompletediverge': bothincompletediverge 645 'incompletediverge': bothincompletediverge
646 } 646 }
647 for f in bothnew: 647 for f in bothnew:
648 _checkcopies(c1, c2, f, base, tca, dirtyc1, limit, both1) 648 _checkcopies(c1, c2, f, base, tca, dirtyc1, limit, both1)
649 _checkcopies(c2, c1, f, base, tca, dirtyc2, limit, both2) 649 _checkcopies(c2, c1, f, base, tca, dirtyc2, limit, both2)
650 if dirtyc1: 650 if dirtyc1 and dirtyc2:
651 remainder = _combinecopies(both2['incomplete'], both1['incomplete'],
652 copy, bothdiverge, bothincompletediverge)
653 remainder1 = _combinecopies(both1['incomplete'], both2['incomplete'],
654 copy, bothdiverge, bothincompletediverge)
655 remainder.update(remainder1)
656 elif dirtyc1:
651 # incomplete copies may only be found on the "dirty" side for bothnew 657 # incomplete copies may only be found on the "dirty" side for bothnew
652 assert not both2['incomplete'] 658 assert not both2['incomplete']
653 remainder = _combinecopies({}, both1['incomplete'], copy, bothdiverge, 659 remainder = _combinecopies({}, both1['incomplete'], copy, bothdiverge,
654 bothincompletediverge) 660 bothincompletediverge)
655 elif dirtyc2: 661 elif dirtyc2: