Rev 6571: (gz) Set approved revision and vote "Approve" when using lp-propose in file:///srv/pqm.bazaar-vcs.org/archives/thelove/bzr/%2Btrunk/

Patch Queue Manager pqm at pqm.ubuntu.com
Thu Oct 25 11:13:27 UTC 2012


At file:///srv/pqm.bazaar-vcs.org/archives/thelove/bzr/%2Btrunk/

------------------------------------------------------------
revno: 6571 [merge]
revision-id: pqm at pqm.ubuntu.com-20121025111327-p0ylql0nh9fla0rs
parent: pqm at pqm.ubuntu.com-20121014125927-9m3i1lgv1hjuusk8
parent: jml at canonical.com-20121023102225-2rg3vuygc9npii7w
committer: Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Thu 2012-10-25 11:13:27 +0000
message:
  (gz) Set approved revision and vote "Approve" when using lp-propose
   --approve (Jonathan Lange)
modified:
  bzrlib/plugins/launchpad/cmds.py cmds.py-20120310190900-ivsmwjx0w9s5gpm3-1
  bzrlib/plugins/launchpad/lp_propose.py lp_submit.py-20100120065117-penrmqruf596pui6-1
  doc/en/release-notes/bzr-2.6.txt bzr2.6.txt-20120116134316-8w1xxom1c7vcu1t5-1
=== modified file 'bzrlib/plugins/launchpad/cmds.py'
--- a/bzrlib/plugins/launchpad/cmds.py	2012-07-23 19:19:05 +0000
+++ b/bzrlib/plugins/launchpad/cmds.py	2012-10-22 15:51:31 +0000
@@ -293,7 +293,8 @@
                      Option('message', short_name='m', type=unicode,
                             help='Commit message.'),
                      Option('approve',
-                            help='Mark the proposal as approved immediately.'),
+                            help=('Mark the proposal as approved immediately, '
+                                  'setting the approved revision to tip.')),
                      Option('fixes', 'The bug this proposal fixes.', str),
                      ListOption('review', short_name='R', type=unicode,
                             help='Requested reviewer and optional type.')]

=== modified file 'bzrlib/plugins/launchpad/lp_propose.py'
--- a/bzrlib/plugins/launchpad/lp_propose.py	2012-02-26 15:43:02 +0000
+++ b/bzrlib/plugins/launchpad/lp_propose.py	2012-10-22 16:25:40 +0000
@@ -137,6 +137,15 @@
             })
         return body
 
+    def get_source_revid(self):
+        """Get the revision ID of the source branch."""
+        source_branch = self.source_branch.bzr
+        source_branch.lock_read()
+        try:
+            return source_branch.last_revision()
+        finally:
+            source_branch.unlock()
+
     def check_proposal(self):
         """Check that the submission is sensible."""
         if self.source_branch.lp.self_link == self.target_branch.lp.self_link:
@@ -180,6 +189,15 @@
                 error_lines.append(line)
             raise Exception(''.join(error_lines))
 
+    def approve_proposal(self, mp):
+        revid = self.get_source_revid()
+        self.call_webservice(
+            mp.createComment,
+            vote=u'Approve',
+            subject='', # Use the default subject.
+            content=u"Rubberstamp! Proposer approves of own proposal.")
+        self.call_webservice(mp.setStatus, status=u'Approved', revid=revid)
+
     def create_proposal(self):
         """Perform the submission."""
         prerequisite_branch = self._get_prerequisite_branch()
@@ -203,7 +221,7 @@
             commit_message=self.commit_message, reviewers=reviewers,
             review_types=review_types)
         if self.approve:
-            self.call_webservice(mp.setStatus, status='Approved')
+            self.approve_proposal(mp)
         if self.fixes:
             if self.fixes.startswith('lp:'):
                 self.fixes = self.fixes[3:]

=== modified file 'doc/en/release-notes/bzr-2.6.txt'
--- a/doc/en/release-notes/bzr-2.6.txt	2012-10-13 15:05:46 +0000
+++ b/doc/en/release-notes/bzr-2.6.txt	2012-10-23 10:22:25 +0000
@@ -15,6 +15,9 @@
 
 .. These may require users to change the way they use Bazaar.
 
+* ``bzr lp-propose --approve`` now also adds an "Approve" vote to the merge
+  proposal.  (Jonathan Lange)
+
 New Features
 ************
 
@@ -43,7 +46,12 @@
 
 * Local configurations files (i.e. accessed on the local file system like
   ``bazaar.conf`` and ``locations.conf``) are now shared, reducing the
-  number of IOs when querying a configuation option. (Vincent Ladeuil, #832042)
+  number of IOs when querying a configuation option. (Vincent Ladeuil,
+  #832042)
+
+* ``bzr lp-propose --approve`` now correctly specifies the approved revision
+  and provides an "Approve" vote from the proposer, allowing for smoother
+  interaction with downstream merge tools.  (Jonathan Lange)
 
 Bug Fixes
 *********




More information about the bazaar-commits mailing list