tests/test-check-code-hg.py
changeset 11762 8b03c988efb3
child 11771 b0e3d3973440
equal deleted inserted replaced
11761:e27a0fa7ba59 11762:8b03c988efb3
       
     1 # Pass all working directory files through check-code.py
       
     2 
       
     3 import sys, os, imp
       
     4 rootdir = os.path.abspath(os.path.join(os.path.dirname(sys.argv[0]), '..'))
       
     5 if not os.path.isdir(os.path.join(rootdir, '.hg')):
       
     6     sys.stderr.write('skipped: cannot check code on non-repository sources\n')
       
     7     sys.exit(80)
       
     8 
       
     9 checkpath = os.path.join(rootdir, 'contrib/check-code.py')
       
    10 checkcode = imp.load_source('checkcode', checkpath)
       
    11 
       
    12 from mercurial import hg, ui
       
    13 u = ui.ui()
       
    14 repo = hg.repository(u, rootdir)
       
    15 checked = 0
       
    16 for f in repo[None]:
       
    17     checked += 1
       
    18     checkcode.checkfile(os.path.join(rootdir, f))
       
    19 if not checked:
       
    20     sys.stderr.write('no file checked!\n')