/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: Martin
  • Date: 2018-11-16 19:09:31 UTC
  • mfrom: (7175 work)
  • mto: This revision was merged to the branch mainline in revision 7177.
  • Revision ID: gzlist@googlemail.com-20181116190931-rmh7pk2an1zuecby
Merge trunk to resolve conflicts

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)
288
289
        """
289
290
        raise NotImplementedError(self.mkdir)
290
291
 
291
 
    def _observed_sha1(self, file_id, path, sha_and_stat):
 
292
    def _observed_sha1(self, path, sha_and_stat):
292
293
        """Tell the tree we have observed a paths sha1.
293
294
 
294
295
        The intent of this function is to allow trees that have a hashcache to
298
299
 
299
300
        The default implementation does nothing.
300
301
 
301
 
        :param file_id: The file id
302
302
        :param path: The file path
303
303
        :param sha_and_stat: The sha 1 and stat result observed.
304
304
        :return: None
338
338
        This is designed more towards DWIM for humans than API clarity.
339
339
        For the specific behaviour see the help for cmd_add().
340
340
 
341
 
        :param file_list: List of zero or more paths.  *NB: these are 
342
 
            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
343
343
            tree.*  (Add and most other tree methods use tree-relative
344
344
            paths.)
345
345
        :param action: A reporter to be called with the working tree, parent_ie,
398
398
        """
399
399
        hooks.Hooks.__init__(self, "breezy.mutabletree", "MutableTree.hooks")
400
400
        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))
 
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))
405
405
        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))
 
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))
410
410
        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))
 
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))
414
414
        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))
 
415
                      "Called after a completely new tree is built. The hook is "
 
416
                      "called with the tree as its only argument.", (2, 5))
417
417
        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))
 
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))
 
422
 
422
423
 
423
424
# install the default hooks into the MutableTree class.
424
425
MutableTree.hooks = MutableTreeHooks()