85
85
service, name = match
86
86
return service().look_up(name, url)
88
89
directories = DirectoryServiceRegistry()
90
92
class AliasDirectory(object):
91
93
"""Directory lookup for locations associated with a branch.
97
99
branch_aliases = registry.Registry()
98
100
branch_aliases.register('parent', lambda b: b.get_parent(),
99
help="The parent of this branch.")
101
help="The parent of this branch.")
100
102
branch_aliases.register('submit', lambda b: b.get_submit_branch(),
101
help="The submit branch for this branch.")
103
help="The submit branch for this branch.")
102
104
branch_aliases.register('public', lambda b: b.get_public_branch(),
103
help="The public location of this branch.")
105
help="The public location of this branch.")
104
106
branch_aliases.register('bound', lambda b: b.get_bound_location(),
105
help="The branch this branch is bound to, for bound branches.")
107
help="The branch this branch is bound to, for bound branches.")
106
108
branch_aliases.register('push', lambda b: b.get_push_location(),
107
help="The saved location used for `brz push` with no arguments.")
109
help="The saved location used for `brz push` with no arguments.")
108
110
branch_aliases.register('this', lambda b: b.base,
111
113
def look_up(self, name, url):
112
114
branch = _mod_branch.Branch.open_containing('.')[0]
164
166
def look_up(self, name, url):
165
167
dir = _mod_controldir.ControlDir.open_containing('.')[0]
166
168
return urlutils.join_segment_parameters(dir.user_url,
167
{"branch": urlutils.escape(name)})
169
{"branch": urlutils.escape(name)})
170
172
directories.register('co:', ColocatedDirectory,
171
173
'Easy access to colocated branches')