Avoid traceback caused by bogus date input (issue3344)
Wrap datefilters which split date texts with util.parsedate.
We do not abort, as the bogus date must have been given by the user.
#!/usr/bin/env python"""Test the running system for features availability. Exit with zeroif all features are there, non-zero otherwise. If a feature name isprefixed with "no-", the absence of feature is tested."""importoptparseimportsysimporthghavechecks=hghave.checksdeflist_features():forname,featureinchecks.iteritems():desc=feature[1]printname+':',descdeftest_features():failed=0forname,featureinchecks.iteritems():check,_=featuretry:check()exceptException,e:print"feature %s failed: %s"%(name,e)failed+=1returnfailedparser=optparse.OptionParser("%prog [options] [features]")parser.add_option("--test-features",action="store_true",help="test available features")parser.add_option("--list-features",action="store_true",help="list available features")parser.add_option("-q","--quiet",action="store_true",help="check features silently")if__name__=='__main__':options,args=parser.parse_args()ifoptions.list_features:list_features()sys.exit(0)ifoptions.test_features:sys.exit(test_features())quiet=options.quietfailures=0deferror(msg):globalfailuresifnotquiet:sys.stderr.write(msg+'\n')failures+=1forfeatureinargs:negate=feature.startswith('no-')ifnegate:feature=feature[3:]iffeaturenotinchecks:error('skipped: unknown feature: '+feature)continuecheck,desc=checks[feature]try:available=check()exceptException,e:error('hghave check failed: '+feature)continueifnotnegateandnotavailable:error('skipped: missing feature: '+desc)elifnegateandavailable:error('skipped: system supports %s'%desc)iffailures!=0:sys.exit(1)