~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/plugins/launchpad/__init__.py

  • Committer: John Arbash Meinel
  • Date: 2009-12-21 17:24:22 UTC
  • mfrom: (4913 +trunk)
  • mto: This revision was merged to the branch mainline in revision 4916.
  • Revision ID: john@arbash-meinel.com-20091221172422-0zy2v8x3fhcdc8c0
Merge bzr.dev 4913, to put NEWS in its place.

Show diffs side-by-side

added added

removed removed

Lines of Context:
36
36
from bzrlib.directory_service import directories
37
37
from bzrlib.errors import (
38
38
    BzrCommandError,
 
39
    DependencyNotPresent,
39
40
    InvalidURL,
40
41
    NoPublicBranch,
41
42
    NotBranchError,
42
43
    )
43
44
from bzrlib.help_topics import topic_registry
44
 
from bzrlib.plugins.launchpad.lp_registration import (
45
 
    LaunchpadService,
46
 
    NotLaunchpadBranch,
47
 
    )
48
45
 
49
46
 
50
47
class cmd_register_branch(Command):
111
108
            link_bug=None,
112
109
            dry_run=False):
113
110
        from bzrlib.plugins.launchpad.lp_registration import (
114
 
            LaunchpadService, BranchRegistrationRequest, BranchBugLinkRequest,
115
 
            DryRunLaunchpadService)
 
111
            BranchRegistrationRequest, BranchBugLinkRequest,
 
112
            DryRunLaunchpadService, LaunchpadService)
116
113
        if public_url is None:
117
114
            try:
118
115
                b = _mod_branch.Branch.open_containing('.')[0]
147
144
            # Run on service entirely in memory
148
145
            service = DryRunLaunchpadService()
149
146
        service.gather_user_credentials()
150
 
        branch_object_url = rego.submit(service)
 
147
        rego.submit(service)
151
148
        if link_bug:
152
 
            link_bug_url = linko.submit(service)
 
149
            linko.submit(service)
153
150
        print 'Branch registered.'
154
151
 
155
152
register_command(cmd_register_branch)
181
178
            yield branch_url
182
179
 
183
180
    def _get_web_url(self, service, location):
 
181
        from bzrlib.plugins.launchpad.lp_registration import (
 
182
            NotLaunchpadBranch)
184
183
        for branch_url in self._possible_locations(location):
185
184
            try:
186
185
                return service.get_web_url_from_branch_url(branch_url)
189
188
        raise NotLaunchpadBranch(branch_url)
190
189
 
191
190
    def run(self, location=None, dry_run=False):
 
191
        from bzrlib.plugins.launchpad.lp_registration import (
 
192
            LaunchpadService)
192
193
        if location is None:
193
194
            location = u'.'
194
195
        web_url = self._get_web_url(LaunchpadService(), location)
226
227
        ]
227
228
 
228
229
    def run(self, name=None, no_check=False, verbose=False):
 
230
        # This is totally separate from any launchpadlib login system.
229
231
        from bzrlib.plugins.launchpad import account
230
232
        check_account = not no_check
231
233
 
255
257
register_command(cmd_launchpad_login)
256
258
 
257
259
 
 
260
# XXX: cmd_launchpad_mirror is untested
 
261
class cmd_launchpad_mirror(Command):
 
262
    """Ask Launchpad to mirror a branch now."""
 
263
 
 
264
    aliases = ['lp-mirror']
 
265
    takes_args = ['location?']
 
266
 
 
267
    def run(self, location='.'):
 
268
        from bzrlib.plugins.launchpad import lp_api
 
269
        from bzrlib.plugins.launchpad.lp_registration import LaunchpadService
 
270
        branch = _mod_branch.Branch.open(location)
 
271
        service = LaunchpadService()
 
272
        launchpad = lp_api.login(service)
 
273
        lp_branch = lp_api.load_branch(launchpad, branch)
 
274
        lp_branch.requestMirror()
 
275
 
 
276
 
 
277
register_command(cmd_launchpad_mirror)
 
278
 
 
279
 
258
280
def _register_directory():
259
281
    directories.register_lazy('lp:', 'bzrlib.plugins.launchpad.lp_directory',
260
282
                              'LaunchpadDirectory',
266
288
    testmod_names = [
267
289
        'test_account',
268
290
        'test_register',
 
291
        'test_lp_api',
269
292
        'test_lp_directory',
270
293
        'test_lp_login',
271
294
        'test_lp_open',