63
63
A mutable tree always has an associated Branch and ControlDir object - the
64
64
branch and bzrdir attributes.
66
67
def __init__(self, *args, **kw):
67
68
super(MutableTree, self).__init__(*args, **kw)
68
69
# Is this tree on a case-insensitive or case-preserving file-system?
156
157
def commit(self, message=None, revprops=None, *args, **kwargs):
157
158
# avoid circular imports
158
159
from breezy import commit
159
possible_master_transports=[]
160
possible_master_transports = []
160
161
with self.lock_write():
161
162
revprops = commit.Commit.update_revprops(
164
kwargs.pop('authors', None),
165
kwargs.get('local', False),
166
possible_master_transports)
165
kwargs.pop('authors', None),
166
kwargs.get('local', False),
167
possible_master_transports)
167
168
# args for wt.commit start at message from the Commit.commit method,
168
169
args = (message, ) + args
169
170
for hook in MutableTree.hooks['start_commit']:
171
172
committed_id = commit.Commit().commit(working_tree=self,
173
possible_master_transports=possible_master_transports,
174
possible_master_transports=possible_master_transports,
175
176
post_hook_params = PostCommitHookParams(self)
176
177
for hook in MutableTree.hooks['post_commit']:
177
178
hook(post_hook_params)
337
338
This is designed more towards DWIM for humans than API clarity.
338
339
For the specific behaviour see the help for cmd_add().
340
:param file_list: List of zero or more paths. *NB: these are
341
interpreted relative to the process cwd, not relative to the
341
:param file_list: List of zero or more paths. *NB: these are
342
interpreted relative to the process cwd, not relative to the
342
343
tree.* (Add and most other tree methods use tree-relative
344
345
:param action: A reporter to be called with the working tree, parent_ie,
398
399
hooks.Hooks.__init__(self, "breezy.mutabletree", "MutableTree.hooks")
399
400
self.add_hook('start_commit',
400
"Called before a commit is performed on a tree. The start commit "
401
"hook is able to change the tree before the commit takes place. "
402
"start_commit is called with the breezy.mutabletree.MutableTree "
403
"that the commit is being performed on.", (1, 4))
401
"Called before a commit is performed on a tree. The start commit "
402
"hook is able to change the tree before the commit takes place. "
403
"start_commit is called with the breezy.mutabletree.MutableTree "
404
"that the commit is being performed on.", (1, 4))
404
405
self.add_hook('post_commit',
405
"Called after a commit is performed on a tree. The hook is "
406
"called with a breezy.mutabletree.PostCommitHookParams object. "
407
"The mutable tree the commit was performed on is available via "
408
"the mutable_tree attribute of that object.", (2, 0))
406
"Called after a commit is performed on a tree. The hook is "
407
"called with a breezy.mutabletree.PostCommitHookParams object. "
408
"The mutable tree the commit was performed on is available via "
409
"the mutable_tree attribute of that object.", (2, 0))
409
410
self.add_hook('pre_transform',
410
"Called before a tree transform on this tree. The hook is called "
411
"with the tree that is being transformed and the transform.",
411
"Called before a tree transform on this tree. The hook is called "
412
"with the tree that is being transformed and the transform.",
413
414
self.add_hook('post_build_tree',
414
"Called after a completely new tree is built. The hook is "
415
"called with the tree as its only argument.", (2, 5))
415
"Called after a completely new tree is built. The hook is "
416
"called with the tree as its only argument.", (2, 5))
416
417
self.add_hook('post_transform',
417
"Called after a tree transform has been performed on a tree. "
418
"The hook is called with the tree that is being transformed and "
418
"Called after a tree transform has been performed on a tree. "
419
"The hook is called with the tree that is being transformed and "
422
424
# install the default hooks into the MutableTree class.
423
425
MutableTree.hooks = MutableTreeHooks()