[PATCH 1 of 2 RFC] tests/hghave: extract hghave.py

Adrian Buehlmann adrian at cadifra.com
Tue Jun 12 07:58:31 CDT 2012


On 2012-06-12 13:39, Mads Kiilerich wrote:
> On 12/06/12 13:17, Adrian Buehlmann wrote:
>> # HG changeset patch
>> # User Adrian Buehlmann <adrian at cadifra.com>
>> # Date 1339495270 -7200
>> # Node ID a52c543f0523f83d0c313b934646e9692fae254a
>> # Parent  b112e265b78a614dac15d5be92d39926d5e653da
>> tests/hghave: extract hghave.py
>>
>> hghave is degraded to a bare script, moving the functions to hghave.py
>> so they can be shared later on.
> 
> I would start by introducing a '#require' syntax that could replace 
> hghave completely.
> 
> Before that I would convert as many of the remaining hghave's as 
> possible to #if.

Does that mean that if my patches would be taken, they are not an
improvement or that the would morph the code into a direction which is
not what's wanted?

In other words: What exactly is wrong with these patches?

My patches don't block doing what you say, but doing what your are
saying is not required to apply my patches.

Or in other words: are you opposings these of my patches? And if yes, why?

If hghave as a script is dropped later, then that's perfectly compatible
with my patches.

The new hghave.py contains functions that check those features and they
are now called directly with these two patches instead of starting
another supproccess just to start hghave as script.

Isn't

diff --git a/tests/run-tests.py b/tests/run-tests.py
--- a/tests/run-tests.py
+++ b/tests/run-tests.py
@@ -54,6 +54,7 @@
 import time
 import re
 import threading
+import hghave

 processlock = threading.Lock()

@@ -597,17 +598,6 @@
     # True or False when in a true or false conditional section
     skipping = None

-    def hghave(reqs):
-        # TODO: do something smarter when all other uses of hghave is gone
-        tdir = TESTDIR.replace('\\', '/')
-        proc = Popen4('%s -c "%s/hghave %s"' %
-                      (options.shell, tdir, ' '.join(reqs)), wd, 0)
-        proc.communicate()
-        ret = proc.wait()
-        if wifexited(ret):
-            ret = os.WEXITSTATUS(ret)
-        return ret == 0
-
     f = open(test)
     t = f.readlines()
     f.close()
@@ -623,7 +613,7 @@
         if l.startswith('#if'):
             if skipping is not None:
                 after.setdefault(pos, []).append('  !!! nested #if\n')
-            skipping = not hghave(l.split()[1:])
+            skipping = not hghave.testfeatures(l.split()[1:])
             after.setdefault(pos, []).append(l)
         elif l.startswith('#else'):
             if skipping is None:

this an improvement?

If not, why?



More information about the Mercurial-devel mailing list