Patchwork [4,of,4] runtests: unindent an "if True" block

login
register
mail settings
Submitter Jun Wu
Date Feb. 16, 2017, 12:50 a.m.
Message ID <c5bdb942d324dcd732d2.1487206217@localhost.localdomain>
Download mbox | patch
Permalink /patch/18528/
State Accepted
Headers show

Comments

Jun Wu - Feb. 16, 2017, 12:50 a.m.
# HG changeset patch
# User Jun Wu <quark@fb.com>
# Date 1487204998 28800
#      Wed Feb 15 16:29:58 2017 -0800
# Node ID c5bdb942d324dcd732d277457d11eff7dc6aacc3
# Parent  bacc5256a49b34d07616c1e60e119a74ac721b7a
# Available At https://bitbucket.org/quark-zju/hg-draft
#              hg pull https://bitbucket.org/quark-zju/hg-draft -r c5bdb942d324
runtests: unindent an "if True" block

The block was left to make review easier. This patch unindents it.
Augie Fackler - Feb. 16, 2017, 2:24 a.m.
On Wed, Feb 15, 2017 at 04:50:17PM -0800, Jun Wu wrote:
> # HG changeset patch
> # User Jun Wu <quark@fb.com>
> # Date 1487204998 28800
> #      Wed Feb 15 16:29:58 2017 -0800
> # Node ID c5bdb942d324dcd732d277457d11eff7dc6aacc3
> # Parent  bacc5256a49b34d07616c1e60e119a74ac721b7a
> # Available At https://bitbucket.org/quark-zju/hg-draft
> #              hg pull https://bitbucket.org/quark-zju/hg-draft -r c5bdb942d324
> runtests: unindent an "if True" block

Series looks fine, other than patch 1.

>
> The block was left to make review easier. This patch unindents it.
>
> diff --git a/tests/run-tests.py b/tests/run-tests.py
> --- a/tests/run-tests.py
> +++ b/tests/run-tests.py
> @@ -142,14 +142,13 @@ def checkportisavailable(port):
>      else:
>          family = socket.AF_INET
> -    if True:
> -        try:
> -            s = socket.socket(family, socket.SOCK_STREAM)
> -            s.bind(('localhost', port))
> -            s.close()
> -            return True
> -        except socket.error as exc:
> -            if exc.errno not in (errno.EADDRINUSE, errno.EADDRNOTAVAIL,
> -                                 errno.EPROTONOSUPPORT):
> -                raise
> +    try:
> +        s = socket.socket(family, socket.SOCK_STREAM)
> +        s.bind(('localhost', port))
> +        s.close()
> +        return True
> +    except socket.error as exc:
> +        if exc.errno not in (errno.EADDRINUSE, errno.EADDRNOTAVAIL,
> +                             errno.EPROTONOSUPPORT):
> +            raise
>      return False
>
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel@mercurial-scm.org
> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel

Patch

diff --git a/tests/run-tests.py b/tests/run-tests.py
--- a/tests/run-tests.py
+++ b/tests/run-tests.py
@@ -142,14 +142,13 @@  def checkportisavailable(port):
     else:
         family = socket.AF_INET
-    if True:
-        try:
-            s = socket.socket(family, socket.SOCK_STREAM)
-            s.bind(('localhost', port))
-            s.close()
-            return True
-        except socket.error as exc:
-            if exc.errno not in (errno.EADDRINUSE, errno.EADDRNOTAVAIL,
-                                 errno.EPROTONOSUPPORT):
-                raise
+    try:
+        s = socket.socket(family, socket.SOCK_STREAM)
+        s.bind(('localhost', port))
+        s.close()
+        return True
+    except socket.error as exc:
+        if exc.errno not in (errno.EADDRINUSE, errno.EADDRNOTAVAIL,
+                             errno.EPROTONOSUPPORT):
+            raise
     return False