Rev 5098: (Jelmer) Let Branch objects keep track of the name (if any) they have in file:///home/pqm/archives/thelove/bzr/%2Btrunk/

Canonical.com Patch Queue Manager pqm at pqm.ubuntu.com
Fri Mar 19 03:03:30 GMT 2010


At file:///home/pqm/archives/thelove/bzr/%2Btrunk/

------------------------------------------------------------
revno: 5098 [merge]
revision-id: pqm at pqm.ubuntu.com-20100319030327-b972l4hg4azzeaqf
parent: pqm at pqm.ubuntu.com-20100318091328-8fo347hq4at1usky
parent: jelmer at samba.org-20100311141940-6ur8k6g3ccusg1do
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Fri 2010-03-19 03:03:27 +0000
message:
  (Jelmer) Let Branch objects keep track of the name (if any) they have
  	in their control directory.
modified:
  bzrlib/branch.py               branch.py-20050309040759-e4baf4e0d046576e
=== modified file 'bzrlib/branch.py'
--- a/bzrlib/branch.py	2010-03-06 17:49:26 +0000
+++ b/bzrlib/branch.py	2010-03-11 14:19:40 +0000
@@ -1759,14 +1759,13 @@
 
     def open(self, a_bzrdir, name=None, _found=False, ignore_fallbacks=False):
         """See BranchFormat.open()."""
-        if name is not None:
-            raise errors.NoColocatedBranchSupport(a_bzrdir)
         if not _found:
             # we are being called directly and must probe.
             raise NotImplementedError
         return BzrBranch(_format=self,
                          _control_files=a_bzrdir._control_files,
                          a_bzrdir=a_bzrdir,
+                         name=name,
                          _repository=a_bzrdir.open_repository())
 
     def __str__(self):
@@ -1800,6 +1799,7 @@
                                                          lockdir.LockDir)
             return self._branch_class()(_format=self,
                               _control_files=control_files,
+                              name=name,
                               a_bzrdir=a_bzrdir,
                               _repository=a_bzrdir.find_repository(),
                               ignore_fallbacks=ignore_fallbacks)
@@ -2100,17 +2100,20 @@
     :ivar repository: Repository for this branch.
     :ivar base: The url of the base directory for this branch; the one
         containing the .bzr directory.
+    :ivar name: Optional colocated branch name as it exists in the control
+        directory.
     """
 
     def __init__(self, _format=None,
-                 _control_files=None, a_bzrdir=None, _repository=None,
-                 ignore_fallbacks=False):
+                 _control_files=None, a_bzrdir=None, name=None,
+                 _repository=None, ignore_fallbacks=False):
         """Create new branch object at a particular location."""
         if a_bzrdir is None:
             raise ValueError('a_bzrdir must be supplied')
         else:
             self.bzrdir = a_bzrdir
         self._base = self.bzrdir.transport.clone('..').base
+        self.name = name
         # XXX: We should be able to just do
         #   self.base = self.bzrdir.root_transport.base
         # but this does not quite work yet -- mbp 20080522
@@ -2123,7 +2126,10 @@
         Branch.__init__(self)
 
     def __str__(self):
-        return '%s(%r)' % (self.__class__.__name__, self.base)
+        if self.name is None:
+            return '%s(%r)' % (self.__class__.__name__, self.base)
+        else:
+            return '%s(%r,%r)' % (self.__class__.__name__, self.base, self.name)
 
     __repr__ = __str__
 




More information about the bazaar-commits mailing list