~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

  • Committer: Martin Pool
  • Date: 2006-05-16 02:31:06 UTC
  • mto: (1704.2.17 bzr.mbp.integration)
  • mto: This revision was merged to the branch mainline in revision 1710.
  • Revision ID: mbp@sourcefrog.net-20060516023106-ad3248d716e61d31
(launchpad plugin) Improved --dry-run that uses a dummy xmlrpc service.

Add a test using this that we get reasonable output.

Clearer message when registration succeeds.

Show diffs side-by-side

added added

removed removed

Lines of Context:
78
78
 
79
79
    def run(self, 
80
80
            branch_url, 
81
 
            product='', 
 
81
            product='',
82
82
            branch_name='',
83
83
            branch_title='',
84
84
            branch_description='',
86
86
            link_bug=None,
87
87
            dry_run=False):
88
88
        from lp_registration import (
89
 
            LaunchpadService, BranchRegistrationRequest, BranchBugLinkRequest)
90
 
        rego = BranchRegistrationRequest(branch_url=branch_url, 
 
89
            LaunchpadService, BranchRegistrationRequest, BranchBugLinkRequest,
 
90
            DryRunLaunchpadService)
 
91
        rego = BranchRegistrationRequest(branch_url=branch_url,
91
92
                                         branch_name=branch_name,
92
93
                                         branch_title=branch_title,
93
94
                                         branch_description=branch_description,
96
97
                                         )
97
98
        linko = BranchBugLinkRequest(branch_url=branch_url,
98
99
                                     bug_id=link_bug)
99
 
        service = LaunchpadService()
 
100
        if not dry_run:
 
101
            service = LaunchpadService()
 
102
            # This gives back the xmlrpc url that can be used for future
 
103
            # operations on the branch.  It's not so useful to print to the
 
104
            # user since they can't do anything with it from a web browser; it
 
105
            # might be nice for the server to tell us about an html url as
 
106
            # well.
 
107
        else:
 
108
            # Run on service entirely in memory
 
109
            service = DryRunLaunchpadService()
100
110
        service.gather_user_credentials()
101
 
        if not dry_run:
102
 
            print rego.submit(service)
103
 
            if link_bug:
104
 
                print linko.submit(service)
 
111
        branch_object_url = rego.submit(service)
 
112
        if link_bug:
 
113
            link_bug_url = linko.submit(service)
 
114
        print 'Branch registered.'
105
115
 
106
116
register_command(cmd_register_branch)
107
117