script/autobuild.py: avoid nested try except block
authorJoe Guo <joeg@catalyst.net.nz>
Thu, 23 May 2019 02:07:49 +0000 (14:07 +1200)
committerAndrew Bartlett <abartlet@samba.org>
Thu, 20 Jun 2019 23:40:17 +0000 (23:40 +0000)
Signed-off-by: Joe Guo <joeg@catalyst.net.nz>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
script/autobuild.py

index 0a4d7ada21dc67789ed615f701868bd4dc9e887c..0d5f304f3f76d13641f28b0ef779393af0437a4c 100755 (executable)
@@ -1173,17 +1173,18 @@ while True:
         raise
 
     try:
-        try:
-            if options.rebase is not None:
-                rebase_tree(options.rebase, rebase_branch=options.branch)
-        except Exception:
-            cleanup_list.append(gitroot + "/autobuild.pid")
-            cleanup()
-            elapsed_time = time.time() - start_time
-            email_failure(-1, 'rebase', 'rebase', 'rebase',
-                          'rebase on %s failed' % options.branch,
-                          elapsed_time, log_base=options.log_base)
-            sys.exit(1)
+        if options.rebase is not None:
+            rebase_tree(options.rebase, rebase_branch=options.branch)
+    except Exception:
+        cleanup_list.append(gitroot + "/autobuild.pid")
+        cleanup()
+        elapsed_time = time.time() - start_time
+        email_failure(-1, 'rebase', 'rebase', 'rebase',
+                      'rebase on %s failed' % options.branch,
+                      elapsed_time, log_base=options.log_base)
+        sys.exit(1)
+
+    try:
         blist = buildlist(args, options.rebase, rebase_branch=options.branch)
         if options.tail:
             blist.start_tail()