changeset 5125:80309fa23cdb

hghave: feature absence can be checked by prefixing with 'no-'
author Patrick Mezard <pmezard@gmail.com>
date Wed, 08 Aug 2007 23:07:39 +0200
parents f94dbc6c7eaf
children dcfd75502b82
files tests/hghave
diffstat 1 files changed, 9 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/tests/hghave
+++ b/tests/hghave
@@ -1,6 +1,7 @@
 #!/usr/bin/env python
 """Test the running system for features availability. Exit with zero
-if all features are there, non-zero otherwise.
+if all features are there, non-zero otherwise. If a feature name is
+prefixed with "no-", the absence of feature is tested.
 """
 import optparse
 import os
@@ -67,13 +68,19 @@ if __name__ == '__main__':
         failures += 1
 
     for feature in args:
+        negate = feature.startswith('no-')
+        if negate:
+            feature = feature[3:]
+        
         if feature not in checks:
             error('hghave: unknown feature: ' + feature)
             continue
 
         check, desc = checks[feature]
-        if not check():
+        if not negate and not check():
             error('hghave: missing feature: ' + desc)
+        elif negate and check():
+            error('hghave: unexpected feature: ' + desc)
 
     if failures != 0:
         sys.exit(1)