/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 bzrlib/directory_service.py

  • Committer: Richard Wilbur
  • Date: 2016-02-04 19:07:28 UTC
  • mto: This revision was merged to the branch mainline in revision 6618.
  • Revision ID: richard.wilbur@gmail.com-20160204190728-p0zvfii6zase0fw7
Update COPYING.txt from the original http://www.gnu.org/licenses/gpl-2.0.txt  (Only differences were in whitespace.)  Thanks to Petr Stodulka for pointing out the discrepancy.

Show diffs side-by-side

added added

removed removed

Lines of Context:
22
22
 
23
23
from __future__ import absolute_import
24
24
 
25
 
from . import (
 
25
from bzrlib import (
26
26
    errors,
27
27
    registry,
28
28
    )
29
 
from .lazy_import import lazy_import
 
29
from bzrlib.lazy_import import lazy_import
30
30
lazy_import(globals(), """
31
 
from breezy import (
 
31
from bzrlib import (
32
32
    branch as _mod_branch,
33
33
    controldir as _mod_controldir,
34
34
    urlutils,
36
36
""")
37
37
 
38
38
 
39
 
class DirectoryLookupFailure(errors.BzrError):
40
 
    """Base type for lookup errors."""
41
 
 
42
 
 
43
 
class InvalidLocationAlias(DirectoryLookupFailure):
44
 
 
45
 
    _fmt = '"%(alias_name)s" is not a valid location alias.'
46
 
 
47
 
    def __init__(self, alias_name):
48
 
        DirectoryLookupFailure.__init__(self, alias_name=alias_name)
49
 
 
50
 
 
51
 
class UnsetLocationAlias(DirectoryLookupFailure):
52
 
 
53
 
    _fmt = 'No %(alias_name)s location assigned.'
54
 
 
55
 
    def __init__(self, alias_name):
56
 
        DirectoryLookupFailure.__init__(self, alias_name=alias_name[1:])
57
 
 
58
 
 
59
39
class DirectoryServiceRegistry(registry.Registry):
60
40
    """This object maintains and uses a list of directory services.
61
41
 
104
84
    branch_aliases.register('bound', lambda b: b.get_bound_location(),
105
85
        help="The branch this branch is bound to, for bound branches.")
106
86
    branch_aliases.register('push', lambda b: b.get_push_location(),
107
 
        help="The saved location used for `brz push` with no arguments.")
 
87
        help="The saved location used for `bzr push` with no arguments.")
108
88
    branch_aliases.register('this', lambda b: b.base,
109
89
        help="This branch.")
110
90
 
119
99
        try:
120
100
            method = self.branch_aliases.get(name[1:])
121
101
        except KeyError:
122
 
            raise InvalidLocationAlias(url)
 
102
            raise errors.InvalidLocationAlias(url)
123
103
        else:
124
104
            result = method(branch)
125
105
        if result is None:
126
 
            raise UnsetLocationAlias(url)
 
106
            raise errors.UnsetLocationAlias(url)
127
107
        if extra is not None:
128
108
            result = urlutils.join(result, extra)
129
109
        return result
139
119
================
140
120
 
141
121
Bazaar defines several aliases for locations associated with a branch.  These
142
 
can be used with most commands that expect a location, such as `brz push`.
 
122
can be used with most commands that expect a location, such as `bzr push`.
143
123
 
144
124
The aliases are::
145
125
 
146
126
%s
147
127
For example, to push to the parent location::
148
128
 
149
 
    brz push :parent
 
129
    bzr push :parent
150
130
""" % "".join(alias_lines)
151
131
 
152
132