Patchwork [1,of,2,V2] dispatch: pre-indent the extensions blaming logic

login
register
mail settings
Submitter Pierre-Yves David
Date Sept. 17, 2015, 7:11 p.m.
Message ID <75a8b3abe7bc407e8415.1442517094@marginatus.alto.octopoid.net>
Download mbox | patch
Permalink /patch/10525/
State Accepted
Commit 3e79ec0ba589aafd07e29c3e8a920a7bb280861d
Headers show

Comments

Pierre-Yves David - Sept. 17, 2015, 7:11 p.m.
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david@fb.com>
# Date 1442515855 25200
#      Thu Sep 17 11:50:55 2015 -0700
# Node ID 75a8b3abe7bc407e84153134dadfa3815443210d
# Parent  3166bcc0c53840833e4223f123731fc420c0d3d3
dispatch: pre-indent the extensions blaming logic

We are about to put some real conditional here, but pre-indenting in it's own
changesets makes next patch much cleaner.

Patch

diff --git a/mercurial/dispatch.py b/mercurial/dispatch.py
--- a/mercurial/dispatch.py
+++ b/mercurial/dispatch.py
@@ -333,30 +333,31 @@  def _runcatch(req):
         # of date) will be clueful enough to notice the implausible
         # version number and try updating.
         compare = myver.split('+')[0]
         ct = tuplever(compare)
         worst = None, ct, ''
-        for name, mod in extensions.extensions():
-            testedwith = getattr(mod, 'testedwith', '')
-            report = getattr(mod, 'buglink', _('the extension author.'))
-            if not testedwith.strip():
-                # We found an untested extension. It's likely the culprit.
-                worst = name, 'unknown', report
-                break
+        if True:
+            for name, mod in extensions.extensions():
+                testedwith = getattr(mod, 'testedwith', '')
+                report = getattr(mod, 'buglink', _('the extension author.'))
+                if not testedwith.strip():
+                    # We found an untested extension. It's likely the culprit.
+                    worst = name, 'unknown', report
+                    break
 
-            # Never blame on extensions bundled with Mercurial.
-            if testedwith == 'internal':
-                continue
+                # Never blame on extensions bundled with Mercurial.
+                if testedwith == 'internal':
+                    continue
 
-            tested = [tuplever(t) for t in testedwith.split()]
-            if ct in tested:
-                continue
+                tested = [tuplever(t) for t in testedwith.split()]
+                if ct in tested:
+                    continue
 
-            lower = [t for t in tested if t < ct]
-            nearest = max(lower or tested)
-            if worst[0] is None or nearest < worst[1]:
-                worst = name, nearest, report
+                lower = [t for t in tested if t < ct]
+                nearest = max(lower or tested)
+                if worst[0] is None or nearest < worst[1]:
+                    worst = name, nearest, report
         if worst[0] is not None:
             name, testedwith, report = worst
             if not isinstance(testedwith, str):
                 testedwith = '.'.join([str(c) for c in testedwith])
             warning = (_('** Unknown exception encountered with '