# HG changeset patch # User Adrian Buehlmann # Date 2010-10-16 16:09:01 # Node ID 4c4aeaab233905def16e69972567f01ed31936e0 # Parent 6ab4a7d3c1791b2b7344854b22a6e94afa21481a check-code: add 'no tab indent' check for unified tests and fix the offending tests accordingly diff --git a/contrib/check-code.py b/contrib/check-code.py --- a/contrib/check-code.py +++ b/contrib/check-code.py @@ -72,6 +72,7 @@ testfilters = [ ] uprefix = r"^ \$ " +uprefixc = r"^ > " utestpats = [ (uprefix + r'.*\|\s*sed', "use regex test output patterns instead of sed"), (uprefix + r'(true|exit 0)', "explicit zero exit unnecessary"), @@ -79,6 +80,7 @@ utestpats = [ (uprefix + r'.*\|\| echo.*(fail|error)', "explicit exit code checks unnecessary"), (uprefix + r'set -e', "don't use set -e"), + (uprefixc + r'( *)\t', "don't use tabs to indent"), ] for p, m in testpats: diff --git a/tests/test-convert-filemap.t b/tests/test-convert-filemap.t --- a/tests/test-convert-filemap.t +++ b/tests/test-convert-filemap.t @@ -95,7 +95,7 @@ final file versions in this repo: > fmap="$prefix.fmap" > repo="$prefix.repo" > for i in $files; do - > echo "include $i" >> "$fmap" + > echo "include $i" >> "$fmap" > done > hg -q convert $opts --filemap "$fmap" --datesort source "$repo" > hg up -q -R "$repo" diff --git a/tests/test-convert-git.t b/tests/test-convert-git.t --- a/tests/test-convert-git.t +++ b/tests/test-convert-git.t @@ -116,7 +116,7 @@ Remove the directory, then try to replac > fmap="$prefix.fmap" > repo="$prefix.repo" > for i in $files; do - > echo "include $i" >> "$fmap" + > echo "include $i" >> "$fmap" > done > hg -q convert $opts --filemap "$fmap" --datesort git-repo2 "$repo" > hg up -q -R "$repo" diff --git a/tests/test-hgweb-no-path-info.t b/tests/test-hgweb-no-path-info.t --- a/tests/test-hgweb-no-path-info.t +++ b/tests/test-hgweb-no-path-info.t @@ -24,26 +24,26 @@ should be used from d74fc8dec2b4 onward > input = StringIO() > > def startrsp(status, headers): - > print '---- STATUS' - > print status - > print '---- HEADERS' - > print [i for i in headers if i[0] != 'ETag'] - > print '---- DATA' - > return output.write + > print '---- STATUS' + > print status + > print '---- HEADERS' + > print [i for i in headers if i[0] != 'ETag'] + > print '---- DATA' + > return output.write > > env = { - > 'wsgi.version': (1, 0), - > 'wsgi.url_scheme': 'http', - > 'wsgi.errors': errors, - > 'wsgi.input': input, - > 'wsgi.multithread': False, - > 'wsgi.multiprocess': False, - > 'wsgi.run_once': False, - > 'REQUEST_METHOD': 'GET', - > 'SCRIPT_NAME': '', - > 'SERVER_NAME': '127.0.0.1', - > 'SERVER_PORT': os.environ['HGPORT'], - > 'SERVER_PROTOCOL': 'HTTP/1.0' + > 'wsgi.version': (1, 0), + > 'wsgi.url_scheme': 'http', + > 'wsgi.errors': errors, + > 'wsgi.input': input, + > 'wsgi.multithread': False, + > 'wsgi.multiprocess': False, + > 'wsgi.run_once': False, + > 'REQUEST_METHOD': 'GET', + > 'SCRIPT_NAME': '', + > 'SERVER_NAME': '127.0.0.1', + > 'SERVER_PORT': os.environ['HGPORT'], + > 'SERVER_PROTOCOL': 'HTTP/1.0' > } > > def process(app): diff --git a/tests/test-hgweb-no-request-uri.t b/tests/test-hgweb-no-request-uri.t --- a/tests/test-hgweb-no-request-uri.t +++ b/tests/test-hgweb-no-request-uri.t @@ -24,35 +24,34 @@ should be used from d74fc8dec2b4 onward > input = StringIO() > > def startrsp(status, headers): - > print '---- STATUS' - > print status - > print '---- HEADERS' - > print [i for i in headers if i[0] != 'ETag'] - > print '---- DATA' - > return output.write + > print '---- STATUS' + > print status + > print '---- HEADERS' + > print [i for i in headers if i[0] != 'ETag'] + > print '---- DATA' + > return output.write > > env = { - > 'wsgi.version': (1, 0), - > 'wsgi.url_scheme': 'http', - > 'wsgi.errors': errors, - > 'wsgi.input': input, - > 'wsgi.multithread': False, - > 'wsgi.multiprocess': False, - > 'wsgi.run_once': False, - > 'REQUEST_METHOD': 'GET', - > 'SCRIPT_NAME': '', - > 'SERVER_NAME': '127.0.0.1', - > 'SERVER_PORT': os.environ['HGPORT'], - > 'SERVER_PROTOCOL': 'HTTP/1.0' + > 'wsgi.version': (1, 0), + > 'wsgi.url_scheme': 'http', + > 'wsgi.errors': errors, + > 'wsgi.input': input, + > 'wsgi.multithread': False, + > 'wsgi.multiprocess': False, + > 'wsgi.run_once': False, + > 'REQUEST_METHOD': 'GET', + > 'SCRIPT_NAME': '', + > 'SERVER_NAME': '127.0.0.1', + > 'SERVER_PORT': os.environ['HGPORT'], + > 'SERVER_PROTOCOL': 'HTTP/1.0' > } > > def process(app): - > content = app(env, startrsp) - > sys.stdout.write(output.getvalue()) - > sys.stdout.write(''.join(content)) - > print '---- ERRORS' - > print errors.getvalue() - > + > content = app(env, startrsp) + > sys.stdout.write(output.getvalue()) + > sys.stdout.write(''.join(content)) + > print '---- ERRORS' + > print errors.getvalue() > > output = StringIO() > env['PATH_INFO'] = '/' diff --git a/tests/test-hgweb-non-interactive.t b/tests/test-hgweb-non-interactive.t --- a/tests/test-hgweb-non-interactive.t +++ b/tests/test-hgweb-non-interactive.t @@ -34,28 +34,28 @@ by the WSGI standard and strictly implem > output = StringIO() > > def startrsp(status, headers): - > print '---- STATUS' - > print status - > print '---- HEADERS' - > print [i for i in headers if i[0] != 'ETag'] - > print '---- DATA' - > return output.write + > print '---- STATUS' + > print status + > print '---- HEADERS' + > print [i for i in headers if i[0] != 'ETag'] + > print '---- DATA' + > return output.write > > env = { - > 'wsgi.version': (1, 0), - > 'wsgi.url_scheme': 'http', - > 'wsgi.errors': errors, - > 'wsgi.input': input, - > 'wsgi.multithread': False, - > 'wsgi.multiprocess': False, - > 'wsgi.run_once': False, - > 'REQUEST_METHOD': 'GET', - > 'SCRIPT_NAME': '', - > 'PATH_INFO': '', - > 'QUERY_STRING': '', - > 'SERVER_NAME': '127.0.0.1', - > 'SERVER_PORT': os.environ['HGPORT'], - > 'SERVER_PROTOCOL': 'HTTP/1.0' + > 'wsgi.version': (1, 0), + > 'wsgi.url_scheme': 'http', + > 'wsgi.errors': errors, + > 'wsgi.input': input, + > 'wsgi.multithread': False, + > 'wsgi.multiprocess': False, + > 'wsgi.run_once': False, + > 'REQUEST_METHOD': 'GET', + > 'SCRIPT_NAME': '', + > 'PATH_INFO': '', + > 'QUERY_STRING': '', + > 'SERVER_NAME': '127.0.0.1', + > 'SERVER_PORT': os.environ['HGPORT'], + > 'SERVER_PROTOCOL': 'HTTP/1.0' > } > > i = hgweb('.') diff --git a/tests/test-inherit-mode.t b/tests/test-inherit-mode.t --- a/tests/test-inherit-mode.t +++ b/tests/test-inherit-mode.t @@ -17,12 +17,12 @@ just in case somebody has a strange $TMP > isdir = {} > for root, dirs, files in os.walk(sys.argv[1]): > for d in dirs: - > name = os.path.join(root, d) - > isdir[name] = 1 - > allnames.append(name) + > name = os.path.join(root, d) + > isdir[name] = 1 + > allnames.append(name) > for f in files: - > name = os.path.join(root, f) - > allnames.append(name) + > name = os.path.join(root, f) + > allnames.append(name) > allnames.sort() > for name in allnames: > suffix = name in isdir and '/' or '' diff --git a/tests/test-newcgi.t b/tests/test-newcgi.t --- a/tests/test-newcgi.t +++ b/tests/test-newcgi.t @@ -16,7 +16,7 @@ before d74fc8dec2b4 still work. > from mercurial.hgweb.request import wsgiapplication > > def make_web_app(): - > return hgweb("test", "Empty test repository") + > return hgweb("test", "Empty test repository") > > wsgicgi.launch(wsgiapplication(make_web_app)) > HGWEB @@ -42,7 +42,7 @@ before d74fc8dec2b4 still work. > from mercurial.hgweb.request import wsgiapplication > > def make_web_app(): - > return hgwebdir("hgweb.config") + > return hgwebdir("hgweb.config") > > wsgicgi.launch(wsgiapplication(make_web_app)) > HGWEBDIR diff --git a/tests/test-parentrevspec.t b/tests/test-parentrevspec.t --- a/tests/test-parentrevspec.t +++ b/tests/test-parentrevspec.t @@ -6,11 +6,11 @@ > p2=$3 > > if [ "$p1" ]; then - > hg up -qC $p1 + > hg up -qC $p1 > fi > > if [ "$p2" ]; then - > HGMERGE=true hg merge -q $p2 + > HGMERGE=true hg merge -q $p2 > fi > > echo >> foo @@ -41,8 +41,8 @@ $ lookup() > { > for rev in "$@"; do - > printf "$rev: " - > hg id -nr $rev + > printf "$rev: " + > hg id -nr $rev > done > true > } diff --git a/tests/test-pull-http.t b/tests/test-pull-http.t --- a/tests/test-pull-http.t +++ b/tests/test-pull-http.t @@ -29,12 +29,12 @@ serve errors $ cat errors.log $ req() { - > hg serve -p $HGPORT -d --pid-file=hg.pid -E errors.log - > cat hg.pid >> $DAEMON_PIDS - > hg --cwd ../test pull http://localhost:$HGPORT/ - > kill `cat hg.pid` - > echo % serve errors - > cat errors.log + > hg serve -p $HGPORT -d --pid-file=hg.pid -E errors.log + > cat hg.pid >> $DAEMON_PIDS + > hg --cwd ../test pull http://localhost:$HGPORT/ + > kill `cat hg.pid` + > echo % serve errors + > cat errors.log > } expect error, pulling not allowed diff --git a/tests/test-push-http.t b/tests/test-push-http.t --- a/tests/test-push-http.t +++ b/tests/test-push-http.t @@ -13,12 +13,12 @@ $ echo a >> a $ hg ci -mb $ req() { - > hg serve -p $HGPORT -d --pid-file=hg.pid -E errors.log - > cat hg.pid >> $DAEMON_PIDS - > hg --cwd ../test2 push http://localhost:$HGPORT/ - > kill `cat hg.pid` - > echo % serve errors - > cat errors.log + > hg serve -p $HGPORT -d --pid-file=hg.pid -E errors.log + > cat hg.pid >> $DAEMON_PIDS + > hg --cwd ../test2 push http://localhost:$HGPORT/ + > kill `cat hg.pid` + > echo % serve errors + > cat errors.log > } $ cd ../test diff --git a/tests/test-rename-merge2.t b/tests/test-rename-merge2.t --- a/tests/test-rename-merge2.t +++ b/tests/test-rename-merge2.t @@ -66,8 +66,8 @@ args: > cp rev $1 > hg add $1 2> /dev/null > if [ "$2" != "" ] ; then - > cp rev $2 - > hg add $2 2> /dev/null + > cp rev $2 + > hg add $2 2> /dev/null > fi > } $ uc() { up $1; hg cp $1 $2; } # update + copy