/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/treebuilder.py

  • Committer: Martin
  • Date: 2017-08-26 16:16:11 UTC
  • mto: This revision was merged to the branch mainline in revision 6763.
  • Revision ID: gzlist@googlemail.com-20170826161611-gzjgbcvq03u9vr38
One last dict.iteritems() in hooks tests

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2006 Canonical Ltd
 
1
# Copyright (C) 2006, 2008, 2009, 2010 Canonical Ltd
2
2
#
3
3
# This program is free software; you can redistribute it and/or modify
4
4
# it under the terms of the GNU General Public License as published by
16
16
 
17
17
"""TreeBuilder helper class.
18
18
 
19
 
TreeBuilders are used to build trees of various shapres or properties. This
 
19
TreeBuilders are used to build trees of various shapes or properties. This
20
20
can be extremely useful in testing for instance.
21
21
"""
22
22
 
23
 
from bzrlib import errors
 
23
from __future__ import absolute_import
 
24
 
 
25
from . import errors
 
26
 
 
27
 
 
28
class AlreadyBuilding(errors.BzrError):
 
29
 
 
30
    _fmt = "The tree builder is already building a tree."
 
31
 
 
32
 
 
33
class NotBuilding(errors.BzrError):
 
34
 
 
35
    _fmt = "Not currently building a tree."
24
36
 
25
37
 
26
38
class TreeBuilder(object):
57
69
    def _ensure_building(self):
58
70
        """Raise NotBuilding if there is no current tree being built."""
59
71
        if self._tree is None:
60
 
            raise errors.NotBuilding
 
72
            raise NotBuilding
61
73
 
62
74
    def finish_tree(self):
63
75
        """Finish building the current tree."""
73
85
            MutableTree interface.
74
86
        """
75
87
        if self._tree is not None:
76
 
            raise errors.AlreadyBuilding
 
88
            raise AlreadyBuilding
77
89
        self._tree = tree
78
90
        self._tree.lock_tree_write()