Show More
@@ -0,0 +1,20 b'' | |||||
|
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') |
General Comments 0
You need to be logged in to leave comments.
Login now