~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/workingtree_4.py

(jelmer) Skip tests that require an inventory when run against a WorkingTree
 that is not inventory based. (Jelmer Vernooij)

Show diffs side-by-side

added added

removed removed

Lines of Context:
34
34
from bzrlib import (
35
35
    bzrdir,
36
36
    cache_utf8,
37
 
    conflicts as _mod_conflicts,
38
37
    debug,
39
38
    dirstate,
40
39
    errors,
52
51
from bzrlib.decorators import needs_read_lock, needs_write_lock
53
52
from bzrlib.inventory import Inventory, ROOT_ID, entry_factory
54
53
from bzrlib.lock import LogicalLockResult
55
 
from bzrlib.lockable_files import LockableFiles
56
 
from bzrlib.lockdir import LockDir
57
54
from bzrlib.mutabletree import needs_tree_write_lock
58
55
from bzrlib.osutils import (
59
56
    file_kind,
68
65
    InventoryTree,
69
66
    )
70
67
from bzrlib.workingtree import (
71
 
    InventoryWorkingTree,
72
68
    WorkingTree,
73
 
    WorkingTreeFormat,
 
69
    WorkingTree3,
 
70
    WorkingTreeFormat3,
74
71
    )
75
72
 
76
73
 
77
 
class DirStateWorkingTree(InventoryWorkingTree):
 
74
class DirStateWorkingTree(WorkingTree3):
78
75
 
79
76
    def __init__(self, basedir,
80
77
                 branch,
131
128
            state.add(f, file_id, kind, None, '')
132
129
        self._make_dirty(reset_inventory=True)
133
130
 
134
 
    def _get_check_refs(self):
135
 
        """Return the references needed to perform a check of this tree."""
136
 
        return [('trees', self.last_revision())]
137
 
 
138
131
    def _make_dirty(self, reset_inventory):
139
132
        """Make the tree state dirty.
140
133
 
192
185
 
193
186
    def _comparison_data(self, entry, path):
194
187
        kind, executable, stat_value = \
195
 
            WorkingTree._comparison_data(self, entry, path)
 
188
            WorkingTree3._comparison_data(self, entry, path)
196
189
        # it looks like a plain directory, but it's really a reference -- see
197
190
        # also kind()
198
191
        if (self._repo_supports_tree_reference and kind == 'directory'
204
197
    def commit(self, message=None, revprops=None, *args, **kwargs):
205
198
        # mark the tree as dirty post commit - commit
206
199
        # can change the current versioned list by doing deletes.
207
 
        result = WorkingTree.commit(self, message, revprops, *args, **kwargs)
 
200
        result = WorkingTree3.commit(self, message, revprops, *args, **kwargs)
208
201
        self._make_dirty(reset_inventory=True)
209
202
        return result
210
203
 
1380
1373
class WorkingTree4(DirStateWorkingTree):
1381
1374
    """This is the Format 4 working tree.
1382
1375
 
1383
 
    This differs from WorkingTree by:
 
1376
    This differs from WorkingTree3 by:
1384
1377
     - Having a consolidated internal dirstate, stored in a
1385
1378
       randomly-accessible sorted file on disk.
1386
1379
     - Not having a regular inventory attribute.  One can be synthesized
1414
1407
        return views.PathBasedViews(self)
1415
1408
 
1416
1409
 
1417
 
class DirStateWorkingTreeFormat(WorkingTreeFormat):
 
1410
class DirStateWorkingTreeFormat(WorkingTreeFormat3):
1418
1411
 
1419
1412
    missing_parent_conflicts = True
1420
1413
 
1421
 
    _lock_class = LockDir
1422
 
    _lock_file_name = 'lock'
1423
 
 
1424
 
    def _open_control_files(self, a_bzrdir):
1425
 
        transport = a_bzrdir.get_workingtree_transport(None)
1426
 
        return LockableFiles(transport, self._lock_file_name,
1427
 
                             self._lock_class)
1428
 
 
1429
1414
    def initialize(self, a_bzrdir, revision_id=None, from_branch=None,
1430
1415
                   accelerator_tree=None, hardlink=False):
1431
1416
        """See WorkingTreeFormat.initialize().
1530
1515
        :param wt: the WorkingTree object
1531
1516
        """
1532
1517
 
1533
 
    def open(self, a_bzrdir, _found=False):
1534
 
        """Return the WorkingTree object for a_bzrdir
1535
 
 
1536
 
        _found is a private parameter, do not use it. It is used to indicate
1537
 
               if format probing has already been done.
1538
 
        """
1539
 
        if not _found:
1540
 
            # we are being called directly and must probe.
1541
 
            raise NotImplementedError
1542
 
        if not isinstance(a_bzrdir.transport, LocalTransport):
1543
 
            raise errors.NotLocalUrl(a_bzrdir.transport.base)
1544
 
        wt = self._open(a_bzrdir, self._open_control_files(a_bzrdir))
1545
 
        return wt
1546
 
 
1547
1518
    def _open(self, a_bzrdir, control_files):
1548
1519
        """Open the tree itself.
1549
1520