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

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2006-06-20 06:38:49 UTC
  • mfrom: (1773.4.3 bzr.mbp.pyflakes)
  • Revision ID: pqm@pqm.ubuntu.com-20060620063849-400861427a3a9ff1
(mbp) pyflakes cleanups

Show diffs side-by-side

added added

removed removed

Lines of Context:
49
49
import re
50
50
import stat
51
51
from time import time
 
52
import warnings
52
53
 
53
54
from bzrlib.atomicfile import AtomicFile
54
 
from bzrlib.branch import (Branch,
55
 
                           quotefn)
56
55
from bzrlib.conflicts import Conflict, ConflictList, CONFLICT_SUFFIXES
57
56
import bzrlib.bzrdir as bzrdir
58
57
from bzrlib.decorators import needs_read_lock, needs_write_lock
91
90
from bzrlib.progress import DummyProgress, ProgressPhase
92
91
from bzrlib.revision import NULL_REVISION
93
92
from bzrlib.rio import RioReader, rio_file, Stanza
94
 
from bzrlib.symbol_versioning import *
 
93
from bzrlib.symbol_versioning import (deprecated_passed,
 
94
        deprecated_method,
 
95
        deprecated_function,
 
96
        DEPRECATED_PARAMETER,
 
97
        zero_eight,
 
98
        )
 
99
 
95
100
from bzrlib.textui import show_status
96
101
import bzrlib.tree
97
102
from bzrlib.transform import build_tree
230
235
        self.bzrdir = _bzrdir
231
236
        if not _internal:
232
237
            # not created via open etc.
233
 
            warn("WorkingTree() is deprecated as of bzr version 0.8. "
 
238
            warnings.warn("WorkingTree() is deprecated as of bzr version 0.8. "
234
239
                 "Please use bzrdir.open_workingtree or WorkingTree.open().",
235
240
                 DeprecationWarning,
236
241
                 stacklevel=2)
250
255
        mutter("opening working tree %r", basedir)
251
256
        if deprecated_passed(branch):
252
257
            if not _internal:
253
 
                warn("WorkingTree(..., branch=XXX) is deprecated as of bzr 0.8."
 
258
                warnings.warn("WorkingTree(..., branch=XXX) is deprecated as of bzr 0.8."
254
259
                     " Please use bzrdir.open_workingtree() or"
255
260
                     " WorkingTree.open().",
256
261
                     DeprecationWarning,
259
264
            self._branch = branch
260
265
        else:
261
266
            self._branch = self.bzrdir.open_branch()
262
 
        assert isinstance(self.branch, Branch), \
263
 
            "branch %r is not a Branch" % self.branch
264
267
        self.basedir = realpath(basedir)
265
268
        # if branch is at our basedir and is a format 6 or less
266
269
        if isinstance(self._format, WorkingTreeFormat2):
416
419
        XXX: When BzrDir is present, these should be created through that 
417
420
        interface instead.
418
421
        """
419
 
        warn('delete WorkingTree.create', stacklevel=3)
 
422
        warnings.warn('delete WorkingTree.create', stacklevel=3)
420
423
        transport = get_transport(directory)
421
424
        if branch.bzrdir.root_transport.base == transport.base:
422
425
            # same dir 
608
611
        inv = self.read_working_inventory()
609
612
        for f,file_id in zip(files, ids):
610
613
            if self.is_control_filename(f):
611
 
                raise BzrError("cannot add control file %s" % quotefn(f))
 
614
                raise errors.ForbiddenControlFileError(filename=f)
612
615
 
613
616
            fp = splitpath(f)
614
617
 
616
619
                raise BzrError("cannot add top-level %r" % f)
617
620
 
618
621
            fullpath = normpath(self.abspath(f))
619
 
 
620
622
            try:
621
623
                kind = file_kind(fullpath)
622
624
            except OSError, e:
623
625
                if e.errno == errno.ENOENT:
624
626
                    raise NoSuchFile(fullpath)
625
 
                # maybe something better?
626
 
                raise BzrError('cannot add: not a regular file, symlink or directory: %s' % quotefn(f))
627
 
 
628
627
            if not InventoryEntry.versionable_kind(kind):
629
 
                raise BzrError('cannot add: not a versionable file ('
630
 
                               'i.e. regular file, symlink or directory): %s' % quotefn(f))
631
 
 
 
628
                raise errors.BadFileKindError(filename=f, kind=kind)
632
629
            if file_id is None:
633
630
                inv.add_path(f, kind=kind)
634
631
            else:
1284
1281
                # TODO: Perhaps make this just a warning, and continue?
1285
1282
                # This tends to happen when 
1286
1283
                raise NotVersionedError(path=f)
1287
 
            mutter("remove inventory entry %s {%s}", quotefn(f), fid)
1288
1284
            if verbose:
1289
1285
                # having remove it, it must be either ignored or unknown
1290
1286
                if self.is_ignored(f):
1291
1287
                    new_status = 'I'
1292
1288
                else:
1293
1289
                    new_status = '?'
1294
 
                show_status(new_status, inv[fid].kind, quotefn(f), to_file=to_file)
 
1290
                show_status(new_status, inv[fid].kind, f, to_file=to_file)
1295
1291
            del inv[fid]
1296
1292
 
1297
1293
        self._write_inventory(inv)