~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/plugins/weave_fmt/workingtree.py

  • Committer: Tarmac
  • Author(s): Vincent Ladeuil
  • Date: 2017-01-30 14:42:05 UTC
  • mfrom: (6620.1.1 trunk)
  • Revision ID: tarmac-20170130144205-r8fh2xpmiuxyozpv
Merge  2.7 into trunk including fix for bug #1657238 [r=vila]

Show diffs side-by-side

added added

removed removed

Lines of Context:
16
16
 
17
17
"""Weave-era working tree objects."""
18
18
 
 
19
from __future__ import absolute_import
 
20
 
19
21
from cStringIO import StringIO
20
22
 
21
23
from bzrlib import (
28
30
    xml5,
29
31
    )
30
32
from bzrlib.decorators import needs_read_lock
 
33
from bzrlib.mutabletree import MutableTree
31
34
from bzrlib.transport.local import LocalTransport
32
35
from bzrlib.workingtree import (
33
 
    InventoryWorkingTree,
34
36
    WorkingTreeFormat,
35
37
    )
 
38
from bzrlib.workingtree_3 import (
 
39
    PreDirStateWorkingTree,
 
40
    )
36
41
 
37
42
 
38
43
def get_conflicted_stem(path):
100
105
                         _bzrdir=a_bzrdir,
101
106
                         _control_files=branch.control_files)
102
107
        basis_tree = branch.repository.revision_tree(revision_id)
103
 
        if basis_tree.inventory.root is not None:
 
108
        if basis_tree.get_root_id() is not None:
104
109
            wt.set_root_id(basis_tree.get_root_id())
105
110
        # set the parent list and cache the basis tree.
106
111
        if _mod_revision.is_null(revision_id):
109
114
            parent_trees = [(revision_id, basis_tree)]
110
115
        wt.set_parent_trees(parent_trees)
111
116
        transform.build_tree(basis_tree, wt)
 
117
        for hook in MutableTree.hooks['post_build_tree']:
 
118
            hook(wt)
112
119
        return wt
113
120
 
114
121
    def __init__(self):
135
142
        return wt
136
143
 
137
144
 
138
 
class WorkingTree2(InventoryWorkingTree):
 
145
class WorkingTree2(PreDirStateWorkingTree):
139
146
    """This is the Format 2 working tree.
140
147
 
141
148
    This was the first weave based working tree.
143
150
     - uses the branch last-revision.
144
151
    """
145
152
 
146
 
    def __init__(self, *args, **kwargs):
147
 
        super(WorkingTree2, self).__init__(*args, **kwargs)
 
153
    def __init__(self, basedir, *args, **kwargs):
 
154
        super(WorkingTree2, self).__init__(basedir, *args, **kwargs)
148
155
        # WorkingTree2 has more of a constraint that self._inventory must
149
156
        # exist. Because this is an older format, we don't mind the overhead
150
157
        # caused by the extra computation here.
158
165
        """Return the references needed to perform a check of this tree."""
159
166
        return [('trees', self.last_revision())]
160
167
 
 
168
 
161
169
    def lock_tree_write(self):
162
170
        """See WorkingTree.lock_tree_write().
163
171