Patchwork hg: move return statement after finally block

login
register
mail settings
Submitter Simon Heimberg
Date June 10, 2013, 4:53 p.m.
Message ID <c38b726c2d54d6e03a5c.1370883181@lapsi.heimberg.home>
Download mbox | patch
Permalink /patch/1717/
State Accepted
Commit 3b96d6e44a4dfa4f7310e46d2f9323cae5afe603
Headers show

Comments

Simon Heimberg - June 10, 2013, 4:53 p.m.
# HG changeset patch
# User simon@laptop-tosh
# Date 1370723828 -7200
# Node ID c38b726c2d54d6e03a5c40bee15146903522776c
# Parent  6f047263d6db2ac50b79a69d9bbb3379ccaf63b3
hg: move return statement after finally block

return is always run after finally block. Now we have same functionality,
but clearer readability.
Matt Mackall - June 12, 2013, 9:05 p.m.
On Mon, 2013-06-10 at 18:53 +0200, Simon Heimberg wrote:
> # HG changeset patch
> # User simon@laptop-tosh
> # Date 1370723828 -7200
> # Node ID c38b726c2d54d6e03a5c40bee15146903522776c
> # Parent  6f047263d6db2ac50b79a69d9bbb3379ccaf63b3
> hg: move return statement after finally block

Queued for default, thanks.

Patch

diff -r 6f047263d6db -r c38b726c2d54 mercurial/hg.py
--- a/mercurial/hg.py	Sam Jun 08 20:20:14 2013 +0200
+++ b/mercurial/hg.py	Sam Jun 08 22:37:08 2013 +0200
@@ -437,14 +437,13 @@ 
                 _update(destrepo, uprev)
                 if update in destrepo._bookmarks:
                     bookmarks.setcurrent(destrepo, update)
-
-        return srcpeer, destpeer
     finally:
         release(srclock, destlock)
         if cleandir is not None:
             shutil.rmtree(cleandir, True)
         if srcpeer is not None:
             srcpeer.close()
+    return srcpeer, destpeer
 
 def _showstats(repo, stats):
     repo.ui.status(_("%d files updated, %d files merged, "