~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/workingtree.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2006-04-21 06:06:06 UTC
  • mfrom: (1681.1.1 integration)
  • Revision ID: pqm@pqm.ubuntu.com-20060421060606-908ed0c9062b6573
Make WorkingTree.branch a read only property.  (Robert Collins)

Show diffs side-by-side

added added

removed removed

Lines of Context:
223
223
                 DeprecationWarning,
224
224
                 stacklevel=2)
225
225
            wt = WorkingTree.open(basedir)
226
 
            self.branch = wt.branch
 
226
            self._branch = wt.branch
227
227
            self.basedir = wt.basedir
228
228
            self._control_files = wt._control_files
229
229
            self._hashcache = wt._hashcache
244
244
                     DeprecationWarning,
245
245
                     stacklevel=2
246
246
                     )
247
 
            self.branch = branch
 
247
            self._branch = branch
248
248
        else:
249
 
            self.branch = self.bzrdir.open_branch()
 
249
            self._branch = self.bzrdir.open_branch()
250
250
        assert isinstance(self.branch, Branch), \
251
251
            "branch %r is not a Branch" % self.branch
252
252
        self.basedir = realpath(basedir)
282
282
        else:
283
283
            self._set_inventory(_inventory)
284
284
 
 
285
    branch = property(
 
286
        fget=lambda self: self._branch,
 
287
        doc="""The branch this WorkingTree is connected to.
 
288
 
 
289
            This cannot be set - it is reflective of the actual disk structure
 
290
            the working tree has been constructed from.
 
291
            """)
 
292
 
285
293
    def _set_inventory(self, inv):
286
294
        self._inventory = inv
287
295
        self.path2id = self._inventory.path2id