# HG changeset patch # User Patrick Mezard # Date 1186607259 -7200 # Node ID 80309fa23cdbdf8e62fbd028acc74c994cafd458 # Parent f94dbc6c7eaf295569c2a88d9ce0b1dbf4f3ecca hghave: feature absence can be checked by prefixing with 'no-' diff --git a/tests/hghave b/tests/hghave --- 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)