~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/workingtree_4.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2011-05-05 03:14:25 UTC
  • mfrom: (5816.5.7 workingtree-3)
  • Revision ID: pqm@pqm.ubuntu.com-20110505031425-f1pyxrpf6wu8jads
(jelmer) Split WorkingTree3 out into a separate file. (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,
37
38
    debug,
38
39
    dirstate,
39
40
    errors,
51
52
from bzrlib.decorators import needs_read_lock, needs_write_lock
52
53
from bzrlib.inventory import Inventory, ROOT_ID, entry_factory
53
54
from bzrlib.lock import LogicalLockResult
 
55
from bzrlib.lockable_files import LockableFiles
 
56
from bzrlib.lockdir import LockDir
54
57
from bzrlib.mutabletree import needs_tree_write_lock
55
58
from bzrlib.osutils import (
56
59
    file_kind,
65
68
    InventoryTree,
66
69
    )
67
70
from bzrlib.workingtree import (
 
71
    InventoryWorkingTree,
68
72
    WorkingTree,
69
 
    WorkingTree3,
70
 
    WorkingTreeFormat3,
 
73
    WorkingTreeFormat,
71
74
    )
72
75
 
73
76
 
74
 
class DirStateWorkingTree(WorkingTree3):
 
77
class DirStateWorkingTree(InventoryWorkingTree):
75
78
 
76
79
    def __init__(self, basedir,
77
80
                 branch,
128
131
            state.add(f, file_id, kind, None, '')
129
132
        self._make_dirty(reset_inventory=True)
130
133
 
 
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
 
131
138
    def _make_dirty(self, reset_inventory):
132
139
        """Make the tree state dirty.
133
140
 
185
192
 
186
193
    def _comparison_data(self, entry, path):
187
194
        kind, executable, stat_value = \
188
 
            WorkingTree3._comparison_data(self, entry, path)
 
195
            WorkingTree._comparison_data(self, entry, path)
189
196
        # it looks like a plain directory, but it's really a reference -- see
190
197
        # also kind()
191
198
        if (self._repo_supports_tree_reference and kind == 'directory'
197
204
    def commit(self, message=None, revprops=None, *args, **kwargs):
198
205
        # mark the tree as dirty post commit - commit
199
206
        # can change the current versioned list by doing deletes.
200
 
        result = WorkingTree3.commit(self, message, revprops, *args, **kwargs)
 
207
        result = WorkingTree.commit(self, message, revprops, *args, **kwargs)
201
208
        self._make_dirty(reset_inventory=True)
202
209
        return result
203
210
 
1373
1380
class WorkingTree4(DirStateWorkingTree):
1374
1381
    """This is the Format 4 working tree.
1375
1382
 
1376
 
    This differs from WorkingTree3 by:
 
1383
    This differs from WorkingTree by:
1377
1384
     - Having a consolidated internal dirstate, stored in a
1378
1385
       randomly-accessible sorted file on disk.
1379
1386
     - Not having a regular inventory attribute.  One can be synthesized
1407
1414
        return views.PathBasedViews(self)
1408
1415
 
1409
1416
 
1410
 
class DirStateWorkingTreeFormat(WorkingTreeFormat3):
 
1417
class DirStateWorkingTreeFormat(WorkingTreeFormat):
1411
1418
 
1412
1419
    missing_parent_conflicts = True
1413
1420
 
 
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
 
1414
1429
    def initialize(self, a_bzrdir, revision_id=None, from_branch=None,
1415
1430
                   accelerator_tree=None, hardlink=False):
1416
1431
        """See WorkingTreeFormat.initialize().
1515
1530
        :param wt: the WorkingTree object
1516
1531
        """
1517
1532
 
 
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
 
1518
1547
    def _open(self, a_bzrdir, control_files):
1519
1548
        """Open the tree itself.
1520
1549