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

  • Committer: Robert Collins
  • Date: 2010-05-11 08:36:16 UTC
  • mto: This revision was merged to the branch mainline in revision 5223.
  • Revision ID: robertc@robertcollins.net-20100511083616-b8fjb19zomwupid0
Make all lock methods return Result objects, rather than lock_read returning self, as per John's review.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1356
1356
        """
1357
1357
        # XXX: Fix the bzrdir API to allow getting the branch back from the
1358
1358
        # clone call. Or something. 20090224 RBC/spiv.
1359
 
        # XXX: Should this perhaps clone colocated branches as well, 
1360
 
        # rather than just the default branch? 20100319 JRV
1361
1359
        if revision_id is None:
1362
1360
            revision_id = self.last_revision()
1363
1361
        dir_to = self.bzrdir.clone_on_transport(to_transport,
1533
1531
        """Return the current default format."""
1534
1532
        return klass._default_format
1535
1533
 
1536
 
    def get_reference(self, a_bzrdir, name=None):
 
1534
    def get_reference(self, a_bzrdir):
1537
1535
        """Get the target reference of the branch in a_bzrdir.
1538
1536
 
1539
1537
        format probing must have been completed before calling
1541
1539
        in a_bzrdir is correct.
1542
1540
 
1543
1541
        :param a_bzrdir: The bzrdir to get the branch data from.
1544
 
        :param name: Name of the colocated branch to fetch
1545
1542
        :return: None if the branch is not a reference branch.
1546
1543
        """
1547
1544
        return None
1548
1545
 
1549
1546
    @classmethod
1550
 
    def set_reference(self, a_bzrdir, name, to_branch):
 
1547
    def set_reference(self, a_bzrdir, to_branch):
1551
1548
        """Set the target reference of the branch in a_bzrdir.
1552
1549
 
1553
1550
        format probing must have been completed before calling
1555
1552
        in a_bzrdir is correct.
1556
1553
 
1557
1554
        :param a_bzrdir: The bzrdir to set the branch reference for.
1558
 
        :param name: Name of colocated branch to set, None for default
1559
1555
        :param to_branch: branch that the checkout is to reference
1560
1556
        """
1561
1557
        raise NotImplementedError(self.set_reference)
2171
2167
        """See BranchFormat.get_format_description()."""
2172
2168
        return "Checkout reference format 1"
2173
2169
 
2174
 
    def get_reference(self, a_bzrdir, name=None):
 
2170
    def get_reference(self, a_bzrdir):
2175
2171
        """See BranchFormat.get_reference()."""
2176
 
        transport = a_bzrdir.get_branch_transport(None, name=name)
 
2172
        transport = a_bzrdir.get_branch_transport(None)
2177
2173
        return transport.get_bytes('location')
2178
2174
 
2179
 
    def set_reference(self, a_bzrdir, name, to_branch):
 
2175
    def set_reference(self, a_bzrdir, to_branch):
2180
2176
        """See BranchFormat.set_reference()."""
2181
 
        transport = a_bzrdir.get_branch_transport(None, name=name)
 
2177
        transport = a_bzrdir.get_branch_transport(None)
2182
2178
        location = transport.put_bytes('location', to_branch.base)
2183
2179
 
2184
2180
    def initialize(self, a_bzrdir, name=None, target_branch=None):
2235
2231
                raise AssertionError("wrong format %r found for %r" %
2236
2232
                    (format, self))
2237
2233
        if location is None:
2238
 
            location = self.get_reference(a_bzrdir, name)
 
2234
            location = self.get_reference(a_bzrdir)
2239
2235
        real_bzrdir = bzrdir.BzrDir.open(
2240
2236
            location, possible_transports=possible_transports)
2241
2237
        result = real_bzrdir.open_branch(name=name,