~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/merge.py

  • Committer: John Arbash Meinel
  • Date: 2008-07-16 16:54:06 UTC
  • mto: This revision was merged to the branch mainline in revision 3543.
  • Revision ID: john@arbash-meinel.com-20080716165406-3ctahm7c3fafi3qy
Review feedback from Ian.

Show diffs side-by-side

added added

removed removed

Lines of Context:
592
592
        """
593
593
        result = []
594
594
        iterator = self.other_tree.iter_changes(self.base_tree,
595
 
                include_unchanged=False, specific_files=self.interesting_files,
 
595
                include_unchanged=True, specific_files=self.interesting_files,
596
596
                extra_trees=[self.this_tree])
597
597
        for (file_id, paths, changed, versioned, parents, names, kind,
598
598
             executable) in iterator:
1429
1429
        # rather than a key tuple. We will just map that directly to no common
1430
1430
        # ancestors.
1431
1431
        parent_map = {}
1432
 
        mutter('finding lcas for:\n%s, %s', self.a_rev, self.b_rev)
1433
1432
        while True:
1434
1433
            next_lcas = self.graph.find_lca(*cur_ancestors)
1435
1434
            # Map a plain NULL_REVISION to a simple no-ancestors
1442
1441
            for rev_key in cur_ancestors:
1443
1442
                ordered_parents = tuple(self.graph.find_merge_order(rev_key,
1444
1443
                                                                    next_lcas))
1445
 
                mutter('found %s => %s', rev_key[-1], [p[-1] for p
1446
 
                                                       in ordered_parents])
1447
1444
                parent_map[rev_key] = ordered_parents
1448
1445
            if len(next_lcas) == 0:
1449
1446
                break
1453
1450
            elif len(next_lcas) > 2:
1454
1451
                # More than 2 lca's, fall back to grabbing all nodes between
1455
1452
                # this and the unique lca.
1456
 
                mutter('More than 2 LCAs, falling back to all nodes for: %s',
1457
 
                       cur_ancestors)
 
1453
                mutter('More than 2 LCAs, falling back to all nodes for:'
 
1454
                       ' %s, %s\n=> %s', self.a_key, self.b_key, cur_ancestors)
1458
1455
                cur_lcas = next_lcas
1459
1456
                while len(cur_lcas) > 1:
1460
1457
                    cur_lcas = self.graph.find_lca(*cur_lcas)
1579
1576
        all_revision_keys.add(self.a_key)
1580
1577
        all_revision_keys.add(self.b_key)
1581
1578
 
1582
 
        if NULL_REVISION in all_revision_keys:
1583
 
            import pdb; pdb.set_trace()
1584
1579
        # Everything else is in 'keys' but get_lines is in 'revision_ids'
1585
1580
        all_texts = self.get_lines([k[-1] for k in all_revision_keys])
1586
1581
        return all_texts
1603
1598
        tip_key = self._key_prefix + (_mod_revision.CURRENT_REVISION,)
1604
1599
        parent_map[tip_key] = (self.a_key, self.b_key)
1605
1600
 
1606
 
        ordering = []
1607
1601
        for seq_num, key, depth, eom in reversed(tsort.merge_sort(parent_map,
1608
1602
                                                                  tip_key)):
1609
1603
            if key == tip_key:
1611
1605
        # for key in tsort.topo_sort(parent_map):
1612
1606
            parent_keys = parent_map[key]
1613
1607
            revision_id = key[-1]
1614
 
            ordering.append(revision_id)
1615
1608
            parent_ids = [k[-1] for k in parent_keys]
1616
1609
            self._weave.add_lines(revision_id, parent_ids,
1617
1610
                                  all_texts[revision_id])
1618
 
        mutter('order in weave: %s', ordering)
1619
1611
 
1620
1612
    def plan_merge(self):
1621
1613
        """Generate a 'plan' for merging the two revisions.
1634
1626
                    raise AssertionError('There was an invalid head: %s != %s'
1635
1627
                                         % (self.b_key, self._head_key))
1636
1628
                plan = 'new-b'
1637
 
            lines = self.get_lines([self._head_key[-1]])[self._head_key[-1]]
 
1629
            head_rev = self._head_key[-1]
 
1630
            lines = self.get_lines([head_rev])[head_rev]
1638
1631
            return ((plan, line) for line in lines)
1639
1632
        return self._weave.plan_merge(self.a_rev, self.b_rev)
1640
1633