[PATCH 8 of 9] run-tests: remove the artificial indentation

Pierre-Yves David pierre-yves.david at ens-lyon.org
Sat Sep 7 08:16:47 EDT 2019


# HG changeset patch
# User Pierre-Yves David <pierre-yves.david at octobus.net>
# Date 1560530356 -3600
#      Fri Jun 14 17:39:16 2019 +0100
# Node ID df7d3a5c505f6f0dd7e0ed63dd91b526e2ef1893
# Parent  37175973a3ca496e7d32044e342f88ad8894f69b
# EXP-Topic test-match
# Available At https://bitbucket.org/octobus/mercurial-devel/
#              hg pull https://bitbucket.org/octobus/mercurial-devel/ -r df7d3a5c505f
run-tests: remove the artificial indentation

diff --git a/tests/run-tests.py b/tests/run-tests.py
--- a/tests/run-tests.py
+++ b/tests/run-tests.py
@@ -1638,86 +1638,85 @@ class TTest(Test):
         return exitcode, postout
 
     def _process_out_line(self, out_line, pos, postout, expected, warnonly):
-        if True:
-            while out_line:
-                if not out_line.endswith(b'\n'):
-                    out_line += b' (no-eol)\n'
-
-                # Find the expected output at the current position.
-                els = [None]
-                if expected.get(pos, None):
-                    els = expected[pos]
-
-                optional = []
-                for i, el in enumerate(els):
-                    r = False
-                    assert el is None or bool(el)
-                    if el:
-                        r, exact = self.linematch(el, out_line)
-                    if isinstance(r, str):
-                        if r == '-glob':
-                            out_line = ''.join(el.rsplit(' (glob)', 1))
-                            r = '' # Warn only this line.
-                        elif r == "retry":
-                            postout.append(b'  ' + el)
-                        else:
-                            log('\ninfo, unknown linematch result: %r\n' % r)
-                            r = False
-                    if r:
+        while out_line:
+            if not out_line.endswith(b'\n'):
+                out_line += b' (no-eol)\n'
+
+            # Find the expected output at the current position.
+            els = [None]
+            if expected.get(pos, None):
+                els = expected[pos]
+
+            optional = []
+            for i, el in enumerate(els):
+                r = False
+                assert el is None or bool(el)
+                if el:
+                    r, exact = self.linematch(el, out_line)
+                if isinstance(r, str):
+                    if r == '-glob':
+                        out_line = ''.join(el.rsplit(' (glob)', 1))
+                        r = '' # Warn only this line.
+                    elif r == "retry":
+                        postout.append(b'  ' + el)
+                    else:
+                        log('\ninfo, unknown linematch result: %r\n' % r)
+                        r = False
+                if r:
+                    els.pop(i)
+                    break
+                if el:
+                    if el.endswith(b" (?)\n"):
+                        optional.append(i)
+                    else:
+                        m = optline.match(el)
+                        if m:
+                            conditions = [
+                                c for c in m.group(2).split(b' ')]
+
+                            if not self._iftest(conditions):
+                                optional.append(i)
+                    if exact:
+                        # Don't allow line to be matches against a later
+                        # line in the output
                         els.pop(i)
                         break
-                    if el:
-                        if el.endswith(b" (?)\n"):
-                            optional.append(i)
+
+            if r:
+                if r == "retry":
+                    continue
+                # clean up any optional leftovers
+                for i in optional:
+                    postout.append(b'  ' + els[i])
+                for i in reversed(optional):
+                    del els[i]
+                postout.append(b'  ' + el)
+            else:
+                if self.NEEDESCAPE(out_line):
+                    out_line = TTest._stringescape(b'%s (esc)\n' %
+                                               out_line.rstrip(b'\n'))
+                postout.append(b'  ' + out_line) # Let diff deal with it.
+                if r != '': # If line failed.
+                    warnonly = WARN_NO
+                elif warnonly == WARN_UNDEFINED:
+                    warnonly = WARN_YES
+            break
+        else:
+            # clean up any optional leftovers
+            while expected.get(pos, None):
+                el = expected[pos].pop(0)
+                if el:
+                    if not el.endswith(b" (?)\n"):
+                        m = optline.match(el)
+                        if m:
+                            conditions = [c for c in m.group(2).split(b' ')]
+
+                            if self._iftest(conditions):
+                                # Don't append as optional line
+                                continue
                         else:
-                            m = optline.match(el)
-                            if m:
-                                conditions = [
-                                    c for c in m.group(2).split(b' ')]
-
-                                if not self._iftest(conditions):
-                                    optional.append(i)
-                        if exact:
-                            # Don't allow line to be matches against a later
-                            # line in the output
-                            els.pop(i)
-                            break
-
-                if r:
-                    if r == "retry":
-                        continue
-                    # clean up any optional leftovers
-                    for i in optional:
-                        postout.append(b'  ' + els[i])
-                    for i in reversed(optional):
-                        del els[i]
-                    postout.append(b'  ' + el)
-                else:
-                    if self.NEEDESCAPE(out_line):
-                        out_line = TTest._stringescape(b'%s (esc)\n' %
-                                                   out_line.rstrip(b'\n'))
-                    postout.append(b'  ' + out_line) # Let diff deal with it.
-                    if r != '': # If line failed.
-                        warnonly = WARN_NO
-                    elif warnonly == WARN_UNDEFINED:
-                        warnonly = WARN_YES
-                break
-            else:
-                # clean up any optional leftovers
-                while expected.get(pos, None):
-                    el = expected[pos].pop(0)
-                    if el:
-                        if not el.endswith(b" (?)\n"):
-                            m = optline.match(el)
-                            if m:
-                                conditions = [c for c in m.group(2).split(b' ')]
-
-                                if self._iftest(conditions):
-                                    # Don't append as optional line
-                                    continue
-                            else:
-                                continue
-                    postout.append(b'  ' + el)
+                            continue
+                postout.append(b'  ' + el)
         return pos, postout, warnonly
 
     def _process_cmd_line(self, cmd_line, pos, postout, after):


More information about the Mercurial-devel mailing list