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

  • Committer: Jelmer Vernooij
  • Date: 2017-05-21 18:10:28 UTC
  • mto: This revision was merged to the branch mainline in revision 6623.
  • Revision ID: jelmer@jelmer.uk-20170521181028-zn04pdfw0od9hfj3
Rename brzlib => breezy.

Show diffs side-by-side

added added

removed removed

Lines of Context:
35
35
import os
36
36
import sys
37
37
 
38
 
from brzlib.lazy_import import lazy_import
 
38
from breezy.lazy_import import lazy_import
39
39
lazy_import(globals(), """
40
40
from bisect import bisect_left
41
41
import collections
45
45
import stat
46
46
import re
47
47
 
48
 
from brzlib import (
 
48
from breezy import (
49
49
    branch,
50
50
    conflicts as _mod_conflicts,
51
51
    controldir,
70
70
    )
71
71
""")
72
72
 
73
 
# Explicitly import brzlib.bzrdir so that the BzrProber
 
73
# Explicitly import breezy.bzrdir so that the BzrProber
74
74
# is guaranteed to be registered.
75
 
from brzlib import (
 
75
from breezy import (
76
76
    bzrdir,
77
77
    symbol_versioning,
78
78
    )
79
79
 
80
 
from brzlib.decorators import needs_read_lock, needs_write_lock
81
 
from brzlib.i18n import gettext
82
 
from brzlib.lock import LogicalLockResult
83
 
import brzlib.mutabletree
84
 
from brzlib.mutabletree import needs_tree_write_lock
85
 
from brzlib import osutils
86
 
from brzlib.osutils import (
 
80
from breezy.decorators import needs_read_lock, needs_write_lock
 
81
from breezy.i18n import gettext
 
82
from breezy.lock import LogicalLockResult
 
83
import breezy.mutabletree
 
84
from breezy.mutabletree import needs_tree_write_lock
 
85
from breezy import osutils
 
86
from breezy.osutils import (
87
87
    file_kind,
88
88
    isdir,
89
89
    normpath,
92
92
    safe_unicode,
93
93
    splitpath,
94
94
    )
95
 
from brzlib.trace import mutter, note
96
 
from brzlib.revision import CURRENT_REVISION
97
 
from brzlib.symbol_versioning import (
 
95
from breezy.trace import mutter, note
 
96
from breezy.revision import CURRENT_REVISION
 
97
from breezy.symbol_versioning import (
98
98
    deprecated_passed,
99
99
    DEPRECATED_PARAMETER,
100
100
    )
164
164
        return ''
165
165
 
166
166
 
167
 
class WorkingTree(brzlib.mutabletree.MutableTree,
 
167
class WorkingTree(breezy.mutabletree.MutableTree,
168
168
    controldir.ControlComponent):
169
169
    """Working copy tree.
170
170
 
265
265
    def get_config_stack(self):
266
266
        """Retrieve the config stack for this tree.
267
267
 
268
 
        :return: A ``brzlib.config.Stack``
 
268
        :return: A ``breezy.config.Stack``
269
269
        """
270
270
        # For the moment, just provide the branch config stack.
271
271
        return self.branch.get_config_stack()
784
784
            of the branch when it is supplied. If None, to_revision defaults to
785
785
            branch.last_revision().
786
786
        """
787
 
        from brzlib.merge import Merger, Merge3Merger
 
787
        from breezy.merge import Merger, Merge3Merger
788
788
        merger = Merger(self.branch, this_tree=self)
789
789
        # check that there are no local alterations
790
790
        if not force and self.has_changes():
1083
1083
        ignore_globs = set()
1084
1084
        ignore_globs.update(ignores.get_runtime_ignores())
1085
1085
        ignore_globs.update(ignores.get_user_ignores())
1086
 
        if self.has_filename(brzlib.IGNORE_FILENAME):
1087
 
            f = self.get_file_byname(brzlib.IGNORE_FILENAME)
 
1086
        if self.has_filename(breezy.IGNORE_FILENAME):
 
1087
            f = self.get_file_byname(breezy.IGNORE_FILENAME)
1088
1088
            try:
1089
1089
                ignore_globs.update(ignores.parse_ignore_file(f))
1090
1090
            finally:
1166
1166
 
1167
1167
        This also locks the branch, and can be unlocked via self.unlock().
1168
1168
 
1169
 
        :return: A brzlib.lock.LogicalLockResult.
 
1169
        :return: A breezy.lock.LogicalLockResult.
1170
1170
        """
1171
1171
        raise NotImplementedError(self.lock_read)
1172
1172
 
1173
1173
    def lock_tree_write(self):
1174
1174
        """See MutableTree.lock_tree_write, and WorkingTree.unlock.
1175
1175
 
1176
 
        :return: A brzlib.lock.LogicalLockResult.
 
1176
        :return: A breezy.lock.LogicalLockResult.
1177
1177
        """
1178
1178
        raise NotImplementedError(self.lock_tree_write)
1179
1179
 
1180
1180
    def lock_write(self):
1181
1181
        """See MutableTree.lock_write, and WorkingTree.unlock.
1182
1182
 
1183
 
        :return: A brzlib.lock.LogicalLockResult.
 
1183
        :return: A breezy.lock.LogicalLockResult.
1184
1184
        """
1185
1185
        raise NotImplementedError(self.lock_write)
1186
1186
 
1330
1330
    @needs_tree_write_lock
1331
1331
    def revert(self, filenames=None, old_tree=None, backups=True,
1332
1332
               pb=None, report_changes=False):
1333
 
        from brzlib.conflicts import resolve
 
1333
        from breezy.conflicts import resolve
1334
1334
        if old_tree is None:
1335
1335
            basis_tree = self.basis_tree()
1336
1336
            basis_tree.lock_read()
1768
1768
 
1769
1769
    def get_shelf_manager(self):
1770
1770
        """Return the ShelfManager for this WorkingTree."""
1771
 
        from brzlib.shelf import ShelfManager
 
1771
        from breezy.shelf import ShelfManager
1772
1772
        return ShelfManager(self, self._transport)
1773
1773
 
1774
1774
 
1775
1775
class InventoryWorkingTree(WorkingTree,
1776
 
        brzlib.mutabletree.MutableInventoryTree):
 
1776
        breezy.mutabletree.MutableInventoryTree):
1777
1777
    """Base class for working trees that are inventory-oriented.
1778
1778
 
1779
1779
    The inventory is held in the `Branch` working-inventory, and the
1866
1866
 
1867
1867
        This also locks the branch, and can be unlocked via self.unlock().
1868
1868
 
1869
 
        :return: A brzlib.lock.LogicalLockResult.
 
1869
        :return: A breezy.lock.LogicalLockResult.
1870
1870
        """
1871
1871
        if not self.is_locked():
1872
1872
            self._reset_data()
1881
1881
    def lock_tree_write(self):
1882
1882
        """See MutableTree.lock_tree_write, and WorkingTree.unlock.
1883
1883
 
1884
 
        :return: A brzlib.lock.LogicalLockResult.
 
1884
        :return: A breezy.lock.LogicalLockResult.
1885
1885
        """
1886
1886
        if not self.is_locked():
1887
1887
            self._reset_data()
1896
1896
    def lock_write(self):
1897
1897
        """See MutableTree.lock_write, and WorkingTree.unlock.
1898
1898
 
1899
 
        :return: A brzlib.lock.LogicalLockResult.
 
1899
        :return: A breezy.lock.LogicalLockResult.
1900
1900
        """
1901
1901
        if not self.is_locked():
1902
1902
            self._reset_data()
1921
1921
    # new Inventory object.
1922
1922
    @needs_tree_write_lock
1923
1923
    def set_inventory(self, new_inventory_list):
1924
 
        from brzlib.inventory import (Inventory,
 
1924
        from breezy.inventory import (Inventory,
1925
1925
                                      InventoryDirectory,
1926
1926
                                      InventoryFile,
1927
1927
                                      InventoryLink)
2146
2146
        The default implementation returns no refs, and is only suitable for
2147
2147
        trees that have no local caching and can commit on ghosts at any time.
2148
2148
 
2149
 
        :seealso: brzlib.check for details about check_refs.
 
2149
        :seealso: breezy.check for details about check_refs.
2150
2150
        """
2151
2151
        return []
2152
2152
 
3215
3215
 
3216
3216
 
3217
3217
format_registry.register_lazy("Bazaar Working Tree Format 4 (bzr 0.15)\n",
3218
 
    "brzlib.workingtree_4", "WorkingTreeFormat4")
 
3218
    "breezy.workingtree_4", "WorkingTreeFormat4")
3219
3219
format_registry.register_lazy("Bazaar Working Tree Format 5 (bzr 1.11)\n",
3220
 
    "brzlib.workingtree_4", "WorkingTreeFormat5")
 
3220
    "breezy.workingtree_4", "WorkingTreeFormat5")
3221
3221
format_registry.register_lazy("Bazaar Working Tree Format 6 (bzr 1.14)\n",
3222
 
    "brzlib.workingtree_4", "WorkingTreeFormat6")
 
3222
    "breezy.workingtree_4", "WorkingTreeFormat6")
3223
3223
format_registry.register_lazy("Bazaar-NG Working Tree format 3",
3224
 
    "brzlib.workingtree_3", "WorkingTreeFormat3")
 
3224
    "breezy.workingtree_3", "WorkingTreeFormat3")
3225
3225
format_registry.set_default_key("Bazaar Working Tree Format 6 (bzr 1.14)\n")