~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/merge.py

Merge bzr.dev to resolve news conflict

Show diffs side-by-side

added added

removed removed

Lines of Context:
582
582
            elif len(lcas) == 1:
583
583
                self.base_rev_id = list(lcas)[0]
584
584
            else: # len(lcas) > 1
 
585
                self._is_criss_cross = True
585
586
                if len(lcas) > 2:
586
587
                    # find_unique_lca can only handle 2 nodes, so we have to
587
588
                    # start back at the beginning. It is a shame to traverse
592
593
                else:
593
594
                    self.base_rev_id = self.revision_graph.find_unique_lca(
594
595
                                            *lcas)
595
 
                self._is_criss_cross = True
 
596
                sorted_lca_keys = self.revision_graph.find_merge_order(                
 
597
                    revisions[0], lcas)
 
598
                if self.base_rev_id == _mod_revision.NULL_REVISION:
 
599
                    self.base_rev_id = sorted_lca_keys[0]
 
600
                
596
601
            if self.base_rev_id == _mod_revision.NULL_REVISION:
597
602
                raise errors.UnrelatedBranches()
598
603
            if self._is_criss_cross:
599
604
                trace.warning('Warning: criss-cross merge encountered.  See bzr'
600
605
                              ' help criss-cross.')
601
606
                trace.mutter('Criss-cross lcas: %r' % lcas)
602
 
                interesting_revision_ids = [self.base_rev_id]
603
 
                interesting_revision_ids.extend(lcas)
 
607
                if self.base_rev_id in lcas:
 
608
                    trace.mutter('Unable to find unique lca. '
 
609
                                 'Fallback %r as best option.' % self.base_rev_id)
 
610
                interesting_revision_ids = set(lcas)
 
611
                interesting_revision_ids.add(self.base_rev_id)
604
612
                interesting_trees = dict((t.get_revision_id(), t)
605
613
                    for t in self.this_branch.repository.revision_trees(
606
614
                        interesting_revision_ids))
607
615
                self._cached_trees.update(interesting_trees)
608
 
                self.base_tree = interesting_trees.pop(self.base_rev_id)
609
 
                sorted_lca_keys = self.revision_graph.find_merge_order(
610
 
                    revisions[0], lcas)
 
616
                if self.base_rev_id in lcas:
 
617
                    self.base_tree = interesting_trees[self.base_rev_id]
 
618
                else:
 
619
                    self.base_tree = interesting_trees.pop(self.base_rev_id)
611
620
                self._lca_trees = [interesting_trees[key]
612
621
                                   for key in sorted_lca_keys]
613
622
            else: