226
227
revprops=revprops,
227
228
possible_master_transports=possible_master_transports,
230
post_hook_params = PostCommitHookParams(self)
231
for hook in MutableTree.hooks['post_commit']:
232
hook(post_hook_params)
229
233
return committed_id
231
235
def _gather_kinds(self, files, kinds):
424
428
dirs_to_add.append((path, None))
425
429
prev_dir = path.raw_path
431
illegalpath_re = re.compile(r'[\r\n]')
427
432
# dirs_to_add is initialised to a list of directories, but as we scan
428
433
# directories we append files to it.
429
434
# XXX: We should determine kind of files when we scan them rather than
440
445
if not InventoryEntry.versionable_kind(kind):
441
446
warning("skipping %s (can't add file of kind '%s')", abspath, kind)
448
if illegalpath_re.search(directory.raw_path):
449
warning("skipping %r (contains \\n or \\r)" % abspath)
444
452
if parent_ie is not None:
445
453
versioned = directory.base_path in parent_ie.children
581
589
self.create_hook(hooks.HookPoint('start_commit',
582
590
"Called before a commit is performed on a tree. The start commit "
583
591
"hook is able to change the tree before the commit takes place. "
584
"start_commit is called with the bzrlib.tree.MutableTree that the "
585
"commit is being performed on.", (1, 4), None))
592
"start_commit is called with the bzrlib.mutabletree.MutableTree "
593
"that the commit is being performed on.", (1, 4), None))
594
self.create_hook(hooks.HookPoint('post_commit',
595
"Called after a commit is performed on a tree. The hook is "
596
"called with a bzrlib.mutabletree.PostCommitHookParams object. "
597
"The mutable tree the commit was performed on is available via "
598
"the mutable_tree attribute of that object.", (2, 0), None))
588
601
# install the default hooks into the MutableTree class.
589
602
MutableTree.hooks = MutableTreeHooks()
605
class PostCommitHookParams(object):
606
"""Parameters for the post_commit hook.
608
To access the parameters, use the following attributes:
610
* mutable_tree - the MutableTree object
613
def __init__(self, mutable_tree):
614
"""Create the parameters for the post_commit hook."""
615
self.mutable_tree = mutable_tree
592
618
class _FastPath(object):
593
619
"""A path object with fast accessors for things like basename."""