/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/workingtree.py

Change all callers of set_last_revision to use set_parent_trees.

Show diffs side-by-side

added added

removed removed

Lines of Context:
517
517
        if revision_id is None:
518
518
            transform_tree(tree, self)
519
519
        else:
520
 
            # TODO now merge from tree.last_revision to revision
 
520
            # TODO now merge from tree.last_revision to revision (to preserve
 
521
            # user local changes)
521
522
            transform_tree(tree, self)
522
 
            tree.set_last_revision(revision_id)
 
523
            tree.set_parent_trees([(revision_id,
 
524
                tree.branch.repository.revision_tree(revision_id))])
523
525
 
524
526
    @needs_write_lock
525
527
    def commit(self, message=None, revprops=None, *args, **kwargs):
1010
1012
                repository = self.branch.repository
1011
1013
                pb = bzrlib.ui.ui_factory.nested_progress_bar()
1012
1014
                try:
 
1015
                    new_basis_tree = self.branch.basis_tree()
1013
1016
                    merge_inner(self.branch,
1014
 
                                self.branch.basis_tree(),
1015
 
                                basis_tree, 
1016
 
                                this_tree=self, 
 
1017
                                new_basis_tree,
 
1018
                                basis_tree,
 
1019
                                this_tree=self,
1017
1020
                                pb=pb)
1018
1021
                finally:
1019
1022
                    pb.finished()
1020
 
                self.set_last_revision(self.branch.last_revision())
 
1023
                # TODO - dedup parents list with things merged by pull ?
 
1024
                parent_trees = [(self.branch.last_revision(), new_basis_tree)]
 
1025
                merges = self.get_parent_ids()[1:]
 
1026
                parent_trees.extend([
 
1027
                    (parent, repository.revision_tree(parent)) for
 
1028
                     parent in merges])
 
1029
                self.set_parent_trees(parent_trees)
1021
1030
            return count
1022
1031
        finally:
1023
1032
            source.unlock()
1431
1440
                                      basis,
1432
1441
                                      this_tree=self)
1433
1442
                self.set_last_revision(self.branch.last_revision())
 
1443
                # TODO - dedup parents list with things merged by pull ?
 
1444
                parent_trees = [(self.branch.last_revision(), to_tree)]
 
1445
                merges = self.get_parent_ids()[1:]
 
1446
                parent_trees.extend([
 
1447
                    (parent, self.branch.repository.revision_tree(parent)) for
 
1448
                     parent in merges])
 
1449
                self.set_parent_trees(parent_trees)
1434
1450
            if old_tip and old_tip != self.last_revision():
1435
1451
                # our last revision was not the prior branch last revision
1436
1452
                # and we have converted that last revision to a pending merge.
1716
1732
            finally:
1717
1733
                branch.unlock()
1718
1734
        revision = branch.last_revision()
1719
 
        inv = Inventory() 
 
1735
        inv = Inventory()
1720
1736
        wt = WorkingTree2(a_bzrdir.root_transport.local_abspath('.'),
1721
1737
                         branch,
1722
1738
                         inv,
1725
1741
                         _bzrdir=a_bzrdir)
1726
1742
        wt._write_inventory(inv)
1727
1743
        wt.set_root_id(inv.root.file_id)
1728
 
        wt.set_last_revision(revision)
1729
 
        wt.set_pending_merges([])
1730
 
        build_tree(wt.basis_tree(), wt)
 
1744
        basis_tree = branch.repository.revision_tree(revision)
 
1745
        wt.set_parent_trees([(revision, basis_tree)])
 
1746
        build_tree(basis_tree, wt)
1731
1747
        return wt
1732
1748
 
1733
1749
    def __init__(self):
1807
1823
        try:
1808
1824
            wt._write_inventory(inv)
1809
1825
            wt.set_root_id(inv.root.file_id)
1810
 
            wt.set_last_revision(revision_id)
1811
 
            wt.set_pending_merges([])
1812
 
            build_tree(wt.basis_tree(), wt)
 
1826
            basis_tree = branch.repository.revision_tree(revision_id)
 
1827
            wt.set_parent_trees([(revision_id, basis_tree)])
 
1828
            build_tree(basis_tree, wt)
1813
1829
        finally:
1814
1830
            wt.unlock()
1815
1831
            control_files.unlock()