/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/repository.py

Deprecate compare_trees and move its body to InterTree.changes_from.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1581
1581
            return
1582
1582
        self.target.fetch(self.source, revision_id=revision_id)
1583
1583
 
1584
 
    def _double_lock(self, lock_source, lock_target):
1585
 
        """Take out too locks, rolling back the first if the second throws."""
1586
 
        lock_source()
1587
 
        try:
1588
 
            lock_target()
1589
 
        except Exception:
1590
 
            # we want to ensure that we don't leave source locked by mistake.
1591
 
            # and any error on target should not confuse source.
1592
 
            self.source.unlock()
1593
 
            raise
1594
 
 
1595
1584
    @needs_write_lock
1596
1585
    def fetch(self, revision_id=None, pb=None):
1597
1586
        """Fetch the content required to construct revision_id.
1615
1604
                               pb=pb)
1616
1605
        return f.count_copied, f.failed_revisions
1617
1606
 
1618
 
    def lock_read(self):
1619
 
        """Take out a logical read lock.
1620
 
 
1621
 
        This will lock the source branch and the target branch. The source gets
1622
 
        a read lock and the target a read lock.
1623
 
        """
1624
 
        self._double_lock(self.source.lock_read, self.target.lock_read)
1625
 
 
1626
 
    def lock_write(self):
1627
 
        """Take out a logical write lock.
1628
 
 
1629
 
        This will lock the source branch and the target branch. The source gets
1630
 
        a read lock and the target a write lock.
1631
 
        """
1632
 
        self._double_lock(self.source.lock_read, self.target.lock_write)
1633
 
 
1634
1607
    @needs_read_lock
1635
1608
    def missing_revision_ids(self, revision_id=None):
1636
1609
        """Return the revision ids that source has that target does not.
1654
1627
        # that we've decided we need.
1655
1628
        return [rev_id for rev_id in source_ids if rev_id in result_set]
1656
1629
 
1657
 
    def unlock(self):
1658
 
        """Release the locks on source and target."""
1659
 
        try:
1660
 
            self.target.unlock()
1661
 
        finally:
1662
 
            self.source.unlock()
1663
 
 
1664
1630
 
1665
1631
class InterWeaveRepo(InterRepository):
1666
1632
    """Optimised code paths between Weave based repositories."""