~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/directory_service.py

  • Committer: Patch Queue Manager
  • Date: 2012-03-30 01:58:47 UTC
  • mfrom: (6511.3.2 co-alias)
  • Revision ID: pqm@pqm.ubuntu.com-20120330015847-a0usc8fbawzc1bu4
(jelmer) Add co: directory service. (Jelmer Vernooij)

Show diffs side-by-side

added added

removed removed

Lines of Context:
30
30
lazy_import(globals(), """
31
31
from bzrlib import (
32
32
    branch as _mod_branch,
 
33
    controldir as _mod_controldir,
33
34
    urlutils,
34
35
    )
35
36
""")
131
132
 
132
133
directories.register(':', AliasDirectory,
133
134
                     'Easy access to remembered branch locations')
 
135
 
 
136
 
 
137
class ColocatedDirectory(object):
 
138
    """Directory lookup for colocated branches.
 
139
 
 
140
    co:somename will resolve to the colocated branch with "somename" in
 
141
    the current directory.
 
142
    """
 
143
 
 
144
    def look_up(self, name, url):
 
145
        dir = _mod_controldir.ControlDir.open_containing('.')[0]
 
146
        return urlutils.join_segment_parameters(dir.user_url,
 
147
            {"branch": urlutils.escape(name)})
 
148
 
 
149
 
 
150
directories.register('co:', ColocatedDirectory,
 
151
                     'Easy access to colocated branches')
 
152