Rev 5247: Allow setting new proposals as approved immediately. in http://bazaar.launchpad.net/~lifeless/bzr/propose-accepted

Robert Collins robertc at robertcollins.net
Fri May 21 05:27:12 BST 2010


At http://bazaar.launchpad.net/~lifeless/bzr/propose-accepted

------------------------------------------------------------
revno: 5247
revision-id: robertc at robertcollins.net-20100521042711-gt6x2vojrm4flnc9
parent: robertc at robertcollins.net-20100521041647-1of2t3xt0opjt95m
committer: Robert Collins <robertc at robertcollins.net>
branch nick: propose-accepted
timestamp: Fri 2010-05-21 16:27:11 +1200
message:
  Allow setting new proposals as approved immediately.
=== modified file 'bzrlib/plugins/launchpad/__init__.py'
--- a/bzrlib/plugins/launchpad/__init__.py	2010-04-02 19:12:58 +0000
+++ b/bzrlib/plugins/launchpad/__init__.py	2010-05-21 04:27:11 +0000
@@ -310,6 +310,8 @@
                             help='Propose the merge on staging.'),
                      Option('message', short_name='m', type=unicode,
                             help='Commit message.'),
+                     Option('approve',
+                            help='Mark the proposal as approved immediately.'),
                      ListOption('review', short_name='R', type=unicode,
                             help='Requested reviewer and optional type.')]
 
@@ -318,7 +320,7 @@
     aliases = ['lp-submit', 'lp-propose']
 
     def run(self, submit_branch=None, review=None, staging=False,
-            message=None):
+            message=None, approve=False):
         from bzrlib.plugins.launchpad import lp_propose
         tree, branch, relpath = bzrdir.BzrDir.open_containing_tree_or_branch(
             '.')
@@ -338,7 +340,7 @@
         else:
             target = _mod_branch.Branch.open(submit_branch)
         proposer = lp_propose.Proposer(tree, branch, target, message,
-                                       reviews, staging)
+                                       reviews, staging, approve=approve)
         proposer.check_proposal()
         proposer.create_proposal()
 

=== modified file 'bzrlib/plugins/launchpad/lp_propose.py'
--- a/bzrlib/plugins/launchpad/lp_propose.py	2010-05-21 04:16:47 +0000
+++ b/bzrlib/plugins/launchpad/lp_propose.py	2010-05-21 04:27:11 +0000
@@ -55,7 +55,7 @@
     hooks = ProposeMergeHooks()
 
     def __init__(self, tree, source_branch, target_branch, message, reviews,
-                 staging=False):
+                 staging=False, approve=False):
         """Constructor.
 
         :param tree: The working tree for the source branch.
@@ -65,6 +65,10 @@
         :param reviews: A list of tuples of reviewer, review type.
         :param staging: If True, propose the merge against staging instead of
             production.
+        :param approve: If True, mark the new proposal as approved immediately.
+            This is useful when a project permits some things to be approved
+            by the submitter (e.g. merges between release and deployment
+            branches).
         """
         self.tree = tree
         if staging:
@@ -91,6 +95,7 @@
             self.reviews = [(self.launchpad.people[reviewer], review_type)
                             for reviewer, review_type in
                             reviews]
+        self.approve = approve
 
     def get_comment(self, prerequisite_branch):
         """Determine the initial comment for the merge proposal."""
@@ -201,6 +206,8 @@
             initial_comment=initial_comment,
             commit_message=self.commit_message, reviewers=reviewers,
             review_types=review_types)
+        if self.approve:
+            self.call_webservice(mp.setStatus, status='Approved')
         webbrowser.open(canonical_url(mp))
 
 




More information about the bazaar-commits mailing list