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

  • Committer: Jelmer Vernooij
  • Date: 2017-05-21 19:09:26 UTC
  • mfrom: (6622.1.36 breezy)
  • Revision ID: jelmer@jelmer.uk-20170521190926-5vtz8xaf0e9ylrpc
Merge rename to breezy.

Show diffs side-by-side

added added

removed removed

Lines of Context:
16
16
 
17
17
from __future__ import absolute_import
18
18
 
19
 
import bzrlib.bzrdir
 
19
import breezy.bzrdir
20
20
 
21
21
from cStringIO import StringIO
22
22
 
23
 
from bzrlib.lazy_import import lazy_import
 
23
from breezy.lazy_import import lazy_import
24
24
lazy_import(globals(), """
25
25
import itertools
26
 
from bzrlib import (
 
26
from breezy import (
27
27
    bzrdir,
28
28
    controldir,
29
29
    cache_utf8,
46
46
    urlutils,
47
47
    vf_search,
48
48
    )
49
 
from bzrlib.i18n import gettext, ngettext
 
49
from breezy.i18n import gettext, ngettext
50
50
""")
51
51
 
52
 
# Explicitly import bzrlib.bzrdir so that the BzrProber
 
52
# Explicitly import breezy.bzrdir so that the BzrProber
53
53
# is guaranteed to be registered.
54
 
import bzrlib.bzrdir
 
54
import breezy.bzrdir
55
55
 
56
 
from bzrlib import (
 
56
from breezy import (
57
57
    bzrdir,
58
58
    controldir,
59
59
    )
60
 
from bzrlib.decorators import (
 
60
from breezy.decorators import (
61
61
    needs_read_lock,
62
62
    needs_write_lock,
63
63
    only_raises,
64
64
    )
65
 
from bzrlib.hooks import Hooks
66
 
from bzrlib.inter import InterObject
67
 
from bzrlib.lock import _RelockDebugMixin, LogicalLockResult
68
 
from bzrlib import registry
69
 
from bzrlib.symbol_versioning import (
 
65
from breezy.hooks import Hooks
 
66
from breezy.inter import InterObject
 
67
from breezy.lock import _RelockDebugMixin, LogicalLockResult
 
68
from breezy import registry
 
69
from breezy.symbol_versioning import (
70
70
    deprecated_in,
71
71
    deprecated_method,
72
72
    )
73
 
from bzrlib.trace import mutter, mutter_callsite, note, is_quiet
 
73
from breezy.trace import mutter, mutter_callsite, note, is_quiet
74
74
 
75
75
 
76
76
class Branch(controldir.ControlComponent):
170
170
    def _get_check_refs(self):
171
171
        """Get the references needed for check().
172
172
 
173
 
        See bzrlib.check.
 
173
        See breezy.check.
174
174
        """
175
175
        revid = self.last_revision()
176
176
        return [('revision-existence', revid), ('lefthand-distance', revid)]
221
221
        return self.supports_tags() and self.tags.get_tag_dict()
222
222
 
223
223
    def get_config(self):
224
 
        """Get a bzrlib.config.BranchConfig for this Branch.
 
224
        """Get a breezy.config.BranchConfig for this Branch.
225
225
 
226
226
        This can then be used to get and set configuration options for the
227
227
        branch.
228
228
 
229
 
        :return: A bzrlib.config.BranchConfig.
 
229
        :return: A breezy.config.BranchConfig.
230
230
        """
231
231
        return _mod_config.BranchConfig(self)
232
232
 
233
233
    def get_config_stack(self):
234
 
        """Get a bzrlib.config.BranchStack for this Branch.
 
234
        """Get a breezy.config.BranchStack for this Branch.
235
235
 
236
236
        This can then be used to get and set configuration options for the
237
237
        branch.
238
238
 
239
 
        :return: A bzrlib.config.BranchStack.
 
239
        :return: A breezy.config.BranchStack.
240
240
        """
241
241
        return _mod_config.BranchStack(self)
242
242
 
359
359
    def lock_read(self):
360
360
        """Lock the branch for read operations.
361
361
 
362
 
        :return: A bzrlib.lock.LogicalLockResult.
 
362
        :return: A breezy.lock.LogicalLockResult.
363
363
        """
364
364
        raise NotImplementedError(self.lock_read)
365
365
 
829
829
                except UnicodeEncodeError:
830
830
                    raise errors.InvalidURL(url,
831
831
                        "Urls must be 7-bit ascii, "
832
 
                        "use bzrlib.urlutils.escape")
 
832
                        "use breezy.urlutils.escape")
833
833
            url = urlutils.relative_url(self.base, url)
834
834
        self._set_parent_location(url)
835
835
 
1482
1482
    @needs_write_lock
1483
1483
    def reconcile(self, thorough=True):
1484
1484
        """Make sure the data stored in this branch is consistent."""
1485
 
        from bzrlib.reconcile import BranchReconciler
 
1485
        from breezy.reconcile import BranchReconciler
1486
1486
        reconciler = BranchReconciler(self, thorough=thorough)
1487
1487
        reconciler.reconcile()
1488
1488
        return reconciler
1720
1720
    """A factory for a BranchFormat object, permitting simple lazy registration.
1721
1721
    
1722
1722
    While none of the built in BranchFormats are lazy registered yet,
1723
 
    bzrlib.tests.test_branch.TestMetaDirBranchFormatFactory demonstrates how to
 
1723
    breezy.tests.test_branch.TestMetaDirBranchFormatFactory demonstrates how to
1724
1724
    use it, and the bzr-loom plugin uses it as well (see
1725
 
    bzrlib.plugins.loom.formats).
 
1725
    breezy.plugins.loom.formats).
1726
1726
    """
1727
1727
 
1728
1728
    def __init__(self, format_string, module_name, member_name):
1757
1757
        These are all empty initially, because by default nothing should get
1758
1758
        notified.
1759
1759
        """
1760
 
        Hooks.__init__(self, "bzrlib.branch", "Branch.hooks")
 
1760
        Hooks.__init__(self, "breezy.branch", "Branch.hooks")
1761
1761
        self.add_hook('open',
1762
1762
            "Called with the Branch object that has been opened after a "
1763
1763
            "branch is opened.", (1, 8))
1764
1764
        self.add_hook('post_push',
1765
1765
            "Called after a push operation completes. post_push is called "
1766
 
            "with a bzrlib.branch.BranchPushResult object and only runs in the "
 
1766
            "with a breezy.branch.BranchPushResult object and only runs in the "
1767
1767
            "bzr client.", (0, 15))
1768
1768
        self.add_hook('post_pull',
1769
1769
            "Called after a pull operation completes. post_pull is called "
1770
 
            "with a bzrlib.branch.PullResult object and only runs in the "
 
1770
            "with a breezy.branch.PullResult object and only runs in the "
1771
1771
            "bzr client.", (0, 15))
1772
1772
        self.add_hook('pre_commit',
1773
1773
            "Called after a commit is calculated but before it is "
1793
1793
        self.add_hook('pre_change_branch_tip',
1794
1794
            "Called in bzr client and server before a change to the tip of a "
1795
1795
            "branch is made. pre_change_branch_tip is called with a "
1796
 
            "bzrlib.branch.ChangeBranchTipParams. Note that push, pull, "
 
1796
            "breezy.branch.ChangeBranchTipParams. Note that push, pull, "
1797
1797
            "commit, uncommit will all trigger this hook.", (1, 6))
1798
1798
        self.add_hook('post_change_branch_tip',
1799
1799
            "Called in bzr client and server after a change to the tip of a "
1800
1800
            "branch is made. post_change_branch_tip is called with a "
1801
 
            "bzrlib.branch.ChangeBranchTipParams. Note that push, pull, "
 
1801
            "breezy.branch.ChangeBranchTipParams. Note that push, pull, "
1802
1802
            "commit, uncommit will all trigger this hook.", (1, 4))
1803
1803
        self.add_hook('transform_fallback_location',
1804
1804
            "Called when a stacked branch is activating its fallback "
1821
1821
        self.add_hook('post_branch_init',
1822
1822
            "Called after new branch initialization completes. "
1823
1823
            "post_branch_init is called with a "
1824
 
            "bzrlib.branch.BranchInitHookParams. "
 
1824
            "breezy.branch.BranchInitHookParams. "
1825
1825
            "Note that init, branch and checkout (both heavyweight and "
1826
1826
            "lightweight) will all trigger this hook.", (2, 2))
1827
1827
        self.add_hook('post_switch',
1828
1828
            "Called after a checkout switches branch. "
1829
1829
            "post_switch is called with a "
1830
 
            "bzrlib.branch.SwitchHookParams.", (2, 2))
 
1830
            "breezy.branch.SwitchHookParams.", (2, 2))
1831
1831
 
1832
1832
 
1833
1833
 
2091
2091
        return self._initialize_helper(a_bzrdir, utf8_files, name, repository)
2092
2092
 
2093
2093
    def make_tags(self, branch):
2094
 
        """See bzrlib.branch.BranchFormat.make_tags()."""
 
2094
        """See breezy.branch.BranchFormat.make_tags()."""
2095
2095
        return _mod_tag.BasicTags(branch)
2096
2096
 
2097
2097
    def supports_set_append_revisions_only(self):
2125
2125
        return self._initialize_helper(a_bzrdir, utf8_files, name, repository)
2126
2126
 
2127
2127
    def make_tags(self, branch):
2128
 
        """See bzrlib.branch.BranchFormat.make_tags()."""
 
2128
        """See breezy.branch.BranchFormat.make_tags()."""
2129
2129
        return _mod_tag.BasicTags(branch)
2130
2130
 
2131
2131
    def supports_set_append_revisions_only(self):
2175
2175
        return True
2176
2176
 
2177
2177
    def make_tags(self, branch):
2178
 
        """See bzrlib.branch.BranchFormat.make_tags()."""
 
2178
        """See breezy.branch.BranchFormat.make_tags()."""
2179
2179
        return _mod_tag.BasicTags(branch)
2180
2180
 
2181
2181
    supports_reference_locations = False
2315
2315
__format7 = BzrBranchFormat7()
2316
2316
__format8 = BzrBranchFormat8()
2317
2317
format_registry.register_lazy(
2318
 
    "Bazaar-NG branch format 5\n", "bzrlib.branchfmt.fullhistory", "BzrBranchFormat5")
 
2318
    "Bazaar-NG branch format 5\n", "breezy.branchfmt.fullhistory", "BzrBranchFormat5")
2319
2319
format_registry.register(BranchReferenceFormat())
2320
2320
format_registry.register(__format6)
2321
2321
format_registry.register(__format7)
2471
2471
    def lock_read(self):
2472
2472
        """Lock the branch for read operations.
2473
2473
 
2474
 
        :return: A bzrlib.lock.LogicalLockResult.
 
2474
        :return: A breezy.lock.LogicalLockResult.
2475
2475
        """
2476
2476
        if not self.is_locked():
2477
2477
            self._note_lock('r')