##// END OF EJS Templates
check-code: add 'no tab indent' check for unified tests...
Adrian Buehlmann -
r12743:4c4aeaab default
parent child Browse files
Show More
@@ -72,6 +72,7 b' testfilters = ['
72 ]
72 ]
73
73
74 uprefix = r"^ \$ "
74 uprefix = r"^ \$ "
75 uprefixc = r"^ > "
75 utestpats = [
76 utestpats = [
76 (uprefix + r'.*\|\s*sed', "use regex test output patterns instead of sed"),
77 (uprefix + r'.*\|\s*sed', "use regex test output patterns instead of sed"),
77 (uprefix + r'(true|exit 0)', "explicit zero exit unnecessary"),
78 (uprefix + r'(true|exit 0)', "explicit zero exit unnecessary"),
@@ -79,6 +80,7 b' utestpats = ['
79 (uprefix + r'.*\|\| echo.*(fail|error)',
80 (uprefix + r'.*\|\| echo.*(fail|error)',
80 "explicit exit code checks unnecessary"),
81 "explicit exit code checks unnecessary"),
81 (uprefix + r'set -e', "don't use set -e"),
82 (uprefix + r'set -e', "don't use set -e"),
83 (uprefixc + r'( *)\t', "don't use tabs to indent"),
82 ]
84 ]
83
85
84 for p, m in testpats:
86 for p, m in testpats:
@@ -95,7 +95,7 b' final file versions in this repo:'
95 > fmap="$prefix.fmap"
95 > fmap="$prefix.fmap"
96 > repo="$prefix.repo"
96 > repo="$prefix.repo"
97 > for i in $files; do
97 > for i in $files; do
98 > echo "include $i" >> "$fmap"
98 > echo "include $i" >> "$fmap"
99 > done
99 > done
100 > hg -q convert $opts --filemap "$fmap" --datesort source "$repo"
100 > hg -q convert $opts --filemap "$fmap" --datesort source "$repo"
101 > hg up -q -R "$repo"
101 > hg up -q -R "$repo"
@@ -116,7 +116,7 b' Remove the directory, then try to replac'
116 > fmap="$prefix.fmap"
116 > fmap="$prefix.fmap"
117 > repo="$prefix.repo"
117 > repo="$prefix.repo"
118 > for i in $files; do
118 > for i in $files; do
119 > echo "include $i" >> "$fmap"
119 > echo "include $i" >> "$fmap"
120 > done
120 > done
121 > hg -q convert $opts --filemap "$fmap" --datesort git-repo2 "$repo"
121 > hg -q convert $opts --filemap "$fmap" --datesort git-repo2 "$repo"
122 > hg up -q -R "$repo"
122 > hg up -q -R "$repo"
@@ -24,26 +24,26 b' should be used from d74fc8dec2b4 onward '
24 > input = StringIO()
24 > input = StringIO()
25 >
25 >
26 > def startrsp(status, headers):
26 > def startrsp(status, headers):
27 > print '---- STATUS'
27 > print '---- STATUS'
28 > print status
28 > print status
29 > print '---- HEADERS'
29 > print '---- HEADERS'
30 > print [i for i in headers if i[0] != 'ETag']
30 > print [i for i in headers if i[0] != 'ETag']
31 > print '---- DATA'
31 > print '---- DATA'
32 > return output.write
32 > return output.write
33 >
33 >
34 > env = {
34 > env = {
35 > 'wsgi.version': (1, 0),
35 > 'wsgi.version': (1, 0),
36 > 'wsgi.url_scheme': 'http',
36 > 'wsgi.url_scheme': 'http',
37 > 'wsgi.errors': errors,
37 > 'wsgi.errors': errors,
38 > 'wsgi.input': input,
38 > 'wsgi.input': input,
39 > 'wsgi.multithread': False,
39 > 'wsgi.multithread': False,
40 > 'wsgi.multiprocess': False,
40 > 'wsgi.multiprocess': False,
41 > 'wsgi.run_once': False,
41 > 'wsgi.run_once': False,
42 > 'REQUEST_METHOD': 'GET',
42 > 'REQUEST_METHOD': 'GET',
43 > 'SCRIPT_NAME': '',
43 > 'SCRIPT_NAME': '',
44 > 'SERVER_NAME': '127.0.0.1',
44 > 'SERVER_NAME': '127.0.0.1',
45 > 'SERVER_PORT': os.environ['HGPORT'],
45 > 'SERVER_PORT': os.environ['HGPORT'],
46 > 'SERVER_PROTOCOL': 'HTTP/1.0'
46 > 'SERVER_PROTOCOL': 'HTTP/1.0'
47 > }
47 > }
48 >
48 >
49 > def process(app):
49 > def process(app):
@@ -24,35 +24,34 b' should be used from d74fc8dec2b4 onward '
24 > input = StringIO()
24 > input = StringIO()
25 >
25 >
26 > def startrsp(status, headers):
26 > def startrsp(status, headers):
27 > print '---- STATUS'
27 > print '---- STATUS'
28 > print status
28 > print status
29 > print '---- HEADERS'
29 > print '---- HEADERS'
30 > print [i for i in headers if i[0] != 'ETag']
30 > print [i for i in headers if i[0] != 'ETag']
31 > print '---- DATA'
31 > print '---- DATA'
32 > return output.write
32 > return output.write
33 >
33 >
34 > env = {
34 > env = {
35 > 'wsgi.version': (1, 0),
35 > 'wsgi.version': (1, 0),
36 > 'wsgi.url_scheme': 'http',
36 > 'wsgi.url_scheme': 'http',
37 > 'wsgi.errors': errors,
37 > 'wsgi.errors': errors,
38 > 'wsgi.input': input,
38 > 'wsgi.input': input,
39 > 'wsgi.multithread': False,
39 > 'wsgi.multithread': False,
40 > 'wsgi.multiprocess': False,
40 > 'wsgi.multiprocess': False,
41 > 'wsgi.run_once': False,
41 > 'wsgi.run_once': False,
42 > 'REQUEST_METHOD': 'GET',
42 > 'REQUEST_METHOD': 'GET',
43 > 'SCRIPT_NAME': '',
43 > 'SCRIPT_NAME': '',
44 > 'SERVER_NAME': '127.0.0.1',
44 > 'SERVER_NAME': '127.0.0.1',
45 > 'SERVER_PORT': os.environ['HGPORT'],
45 > 'SERVER_PORT': os.environ['HGPORT'],
46 > 'SERVER_PROTOCOL': 'HTTP/1.0'
46 > 'SERVER_PROTOCOL': 'HTTP/1.0'
47 > }
47 > }
48 >
48 >
49 > def process(app):
49 > def process(app):
50 > content = app(env, startrsp)
50 > content = app(env, startrsp)
51 > sys.stdout.write(output.getvalue())
51 > sys.stdout.write(output.getvalue())
52 > sys.stdout.write(''.join(content))
52 > sys.stdout.write(''.join(content))
53 > print '---- ERRORS'
53 > print '---- ERRORS'
54 > print errors.getvalue()
54 > print errors.getvalue()
55 >
56 >
55 >
57 > output = StringIO()
56 > output = StringIO()
58 > env['PATH_INFO'] = '/'
57 > env['PATH_INFO'] = '/'
@@ -34,28 +34,28 b' by the WSGI standard and strictly implem'
34 > output = StringIO()
34 > output = StringIO()
35 >
35 >
36 > def startrsp(status, headers):
36 > def startrsp(status, headers):
37 > print '---- STATUS'
37 > print '---- STATUS'
38 > print status
38 > print status
39 > print '---- HEADERS'
39 > print '---- HEADERS'
40 > print [i for i in headers if i[0] != 'ETag']
40 > print [i for i in headers if i[0] != 'ETag']
41 > print '---- DATA'
41 > print '---- DATA'
42 > return output.write
42 > return output.write
43 >
43 >
44 > env = {
44 > env = {
45 > 'wsgi.version': (1, 0),
45 > 'wsgi.version': (1, 0),
46 > 'wsgi.url_scheme': 'http',
46 > 'wsgi.url_scheme': 'http',
47 > 'wsgi.errors': errors,
47 > 'wsgi.errors': errors,
48 > 'wsgi.input': input,
48 > 'wsgi.input': input,
49 > 'wsgi.multithread': False,
49 > 'wsgi.multithread': False,
50 > 'wsgi.multiprocess': False,
50 > 'wsgi.multiprocess': False,
51 > 'wsgi.run_once': False,
51 > 'wsgi.run_once': False,
52 > 'REQUEST_METHOD': 'GET',
52 > 'REQUEST_METHOD': 'GET',
53 > 'SCRIPT_NAME': '',
53 > 'SCRIPT_NAME': '',
54 > 'PATH_INFO': '',
54 > 'PATH_INFO': '',
55 > 'QUERY_STRING': '',
55 > 'QUERY_STRING': '',
56 > 'SERVER_NAME': '127.0.0.1',
56 > 'SERVER_NAME': '127.0.0.1',
57 > 'SERVER_PORT': os.environ['HGPORT'],
57 > 'SERVER_PORT': os.environ['HGPORT'],
58 > 'SERVER_PROTOCOL': 'HTTP/1.0'
58 > 'SERVER_PROTOCOL': 'HTTP/1.0'
59 > }
59 > }
60 >
60 >
61 > i = hgweb('.')
61 > i = hgweb('.')
@@ -17,12 +17,12 b' just in case somebody has a strange $TMP'
17 > isdir = {}
17 > isdir = {}
18 > for root, dirs, files in os.walk(sys.argv[1]):
18 > for root, dirs, files in os.walk(sys.argv[1]):
19 > for d in dirs:
19 > for d in dirs:
20 > name = os.path.join(root, d)
20 > name = os.path.join(root, d)
21 > isdir[name] = 1
21 > isdir[name] = 1
22 > allnames.append(name)
22 > allnames.append(name)
23 > for f in files:
23 > for f in files:
24 > name = os.path.join(root, f)
24 > name = os.path.join(root, f)
25 > allnames.append(name)
25 > allnames.append(name)
26 > allnames.sort()
26 > allnames.sort()
27 > for name in allnames:
27 > for name in allnames:
28 > suffix = name in isdir and '/' or ''
28 > suffix = name in isdir and '/' or ''
@@ -16,7 +16,7 b' before d74fc8dec2b4 still work.'
16 > from mercurial.hgweb.request import wsgiapplication
16 > from mercurial.hgweb.request import wsgiapplication
17 >
17 >
18 > def make_web_app():
18 > def make_web_app():
19 > return hgweb("test", "Empty test repository")
19 > return hgweb("test", "Empty test repository")
20 >
20 >
21 > wsgicgi.launch(wsgiapplication(make_web_app))
21 > wsgicgi.launch(wsgiapplication(make_web_app))
22 > HGWEB
22 > HGWEB
@@ -42,7 +42,7 b' before d74fc8dec2b4 still work.'
42 > from mercurial.hgweb.request import wsgiapplication
42 > from mercurial.hgweb.request import wsgiapplication
43 >
43 >
44 > def make_web_app():
44 > def make_web_app():
45 > return hgwebdir("hgweb.config")
45 > return hgwebdir("hgweb.config")
46 >
46 >
47 > wsgicgi.launch(wsgiapplication(make_web_app))
47 > wsgicgi.launch(wsgiapplication(make_web_app))
48 > HGWEBDIR
48 > HGWEBDIR
@@ -6,11 +6,11 b''
6 > p2=$3
6 > p2=$3
7 >
7 >
8 > if [ "$p1" ]; then
8 > if [ "$p1" ]; then
9 > hg up -qC $p1
9 > hg up -qC $p1
10 > fi
10 > fi
11 >
11 >
12 > if [ "$p2" ]; then
12 > if [ "$p2" ]; then
13 > HGMERGE=true hg merge -q $p2
13 > HGMERGE=true hg merge -q $p2
14 > fi
14 > fi
15 >
15 >
16 > echo >> foo
16 > echo >> foo
@@ -41,8 +41,8 b''
41 $ lookup()
41 $ lookup()
42 > {
42 > {
43 > for rev in "$@"; do
43 > for rev in "$@"; do
44 > printf "$rev: "
44 > printf "$rev: "
45 > hg id -nr $rev
45 > hg id -nr $rev
46 > done
46 > done
47 > true
47 > true
48 > }
48 > }
@@ -29,12 +29,12 b' serve errors'
29
29
30 $ cat errors.log
30 $ cat errors.log
31 $ req() {
31 $ req() {
32 > hg serve -p $HGPORT -d --pid-file=hg.pid -E errors.log
32 > hg serve -p $HGPORT -d --pid-file=hg.pid -E errors.log
33 > cat hg.pid >> $DAEMON_PIDS
33 > cat hg.pid >> $DAEMON_PIDS
34 > hg --cwd ../test pull http://localhost:$HGPORT/
34 > hg --cwd ../test pull http://localhost:$HGPORT/
35 > kill `cat hg.pid`
35 > kill `cat hg.pid`
36 > echo % serve errors
36 > echo % serve errors
37 > cat errors.log
37 > cat errors.log
38 > }
38 > }
39
39
40 expect error, pulling not allowed
40 expect error, pulling not allowed
@@ -13,12 +13,12 b''
13 $ echo a >> a
13 $ echo a >> a
14 $ hg ci -mb
14 $ hg ci -mb
15 $ req() {
15 $ req() {
16 > hg serve -p $HGPORT -d --pid-file=hg.pid -E errors.log
16 > hg serve -p $HGPORT -d --pid-file=hg.pid -E errors.log
17 > cat hg.pid >> $DAEMON_PIDS
17 > cat hg.pid >> $DAEMON_PIDS
18 > hg --cwd ../test2 push http://localhost:$HGPORT/
18 > hg --cwd ../test2 push http://localhost:$HGPORT/
19 > kill `cat hg.pid`
19 > kill `cat hg.pid`
20 > echo % serve errors
20 > echo % serve errors
21 > cat errors.log
21 > cat errors.log
22 > }
22 > }
23 $ cd ../test
23 $ cd ../test
24
24
@@ -66,8 +66,8 b' args:'
66 > cp rev $1
66 > cp rev $1
67 > hg add $1 2> /dev/null
67 > hg add $1 2> /dev/null
68 > if [ "$2" != "" ] ; then
68 > if [ "$2" != "" ] ; then
69 > cp rev $2
69 > cp rev $2
70 > hg add $2 2> /dev/null
70 > hg add $2 2> /dev/null
71 > fi
71 > fi
72 > }
72 > }
73 $ uc() { up $1; hg cp $1 $2; } # update + copy
73 $ uc() { up $1; hg cp $1 $2; } # update + copy
General Comments 0
You need to be logged in to leave comments. Login now