changeset 30870:c5bee6aa4971

unbundle: swap conditional branches for clarity This is a small style update for clarity. The previous situation was: if foo: 50 lines else: 2 lines In such case I tend to invert these to get the simpler branch out of the way earlier: if not foo: 2 lines else: 50 lines This makes the conditional and various alternatives fit on the same screen, simpler to read overall.
author Pierre-Yves David <pierre-yves.david@ens-lyon.org>
date Thu, 02 Feb 2017 10:53:55 +0100
parents 887de9516138
children e527c11375a4
files mercurial/exchange.py
diffstat 1 files changed, 5 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/exchange.py	Thu Feb 02 10:55:38 2017 +0100
+++ b/mercurial/exchange.py	Thu Feb 02 10:53:55 2017 +0100
@@ -1723,7 +1723,11 @@
         # 'check_heads' call wil be a no-op
         check_heads(repo, heads, 'uploading changes')
         # push can proceed
-        if util.safehasattr(cg, 'params'):
+        if not util.safehasattr(cg, 'params'):
+            # legacy case: bundle1 (changegroup 01)
+            lockandtr[1] = repo.lock()
+            r = cg.apply(repo, source, url)
+        else:
             r = None
             try:
                 def gettransaction():
@@ -1762,10 +1766,6 @@
                                                   mandatory=False)
                         parts.append(part)
                 raise
-        else:
-            # legacy case: bundle1 (changegroup 01)
-            lockandtr[1] = repo.lock()
-            r = cg.apply(repo, source, url)
     finally:
         lockmod.release(lockandtr[2], lockandtr[1], lockandtr[0])
         if recordout is not None: