/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to breezy/mutabletree.py

  • Committer: Jelmer Vernooij
  • Date: 2018-11-11 04:08:32 UTC
  • mto: (7143.16.20 even-more-cleanups)
  • mto: This revision was merged to the branch mainline in revision 7175.
  • Revision ID: jelmer@jelmer.uk-20181111040832-nsljjynzzwmznf3h
Run autopep8.

Show diffs side-by-side

added added

removed removed

Lines of Context:
63
63
    A mutable tree always has an associated Branch and ControlDir object - the
64
64
    branch and bzrdir attributes.
65
65
    """
 
66
 
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(
162
 
                    revprops,
163
 
                    self.branch,
164
 
                    kwargs.pop('authors', None),
165
 
                    kwargs.get('local', False),
166
 
                    possible_master_transports)
 
163
                revprops,
 
164
                self.branch,
 
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']:
170
171
                hook(self)
171
172
            committed_id = commit.Commit().commit(working_tree=self,
172
 
                revprops=revprops,
173
 
                possible_master_transports=possible_master_transports,
174
 
                *args, **kwargs)
 
173
                                                  revprops=revprops,
 
174
                                                  possible_master_transports=possible_master_transports,
 
175
                                                  *args, **kwargs)
175
176
            post_hook_params = PostCommitHookParams(self)
176
177
            for hook in MutableTree.hooks['post_commit']:
177
178
                hook(post_hook_params)
398
399
        """
399
400
        hooks.Hooks.__init__(self, "breezy.mutabletree", "MutableTree.hooks")
400
401
        self.add_hook('start_commit',
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))
 
402
                      "Called before a commit is performed on a tree. The start commit "
 
403
                      "hook is able to change the tree before the commit takes place. "
 
404
                      "start_commit is called with the breezy.mutabletree.MutableTree "
 
405
                      "that the commit is being performed on.", (1, 4))
405
406
        self.add_hook('post_commit',
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))
 
407
                      "Called after a commit is performed on a tree. The hook is "
 
408
                      "called with a breezy.mutabletree.PostCommitHookParams object. "
 
409
                      "The mutable tree the commit was performed on is available via "
 
410
                      "the mutable_tree attribute of that object.", (2, 0))
410
411
        self.add_hook('pre_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
 
            (2, 5))
 
412
                      "Called before a tree transform on this tree. The hook is called "
 
413
                      "with the tree that is being transformed and the transform.",
 
414
                      (2, 5))
414
415
        self.add_hook('post_build_tree',
415
 
            "Called after a completely new tree is built. The hook is "
416
 
            "called with the tree as its only argument.", (2, 5))
 
416
                      "Called after a completely new tree is built. The hook is "
 
417
                      "called with the tree as its only argument.", (2, 5))
417
418
        self.add_hook('post_transform',
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 "
420
 
            "the transform.",
421
 
            (2, 5))
 
419
                      "Called after a tree transform has been performed on a tree. "
 
420
                      "The hook is called with the tree that is being transformed and "
 
421
                      "the transform.",
 
422
                      (2, 5))
 
423
 
422
424
 
423
425
# install the default hooks into the MutableTree class.
424
426
MutableTree.hooks = MutableTreeHooks()