← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~cjwatson/lpbuildbot/bzr-unlock into lp:lpbuildbot

 

Colin Watson has proposed merging lp:~cjwatson/lpbuildbot/bzr-unlock into lp:lpbuildbot.

Commit message:
Unlock db_branch when make_merge_request has finished with it.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~cjwatson/lpbuildbot/bzr-unlock/+merge/356909

I think this might fix the zombie ssh process problem.
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~cjwatson/lpbuildbot/bzr-unlock into lp:lpbuildbot.
=== modified file 'buildbot-poll.py'
--- buildbot-poll.py	2018-06-04 12:59:33 +0000
+++ buildbot-poll.py	2018-10-17 09:15:23 +0000
@@ -423,40 +423,43 @@
         print('opening ' + db_devel_branch)
     db_tree, db_branch, db_path = bzr_open(db_devel_branch)
     db_branch.lock_read()
-    if not options.quiet:
-        print('checking if db-devel branch is up-to-date with stable')
-    # Spelling thanks to abentley:
-    # branch2.repository.get_graph(branch1.repository).is_ancestor(
-    #     revision_id, branch2.last_revision())
-    revid = branch.get_rev_id(revision)
-    graph = db_branch.repository.get_graph(branch.repository)
-    if not graph.is_ancestor(revid, db_branch.last_revision()):
+    try:
         if not options.quiet:
-            print('preparing PQM merge request.')
-        # Figure out which revisions we're landing from stable.
-        missing_revs = bzrlib.missing.find_unmerged(
-            branch, db_branch, restrict='local')[0]
-        stable_revnos = [revno for revno, rev in missing_revs]
-        submission = PQMSubmission(
-            stable_branch,
-            ('[rs=buildbot-poller] automatic merge from stable. '
-             'Revisions: %s included.' % ', '.join(stable_revnos)),
-            db_devel_branch, options.gpg_user or options.email,
-            options.gpg_passphrase_file
-            )
-
-        message = submission.to_email(
-            options.email.encode('utf8'),
-            options.pqm_email.encode('utf8'))
-
-        if options.dry_run:
-            print(message.as_string())
+            print('checking if db-devel branch is up-to-date with stable')
+        # Spelling thanks to abentley:
+        # branch2.repository.get_graph(branch1.repository).is_ancestor(
+        #     revision_id, branch2.last_revision())
+        revid = branch.get_rev_id(revision)
+        graph = db_branch.repository.get_graph(branch.repository)
+        if not graph.is_ancestor(revid, db_branch.last_revision()):
+            if not options.quiet:
+                print('preparing PQM merge request.')
+            # Figure out which revisions we're landing from stable.
+            missing_revs = bzrlib.missing.find_unmerged(
+                branch, db_branch, restrict='local')[0]
+            stable_revnos = [revno for revno, rev in missing_revs]
+            submission = PQMSubmission(
+                stable_branch,
+                ('[rs=buildbot-poller] automatic merge from stable. '
+                 'Revisions: %s included.' % ', '.join(stable_revnos)),
+                db_devel_branch, options.gpg_user or options.email,
+                options.gpg_passphrase_file
+                )
+
+            message = submission.to_email(
+                options.email.encode('utf8'),
+                options.pqm_email.encode('utf8'))
+
+            if options.dry_run:
+                print(message.as_string())
+            else:
+                SMTPConnection(config.GlobalStack()).send_email(message)
         else:
-            SMTPConnection(config.GlobalStack()).send_email(message)
-    else:
-        # the desired revision has already been merged.
-        if not options.quiet:
-            print('(no PQM request needed)')
+            # the desired revision has already been merged.
+            if not options.quiet:
+                print('(no PQM request needed)')
+    finally:
+        db_branch.unlock()
 
 
 def get_pqm_mode(options):


Follow ups