~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/workingtree_4.py

  • Committer: John Arbash Meinel
  • Date: 2011-05-06 15:15:44 UTC
  • mfrom: (5835 +trunk)
  • mto: This revision was merged to the branch mainline in revision 5836.
  • Revision ID: john@arbash-meinel.com-20110506151544-atzxeezfwssnlacr
Merge bzr.dev 5835 in prep for release-notes updates

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
    _DEFAULT_WORTH_SAVING_LIMIT = 10
77
80
 
130
133
            state.add(f, file_id, kind, None, '')
131
134
        self._make_dirty(reset_inventory=True)
132
135
 
 
136
    def _get_check_refs(self):
 
137
        """Return the references needed to perform a check of this tree."""
 
138
        return [('trees', self.last_revision())]
 
139
 
133
140
    def _make_dirty(self, reset_inventory):
134
141
        """Make the tree state dirty.
135
142
 
187
194
 
188
195
    def _comparison_data(self, entry, path):
189
196
        kind, executable, stat_value = \
190
 
            WorkingTree3._comparison_data(self, entry, path)
 
197
            WorkingTree._comparison_data(self, entry, path)
191
198
        # it looks like a plain directory, but it's really a reference -- see
192
199
        # also kind()
193
200
        if (self._repo_supports_tree_reference and kind == 'directory'
199
206
    def commit(self, message=None, revprops=None, *args, **kwargs):
200
207
        # mark the tree as dirty post commit - commit
201
208
        # can change the current versioned list by doing deletes.
202
 
        result = WorkingTree3.commit(self, message, revprops, *args, **kwargs)
 
209
        result = WorkingTree.commit(self, message, revprops, *args, **kwargs)
203
210
        self._make_dirty(reset_inventory=True)
204
211
        return result
205
212
 
1395
1402
class WorkingTree4(DirStateWorkingTree):
1396
1403
    """This is the Format 4 working tree.
1397
1404
 
1398
 
    This differs from WorkingTree3 by:
 
1405
    This differs from WorkingTree by:
1399
1406
     - Having a consolidated internal dirstate, stored in a
1400
1407
       randomly-accessible sorted file on disk.
1401
1408
     - Not having a regular inventory attribute.  One can be synthesized
1429
1436
        return views.PathBasedViews(self)
1430
1437
 
1431
1438
 
1432
 
class DirStateWorkingTreeFormat(WorkingTreeFormat3):
 
1439
class DirStateWorkingTreeFormat(WorkingTreeFormat):
1433
1440
 
1434
1441
    missing_parent_conflicts = True
1435
1442
 
 
1443
    _lock_class = LockDir
 
1444
    _lock_file_name = 'lock'
 
1445
 
 
1446
    def _open_control_files(self, a_bzrdir):
 
1447
        transport = a_bzrdir.get_workingtree_transport(None)
 
1448
        return LockableFiles(transport, self._lock_file_name,
 
1449
                             self._lock_class)
 
1450
 
1436
1451
    def initialize(self, a_bzrdir, revision_id=None, from_branch=None,
1437
1452
                   accelerator_tree=None, hardlink=False):
1438
1453
        """See WorkingTreeFormat.initialize().
1537
1552
        :param wt: the WorkingTree object
1538
1553
        """
1539
1554
 
 
1555
    def open(self, a_bzrdir, _found=False):
 
1556
        """Return the WorkingTree object for a_bzrdir
 
1557
 
 
1558
        _found is a private parameter, do not use it. It is used to indicate
 
1559
               if format probing has already been done.
 
1560
        """
 
1561
        if not _found:
 
1562
            # we are being called directly and must probe.
 
1563
            raise NotImplementedError
 
1564
        if not isinstance(a_bzrdir.transport, LocalTransport):
 
1565
            raise errors.NotLocalUrl(a_bzrdir.transport.base)
 
1566
        wt = self._open(a_bzrdir, self._open_control_files(a_bzrdir))
 
1567
        return wt
 
1568
 
1540
1569
    def _open(self, a_bzrdir, control_files):
1541
1570
        """Open the tree itself.
1542
1571
 
2038
2067
    def make_source_parent_tree(source, target):
2039
2068
        """Change the source tree into a parent of the target."""
2040
2069
        revid = source.commit('record tree')
2041
 
        target.branch.repository.fetch(source.branch.repository, revid)
 
2070
        target.branch.fetch(source.branch, revid)
2042
2071
        target.set_parent_ids([revid])
2043
2072
        return target.basis_tree(), target
2044
2073