/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar
5557.1.7 by John Arbash Meinel
Merge in the bzr.dev 5582
1
# Copyright (C) 2006-2011 Canonical Ltd
1986.1.2 by Robert Collins
Various changes to allow non-workingtree specific tests to run entirely
2
#
3
# This program is free software; you can redistribute it and/or modify
4
# it under the terms of the GNU General Public License as published by
5
# the Free Software Foundation; either version 2 of the License, or
6
# (at your option) any later version.
7
#
8
# This program is distributed in the hope that it will be useful,
9
# but WITHOUT ANY WARRANTY; without even the implied warranty of
10
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11
# GNU General Public License for more details.
12
#
13
# You should have received a copy of the GNU General Public License
14
# along with this program; if not, write to the Free Software
4183.7.1 by Sabin Iacob
update FSF mailing address
15
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
1986.1.2 by Robert Collins
Various changes to allow non-workingtree specific tests to run entirely
16
17
"""MutableTree object.
18
19
See MutableTree for more details.
20
"""
21
6379.6.7 by Jelmer Vernooij
Move importing from future until after doc string, otherwise the doc string will disappear.
22
from __future__ import absolute_import
1986.1.2 by Robert Collins
Various changes to allow non-workingtree specific tests to run entirely
23
6672.2.4 by Jelmer Vernooij
Fix imports.
24
from . import (
4721.3.1 by Vincent Ladeuil
Cleanup imports.
25
    errors,
3335.1.2 by Jelmer Vernooij
Add mutabletree hooks class and start_commit hook.
26
    hooks,
4721.3.1 by Vincent Ladeuil
Cleanup imports.
27
    osutils,
28
    trace,
29
    tree,
2568.2.6 by Robert Collins
Review feedback.
30
    )
6670.4.1 by Jelmer Vernooij
Update imports.
31
6656.1.1 by Martin
Apply 2to3 dict fixer and clean up resulting mess using view helpers
32
from .sixish import (
6695.3.1 by Martin
Remove remaining uses of basestring from the codebase
33
    text_type,
6656.1.1 by Martin
Apply 2to3 dict fixer and clean up resulting mess using view helpers
34
    viewvalues,
35
    )
1986.1.2 by Robert Collins
Various changes to allow non-workingtree specific tests to run entirely
36
37
5777.4.1 by Jelmer Vernooij
Split inventory-specific code out of MutableTree into MutableInventoryTree.
38
class MutableTree(tree.Tree):
1986.1.2 by Robert Collins
Various changes to allow non-workingtree specific tests to run entirely
39
    """A MutableTree is a specialisation of Tree which is able to be mutated.
40
41
    Generally speaking these mutations are only possible within a lock_write
42
    context, and will revert if the lock is broken abnormally - but this cannot
43
    be guaranteed - depending on the exact implementation of the mutable state.
44
6622.1.34 by Jelmer Vernooij
Rename brzlib => breezy.
45
    The most common form of Mutable Tree is WorkingTree, see breezy.workingtree.
1986.1.2 by Robert Collins
Various changes to allow non-workingtree specific tests to run entirely
46
    For tests we also have MemoryTree which is a MutableTree whose contents are
47
    entirely in memory.
48
49
    For now, we are not treating MutableTree as an interface to provide
3943.8.1 by Marius Kruger
remove all trailing whitespace from bzr source
50
    conformance tests for - rather we are testing MemoryTree specifically, and
1986.1.2 by Robert Collins
Various changes to allow non-workingtree specific tests to run entirely
51
    interface testing implementations of WorkingTree.
52
6207.3.3 by jelmer at samba
Fix tests and the like.
53
    A mutable tree always has an associated Branch and ControlDir object - the
1986.1.2 by Robert Collins
Various changes to allow non-workingtree specific tests to run entirely
54
    branch and bzrdir attributes.
55
    """
3794.5.19 by Mark Hammond
MutableTree gets case_sensitive attribute and smart_add takes advantage of it to enforce sane CICP-filesystem semantics
56
    def __init__(self, *args, **kw):
57
        super(MutableTree, self).__init__(*args, **kw)
58
        # Is this tree on a case-insensitive or case-preserving file-system?
59
        # Sub-classes may initialize to False if they detect they are being
60
        # used on media which doesn't differentiate the case of names.
61
        self.case_sensitive = True
1986.1.2 by Robert Collins
Various changes to allow non-workingtree specific tests to run entirely
62
5699.2.1 by Jelmer Vernooij
Move is_control_filename() from Tree to MutableTree.
63
    def is_control_filename(self, filename):
64
        """True if filename is the name of a control file in this tree.
65
66
        :param filename: A filename within the tree. This is a relative path
5891.1.2 by Andrew Bennetts
Fix a bunch of docstring formatting nits, making pydoctor a bit happier.
67
            from the root of this tree.
5699.2.1 by Jelmer Vernooij
Move is_control_filename() from Tree to MutableTree.
68
69
        This is true IF and ONLY IF the filename is part of the meta data
70
        that bzr controls in this tree. I.E. a random .bzr directory placed
71
        on disk will not be a control file for this tree.
72
        """
73
        raise NotImplementedError(self.is_control_filename)
74
1986.1.2 by Robert Collins
Various changes to allow non-workingtree specific tests to run entirely
75
    def add(self, files, ids=None, kinds=None):
76
        """Add paths to the set of versioned paths.
77
78
        Note that the command line normally calls smart_add instead,
79
        which can automatically recurse.
80
81
        This adds the files to the inventory, so that they will be
82
        recorded by the next commit.
83
84
        :param files: List of paths to add, relative to the base of the tree.
85
        :param ids: If set, use these instead of automatically generated ids.
86
            Must be the same length as the list of files, but may
87
            contain None for ids that are to be autogenerated.
88
        :param kinds: Optional parameter to specify the kinds to be used for
89
            each file.
90
91
        TODO: Perhaps callback with the ids and paths as they're added.
92
        """
6695.3.1 by Martin
Remove remaining uses of basestring from the codebase
93
        if isinstance(files, (str, text_type)):
3376.2.4 by Martin Pool
Remove every assert statement from bzrlib!
94
            # XXX: Passing a single string is inconsistent and should be
95
            # deprecated.
6695.3.1 by Martin
Remove remaining uses of basestring from the codebase
96
            if not (ids is None or isinstance(ids, (str, text_type))):
3376.2.4 by Martin Pool
Remove every assert statement from bzrlib!
97
                raise AssertionError()
6695.3.1 by Martin
Remove remaining uses of basestring from the codebase
98
            if not (kinds is None or isinstance(kinds, (str, text_type))):
3376.2.4 by Martin Pool
Remove every assert statement from bzrlib!
99
                raise AssertionError()
1986.1.2 by Robert Collins
Various changes to allow non-workingtree specific tests to run entirely
100
            files = [files]
101
            if ids is not None:
102
                ids = [ids]
103
            if kinds is not None:
104
                kinds = [kinds]
105
2323.4.2 by Robert Collins
Fix the behaviour of dirstate optimised iter_changes recursing its disk iterator into subtrees inappropriately.
106
        files = [path.strip('/') for path in files]
107
1986.1.2 by Robert Collins
Various changes to allow non-workingtree specific tests to run entirely
108
        if ids is None:
109
            ids = [None] * len(files)
110
        else:
3376.2.4 by Martin Pool
Remove every assert statement from bzrlib!
111
            if not (len(ids) == len(files)):
112
                raise AssertionError()
1986.1.2 by Robert Collins
Various changes to allow non-workingtree specific tests to run entirely
113
        if kinds is None:
114
            kinds = [None] * len(files)
3376.2.4 by Martin Pool
Remove every assert statement from bzrlib!
115
        elif not len(kinds) == len(files):
116
            raise AssertionError()
6754.8.18 by Jelmer Vernooij
Get rid of lock_tree_write.
117
        with self.lock_tree_write():
118
            for f in files:
119
                # generic constraint checks:
120
                if self.is_control_filename(f):
121
                    raise errors.ForbiddenControlFileError(filename=f)
122
                fp = osutils.splitpath(f)
123
            # fill out file kinds for all files [not needed when we stop
124
            # caring about the instantaneous file kind within a uncommmitted tree
125
            #
126
            self._gather_kinds(files, kinds)
127
            self._add(files, ids, kinds)
1986.1.2 by Robert Collins
Various changes to allow non-workingtree specific tests to run entirely
128
2255.6.8 by Aaron Bentley
Merge refactoring of add_reference
129
    def add_reference(self, sub_tree):
130
        """Add a TreeReference to the tree, pointing at sub_tree"""
131
        raise errors.UnsupportedOperation(self.add_reference, self)
132
133
    def _add_reference(self, sub_tree):
134
        """Standard add_reference implementation, for use by subclasses"""
135
        try:
136
            sub_tree_path = self.relpath(sub_tree.basedir)
137
        except errors.PathNotChild:
138
            raise errors.BadReferenceTarget(self, sub_tree,
139
                                            'Target not inside tree.')
140
        sub_tree_id = sub_tree.get_root_id()
141
        if sub_tree_id == self.get_root_id():
142
            raise errors.BadReferenceTarget(self, sub_tree,
143
                                     'Trees have the same root id.')
5967.7.1 by Martin Pool
Deprecate __contains__ on Tree and Inventory
144
        if self.has_id(sub_tree_id):
2255.6.8 by Aaron Bentley
Merge refactoring of add_reference
145
            raise errors.BadReferenceTarget(self, sub_tree,
146
                                            'Root id already present in tree')
147
        self._add([sub_tree_path], [sub_tree_id], ['tree-reference'])
148
1986.1.2 by Robert Collins
Various changes to allow non-workingtree specific tests to run entirely
149
    def _add(self, files, ids, kinds):
2255.6.8 by Aaron Bentley
Merge refactoring of add_reference
150
        """Helper function for add - updates the inventory.
151
152
        :param files: sequence of pathnames, relative to the tree root
153
        :param ids: sequence of suggested ids for the files (may be None)
154
        :param kinds: sequence of  inventory kinds of the files (i.e. may
155
            contain "tree-reference")
156
        """
1986.1.2 by Robert Collins
Various changes to allow non-workingtree specific tests to run entirely
157
        raise NotImplementedError(self._add)
158
2376.2.1 by Aaron Bentley
Implement MutableTree.apply_inventory_delta
159
    def apply_inventory_delta(self, changes):
160
        """Apply changes to the inventory as an atomic operation.
161
2865.1.1 by Robert Collins
Create new mutable tree method update_to_one_parent_via_delta for eventual use by commit.
162
        :param changes: An inventory delta to apply to the working tree's
163
            inventory.
164
        :return None:
165
        :seealso Inventory.apply_delta: For details on the changes parameter.
2376.2.9 by Aaron Bentley
Cleanup from review
166
        """
5777.4.1 by Jelmer Vernooij
Split inventory-specific code out of MutableTree into MutableInventoryTree.
167
        raise NotImplementedError(self.apply_inventory_delta)
2376.2.1 by Aaron Bentley
Implement MutableTree.apply_inventory_delta
168
6630.1.1 by Jelmer Vernooij
Remove deprecated functionality.
169
    def commit(self, message=None, revprops=None, *args, **kwargs):
1986.1.3 by Robert Collins
Merge bzr.dev.
170
        # avoid circular imports
6622.1.34 by Jelmer Vernooij
Rename brzlib => breezy.
171
        from breezy import commit
3565.6.9 by Marius Kruger
Jump through hoops not to open multiple connections when committing to a bound branch.
172
        possible_master_transports=[]
6754.8.17 by Jelmer Vernooij
Remove uses of needs_write_lock.
173
        with self.lock_write():
174
            revprops = commit.Commit.update_revprops(
175
                    revprops,
176
                    self.branch,
177
                    kwargs.pop('authors', None),
178
                    kwargs.get('local', False),
179
                    possible_master_transports)
180
            # args for wt.commit start at message from the Commit.commit method,
181
            args = (message, ) + args
182
            for hook in MutableTree.hooks['start_commit']:
183
                hook(self)
184
            committed_id = commit.Commit().commit(working_tree=self,
185
                revprops=revprops,
186
                possible_master_transports=possible_master_transports,
187
                *args, **kwargs)
188
            post_hook_params = PostCommitHookParams(self)
189
            for hook in MutableTree.hooks['post_commit']:
190
                hook(post_hook_params)
191
            return committed_id
1986.1.2 by Robert Collins
Various changes to allow non-workingtree specific tests to run entirely
192
193
    def _gather_kinds(self, files, kinds):
194
        """Helper function for add - sets the entries of kinds."""
195
        raise NotImplementedError(self._gather_kinds)
196
4721.3.2 by Vincent Ladeuil
Simplify mutable_tree.has_changes() and update call sites.
197
    def has_changes(self, _from_tree=None):
198
        """Quickly check that the tree contains at least one commitable change.
199
200
        :param _from_tree: tree to compare against to find changes (default to
201
            the basis tree and is intended to be used by tests).
4503.1.3 by Vincent Ladeuil
Take review comments into account.
202
203
        :return: True if a change is found. False otherwise
204
        """
6754.8.16 by Jelmer Vernooij
Get rid of all uses of needs_read_lock
205
        with self.lock_read():
206
            # Check pending merges
207
            if len(self.get_parent_ids()) > 1:
208
                return True
209
            if _from_tree is None:
210
                _from_tree = self.basis_tree()
211
            changes = self.iter_changes(_from_tree)
212
            try:
6634.2.1 by Martin
Apply 2to3 next fixer and make compatible
213
                change = next(changes)
6754.8.16 by Jelmer Vernooij
Get rid of all uses of needs_read_lock
214
                # Exclude root (talk about black magic... --vila 20090629)
215
                if change[4] == (None, None):
216
                    change = next(changes)
217
                return True
218
            except StopIteration:
219
                # No changes
220
                return False
4503.1.3 by Vincent Ladeuil
Take review comments into account.
221
5171.2.2 by Vincent Ladeuil
Explain that the uncommitted changes are not processed when
222
    def check_changed_or_out_of_date(self, strict, opt_name,
223
                                     more_error, more_warning):
5147.2.2 by Vincent Ladeuil
Fix bug #519319 by defaulting to a warning for dirty trees.
224
        """Check the tree for uncommitted changes and branch synchronization.
225
226
        If strict is None and not set in the config files, a warning is issued.
227
        If strict is True, an error is raised.
228
        If strict is False, no checks are done and no warning is issued.
229
230
        :param strict: True, False or None, searched in branch config if None.
231
232
        :param opt_name: strict option name to search in config file.
233
5171.2.2 by Vincent Ladeuil
Explain that the uncommitted changes are not processed when
234
        :param more_error: Details about how to avoid the check.
235
236
        :param more_warning: Details about what is happening.
5147.2.2 by Vincent Ladeuil
Fix bug #519319 by defaulting to a warning for dirty trees.
237
        """
6754.8.16 by Jelmer Vernooij
Get rid of all uses of needs_read_lock
238
        with self.lock_read():
239
            if strict is None:
240
                strict = self.branch.get_config_stack().get(opt_name)
241
            if strict is not False:
242
                err_class = None
243
                if (self.has_changes()):
244
                    err_class = errors.UncommittedChanges
245
                elif self.last_revision() != self.branch.last_revision():
246
                    # The tree has lost sync with its branch, there is little
247
                    # chance that the user is aware of it but he can still
248
                    # force the action with --no-strict
249
                    err_class = errors.OutOfDateTree
250
                if err_class is not None:
251
                    if strict is None:
252
                        err = err_class(self, more=more_warning)
253
                        # We don't want to interrupt the user if he expressed
254
                        # no preference about strict.
255
                        trace.warning('%s', err._format())
256
                    else:
257
                        err = err_class(self, more=more_error)
258
                        raise err
5147.2.2 by Vincent Ladeuil
Fix bug #519319 by defaulting to a warning for dirty trees.
259
1986.1.6 by Robert Collins
Add MemoryTree.last_revision.
260
    def last_revision(self):
1986.1.7 by Robert Collins
Merge bzr.dev.
261
        """Return the revision id of the last commit performed in this tree.
262
263
        In early tree formats the result of last_revision is the same as the
264
        branch last_revision, but that is no longer the case for modern tree
265
        formats.
3943.8.1 by Marius Kruger
remove all trailing whitespace from bzr source
266
1986.1.7 by Robert Collins
Merge bzr.dev.
267
        last_revision returns the left most parent id, or None if there are no
268
        parents.
269
270
        last_revision was deprecated as of 0.11. Please use get_parent_ids
271
        instead.
272
        """
1986.1.6 by Robert Collins
Add MemoryTree.last_revision.
273
        raise NotImplementedError(self.last_revision)
274
1986.1.8 by Robert Collins
Update to bzr.dev, which involves adding lock_tree_write to MutableTree and MemoryTree.
275
    def lock_tree_write(self):
276
        """Lock the working tree for write, and the branch for read.
277
278
        This is useful for operations which only need to mutate the working
279
        tree. Taking out branch write locks is a relatively expensive process
280
        and may fail if the branch is on read only media. So branch write locks
281
        should only be taken out when we are modifying branch data - such as in
282
        operations like commit, pull, uncommit and update.
283
        """
284
        raise NotImplementedError(self.lock_tree_write)
285
1986.1.2 by Robert Collins
Various changes to allow non-workingtree specific tests to run entirely
286
    def lock_write(self):
287
        """Lock the tree and its branch. This allows mutating calls to be made.
288
3943.8.1 by Marius Kruger
remove all trailing whitespace from bzr source
289
        Some mutating methods will take out implicit write locks, but in
1986.1.2 by Robert Collins
Various changes to allow non-workingtree specific tests to run entirely
290
        general you should always obtain a write lock before calling mutating
291
        methods on a tree.
292
        """
293
        raise NotImplementedError(self.lock_write)
294
295
    def mkdir(self, path, file_id=None):
296
        """Create a directory in the tree. if file_id is None, one is assigned.
297
298
        :param path: A unicode file path.
299
        :param file_id: An optional file-id.
300
        :return: the file id of the new directory.
301
        """
302
        raise NotImplementedError(self.mkdir)
303
6621.20.1 by Martin
Run 2to3 tuple_params fixer and tidy up.
304
    def _observed_sha1(self, file_id, path, sha_and_stat):
3709.3.1 by Robert Collins
First cut - make it work - at updating the tree stat cache during commit.
305
        """Tell the tree we have observed a paths sha1.
306
307
        The intent of this function is to allow trees that have a hashcache to
3709.3.2 by Robert Collins
Race-free stat-fingerprint updating during commit via a new method get_file_with_stat.
308
        update the hashcache during commit. If the observed file is too new
309
        (based on the stat_value) to be safely hash-cached the tree will ignore
3943.8.1 by Marius Kruger
remove all trailing whitespace from bzr source
310
        it.
3709.3.1 by Robert Collins
First cut - make it work - at updating the tree stat cache during commit.
311
312
        The default implementation does nothing.
313
314
        :param file_id: The file id
315
        :param path: The file path
6621.20.1 by Martin
Run 2to3 tuple_params fixer and tidy up.
316
        :param sha_and_stat: The sha 1 and stat result observed.
3709.3.1 by Robert Collins
First cut - make it work - at updating the tree stat cache during commit.
317
        :return: None
318
        """
319
3394.2.1 by Ian Clatworthy
add docstring for put_file_bytes_non_atomic
320
    def put_file_bytes_non_atomic(self, file_id, bytes):
321
        """Update the content of a file in the tree.
3943.8.1 by Marius Kruger
remove all trailing whitespace from bzr source
322
3394.2.1 by Ian Clatworthy
add docstring for put_file_bytes_non_atomic
323
        Note that the file is written in-place rather than being
324
        written to a temporary location and renamed. As a consequence,
325
        readers can potentially see the file half-written.
326
327
        :param file_id: file-id of the file
328
        :param bytes: the new file contents
329
        """
330
        raise NotImplementedError(self.put_file_bytes_non_atomic)
331
2418.5.1 by John Arbash Meinel
Make a Branch helper which can create a very basic MemoryTree with history.
332
    def set_parent_ids(self, revision_ids, allow_leftmost_as_ghost=False):
333
        """Set the parents ids of the working tree.
334
335
        :param revision_ids: A list of revision_ids.
336
        """
337
        raise NotImplementedError(self.set_parent_ids)
338
1986.1.2 by Robert Collins
Various changes to allow non-workingtree specific tests to run entirely
339
    def set_parent_trees(self, parents_list, allow_leftmost_as_ghost=False):
340
        """Set the parents of the working tree.
341
3943.8.1 by Marius Kruger
remove all trailing whitespace from bzr source
342
        :param parents_list: A list of (revision_id, tree) tuples.
1986.1.2 by Robert Collins
Various changes to allow non-workingtree specific tests to run entirely
343
            If tree is None, then that element is treated as an unreachable
344
            parent tree - i.e. a ghost.
345
        """
346
        raise NotImplementedError(self.set_parent_trees)
2568.2.4 by Robert Collins
* ``bzrlib.add.smart_add`` and ``bzrlib.add.smart_add_tree`` are now
347
5777.4.1 by Jelmer Vernooij
Split inventory-specific code out of MutableTree into MutableInventoryTree.
348
    def smart_add(self, file_list, recurse=True, action=None, save=True):
349
        """Version file_list, optionally recursing into directories.
350
351
        This is designed more towards DWIM for humans than API clarity.
352
        For the specific behaviour see the help for cmd_add().
353
354
        :param file_list: List of zero or more paths.  *NB: these are 
355
            interpreted relative to the process cwd, not relative to the 
356
            tree.*  (Add and most other tree methods use tree-relative
357
            paths.)
358
        :param action: A reporter to be called with the inventory, parent_ie,
359
            path and kind of the path being added. It may return a file_id if
360
            a specific one should be used.
361
        :param save: Save the inventory after completing the adds. If False
362
            this provides dry-run functionality by doing the add and not saving
363
            the inventory.
364
        :return: A tuple - files_added, ignored_files. files_added is the count
365
            of added files, and ignored_files is a dict mapping files that were
366
            ignored to the rule that caused them to be ignored.
367
        """
368
        raise NotImplementedError(self.smart_add)
369
5870.1.42 by Jelmer Vernooij
Review feedback from John.
370
5870.1.31 by Jelmer Vernooij
Move smart_add into a helper.
371
class MutableTreeHooks(hooks.Hooks):
372
    """A dictionary mapping a hook name to a list of callables for mutabletree
373
    hooks.
374
    """
375
376
    def __init__(self):
377
        """Create the default hooks.
378
379
        """
6622.1.34 by Jelmer Vernooij
Rename brzlib => breezy.
380
        hooks.Hooks.__init__(self, "breezy.mutabletree", "MutableTree.hooks")
5870.1.31 by Jelmer Vernooij
Move smart_add into a helper.
381
        self.add_hook('start_commit',
382
            "Called before a commit is performed on a tree. The start commit "
383
            "hook is able to change the tree before the commit takes place. "
6622.1.34 by Jelmer Vernooij
Rename brzlib => breezy.
384
            "start_commit is called with the breezy.mutabletree.MutableTree "
5870.1.31 by Jelmer Vernooij
Move smart_add into a helper.
385
            "that the commit is being performed on.", (1, 4))
386
        self.add_hook('post_commit',
387
            "Called after a commit is performed on a tree. The hook is "
6622.1.34 by Jelmer Vernooij
Rename brzlib => breezy.
388
            "called with a breezy.mutabletree.PostCommitHookParams object. "
5870.1.31 by Jelmer Vernooij
Move smart_add into a helper.
389
            "The mutable tree the commit was performed on is available via "
390
            "the mutable_tree attribute of that object.", (2, 0))
6434.2.1 by Jelmer Vernooij
Add pre_transform/post_transform hooks.
391
        self.add_hook('pre_transform',
392
            "Called before a tree transform on this tree. The hook is called "
6434.2.2 by Jelmer Vernooij
Add hooks for tree transforms.
393
            "with the tree that is being transformed and the transform.",
394
            (2, 5))
6435.1.1 by Jelmer Vernooij
Add post_build_tree hook.
395
        self.add_hook('post_build_tree',
396
            "Called after a completely new tree is built. The hook is "
397
            "called with the tree as its only argument.", (2, 5))
6434.2.1 by Jelmer Vernooij
Add pre_transform/post_transform hooks.
398
        self.add_hook('post_transform',
399
            "Called after a tree transform has been performed on a tree. "
6434.2.2 by Jelmer Vernooij
Add hooks for tree transforms.
400
            "The hook is called with the tree that is being transformed and "
401
            "the transform.",
6434.2.1 by Jelmer Vernooij
Add pre_transform/post_transform hooks.
402
            (2, 5))
5870.1.31 by Jelmer Vernooij
Move smart_add into a helper.
403
404
# install the default hooks into the MutableTree class.
405
MutableTree.hooks = MutableTreeHooks()
406
407
408
class PostCommitHookParams(object):
409
    """Parameters for the post_commit hook.
410
411
    To access the parameters, use the following attributes:
412
413
    * mutable_tree - the MutableTree object
414
    """
415
416
    def __init__(self, mutable_tree):
417
        """Create the parameters for the post_commit hook."""
418
        self.mutable_tree = mutable_tree