# HG changeset patch
# User Pierre-Yves David <pierre-yves.david@fb.com>
# Date 2015-10-12 07:45:24
# Node ID 517ffec37dee4f63afdbec71d513695be19d2649
# Parent  c062a9c0293cbad58d01bcb5e8a2b3acaa3b2d7b

discovery: put trivial branch first

Having the simple and tiny branch of the conditional first help readability. The
"else" that appears after a screen of code is harder to relate to a conditional.

diff --git a/mercurial/discovery.py b/mercurial/discovery.py
--- a/mercurial/discovery.py
+++ b/mercurial/discovery.py
@@ -305,7 +305,9 @@ def checkheads(repo, remote, outgoing, r
         candidate_newhs.update(unsyncedheads)
         dhs = None # delta heads, the new heads on branch
         discardedheads = set()
-        if repo.obsstore:
+        if not repo.obsstore:
+            newhs = candidate_newhs
+        else:
             # remove future heads which are actually obsoleted by another
             # pushed element:
             #
@@ -334,8 +336,6 @@ def checkheads(repo, remote, outgoing, r
                             break
                     else:
                         newhs.add(nh)
-        else:
-            newhs = candidate_newhs
         unsynced = sorted(h for h in unsyncedheads if h not in discardedheads)
         if unsynced:
             if None in unsynced: