~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to __init__.py

  • Committer: test at canonical
  • Date: 2006-03-23 12:39:19 UTC
  • mto: (1668.1.8 bzr-0.8.mbp)
  • mto: This revision was merged to the branch mainline in revision 1710.
  • Revision ID: test@canonical.com-20060323123919-81ff3b088e4195eb
add possibility to link to a bug when registering a branch. factor out some common functionality from BranchRegistrationRequest.

Show diffs side-by-side

added added

removed removed

Lines of Context:
68
68
         Option('author', 
69
69
                'email of the branch\'s author, if not yourself',
70
70
                unicode),
 
71
         Option('link-bug',
 
72
                'the bug this branch fixes',
 
73
                int),
71
74
         Option('dry-run',
72
75
                'prepare the request but don\'t actually send it')
73
76
        ]
80
83
            branch_title='',
81
84
            branch_description='',
82
85
            author='',
 
86
            link_bug=None,
83
87
            dry_run=False):
84
 
        from lp_registration import BranchRegistrationRequest
 
88
        from lp_registration import (
 
89
            LaunchpadService, BranchRegistrationRequest, BranchBugLinkRequest)
85
90
        rego = BranchRegistrationRequest(branch_url=branch_url, 
86
91
                                         branch_name=branch_name,
87
92
                                         branch_title=branch_title,
89
94
                                         product_name=product,
90
95
                                         author_email=author,
91
96
                                         )
 
97
        linko = BranchBugLinkRequest(branch_url=branch_url,
 
98
                                     bug_id=link_bug)
 
99
        service = LaunchpadService()
 
100
        service.gather_user_credentials()
92
101
        if not dry_run:
93
 
            rego.register_interactive()
 
102
            print rego.submit(service)
 
103
            if link_bug:
 
104
                print linko.submit(service)
94
105
 
95
106
register_command(cmd_register_branch)
96
107