~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/workingtree.py

  • Committer: Robert Collins
  • Date: 2007-03-21 01:34:41 UTC
  • mto: (2376.1.1 integration)
  • mto: This revision was merged to the branch mainline in revision 2377.
  • Revision ID: robertc@robertcollins.net-20070321013441-x99h538fq62wwt46
Remove bzrlib 0.8 compatability where it was making the code unclear or messy. (Robert Collins)

Show diffs side-by-side

added added

removed removed

Lines of Context:
208
208
                 _internal=False,
209
209
                 _format=None,
210
210
                 _bzrdir=None):
211
 
        """Construct a WorkingTree for basedir.
 
211
        """Construct a WorkingTree instance. This is not a public API.
212
212
 
213
 
        If the branch is not supplied, it is opened automatically.
214
 
        If the branch is supplied, it must be the branch for this basedir.
215
 
        (branch.base is not cross checked, because for remote branches that
216
 
        would be meaningless).
 
213
        :param branch: A branch to override probing for the branch.
217
214
        """
218
215
        self._format = _format
219
216
        self.bzrdir = _bzrdir
220
217
        if not _internal:
221
 
            # not created via open etc.
222
 
            warnings.warn("WorkingTree() is deprecated as of bzr version 0.8. "
223
 
                 "Please use bzrdir.open_workingtree or WorkingTree.open().",
224
 
                 DeprecationWarning,
225
 
                 stacklevel=2)
226
 
            wt = WorkingTree.open(basedir)
227
 
            self._branch = wt.branch
228
 
            self.basedir = wt.basedir
229
 
            self._control_files = wt._control_files
230
 
            self._hashcache = wt._hashcache
231
 
            self._set_inventory(wt._inventory, dirty=False)
232
 
            self._format = wt._format
233
 
            self.bzrdir = wt.bzrdir
 
218
            raise errors.BzrError("Please use bzrdir.open_workingtree or "
 
219
                "WorkingTree.open() to obtain a WorkingTree.")
234
220
        assert isinstance(basedir, basestring), \
235
221
            "base directory %r is not a string" % basedir
236
222
        basedir = safe_unicode(basedir)
237
223
        mutter("opening working tree %r", basedir)
238
224
        if deprecated_passed(branch):
239
 
            if not _internal:
240
 
                warnings.warn("WorkingTree(..., branch=XXX) is deprecated"
241
 
                     " as of bzr 0.8. Please use bzrdir.open_workingtree() or"
242
 
                     " WorkingTree.open().",
243
 
                     DeprecationWarning,
244
 
                     stacklevel=2
245
 
                     )
246
225
            self._branch = branch
247
226
        else:
248
227
            self._branch = self.bzrdir.open_branch()