コード例 #1
0
ファイル: cmds.py プロジェクト: GymWenFLL/tpp_libs
    def run(self,
            public_url=None,
            project='',
            product=None,
            branch_name='',
            branch_title='',
            branch_description='',
            author='',
            link_bug=None,
            dry_run=False):
        from bzrlib.plugins.launchpad.lp_registration import (
            BranchRegistrationRequest, BranchBugLinkRequest,
            DryRunLaunchpadService, LaunchpadService)
        if public_url is None:
            try:
                b = _mod_branch.Branch.open_containing('.')[0]
            except NotBranchError:
                raise BzrCommandError(gettext(
                            'register-branch requires a public '
                            'branch url - see bzr help register-branch.'))
            public_url = b.get_public_branch()
            if public_url is None:
                raise NoPublicBranch(b)
        if product is not None:
            project = product
            trace.note(gettext(
                '--product is deprecated; please use --project.'))


        rego = BranchRegistrationRequest(branch_url=public_url,
                                         branch_name=branch_name,
                                         branch_title=branch_title,
                                         branch_description=branch_description,
                                         product_name=project,
                                         author_email=author,
                                         )
        linko = BranchBugLinkRequest(branch_url=public_url,
                                     bug_id=link_bug)
        if not dry_run:
            service = LaunchpadService()
            # This gives back the xmlrpc url that can be used for future
            # operations on the branch.  It's not so useful to print to the
            # user since they can't do anything with it from a web browser; it
            # might be nice for the server to tell us about an html url as
            # well.
        else:
            # Run on service entirely in memory
            service = DryRunLaunchpadService()
        service.gather_user_credentials()
        rego.submit(service)
        if link_bug:
            linko.submit(service)
        self.outf.write('Branch registered.\n')
コード例 #2
0
 def test_mock_bug_branch_link(self):
     """Send bug-branch link to mock server"""
     test_case = self
     class MockService(MockLaunchpadService):
         def send_request(self, method_name, method_params, authenticated):
             test_case.assertEquals(method_name, "link_branch_to_bug")
             test_case.assertEquals(list(method_params),
                     ['http://server/branch', 1234, ''])
             test_case.assertEquals(authenticated, True)
             return 'http://launchpad.net/bug/1234'
     service = MockService()
     rego = BranchBugLinkRequest('http://server/branch', 1234)
     result = rego.submit(service)
     self.assertEquals(result, 'http://launchpad.net/bug/1234')
コード例 #3
0
ファイル: test_register.py プロジェクト: saminigod/cygwin
 def test_mock_bug_branch_link(self):
     """Send bug-branch link to mock server"""
     test_case = self
     class MockService(MockLaunchpadService):
         def send_request(self, method_name, method_params, authenticated):
             test_case.assertEquals(method_name, "link_branch_to_bug")
             test_case.assertEquals(list(method_params),
                     ['http://server/branch', 1234, ''])
             test_case.assertEquals(authenticated, True)
             return 'http://launchpad.net/bug/1234'
     service = MockService()
     rego = BranchBugLinkRequest('http://server/branch', 1234)
     result = rego.submit(service)
     self.assertEquals(result, 'http://launchpad.net/bug/1234')
コード例 #4
0
ファイル: __init__.py プロジェクト: saminigod/cygwin
    def run(self,
            public_url=None,
            product='',
            branch_name='',
            branch_title='',
            branch_description='',
            author='',
            link_bug=None,
            dry_run=False):
        from bzrlib.plugins.launchpad.lp_registration import (
            LaunchpadService, BranchRegistrationRequest, BranchBugLinkRequest,
            DryRunLaunchpadService)
        if public_url is None:
            try:
                b = Branch.open_containing('.')[0]
            except NotBranchError:
                raise BzrCommandError('register-branch requires a public '
                    'branch url - see bzr help register-branch.')
            public_url = b.get_public_branch()
            if public_url is None:
                raise NoPublicBranch(b)

        rego = BranchRegistrationRequest(branch_url=public_url,
                                         branch_name=branch_name,
                                         branch_title=branch_title,
                                         branch_description=branch_description,
                                         product_name=product,
                                         author_email=author,
                                         )
        linko = BranchBugLinkRequest(branch_url=public_url,
                                     bug_id=link_bug)
        if not dry_run:
            service = LaunchpadService()
            # This gives back the xmlrpc url that can be used for future
            # operations on the branch.  It's not so useful to print to the
            # user since they can't do anything with it from a web browser; it
            # might be nice for the server to tell us about an html url as
            # well.
        else:
            # Run on service entirely in memory
            service = DryRunLaunchpadService()
        service.gather_user_credentials()
        branch_object_url = rego.submit(service)
        if link_bug:
            link_bug_url = linko.submit(service)
        print 'Branch registered.'