[PATCH 5 of 5] import-checker.py: exit with code 0 if no error is detected
FUJIWARA Katsunori
foozy at lares.dti.ne.jp
Thu Jul 2 17:01:08 CDT 2015
# HG changeset patch
# User FUJIWARA Katsunori <foozy at lares.dti.ne.jp>
# Date 1435874163 -32400
# Fri Jul 03 06:56:03 2015 +0900
# Node ID e1f6ba63d808acfd63c9f1e4f4fa4c4da18034ff
# Parent 33c77d0d272602d1aaafd8424617fbb568a429d3
import-checker.py: exit with code 0 if no error is detected
Before this patch, `import-checker.py` exits with non-0 code, if no
error is detected. This is unusual as Unix command.
This change may be a one of preparations for issue4677, because this
can avoid extra explanation about unusual exit code of
`import-checker.py` for third party tool developers.
diff --git a/contrib/import-checker.py b/contrib/import-checker.py
--- a/contrib/import-checker.py
+++ b/contrib/import-checker.py
@@ -564,7 +564,7 @@
print 'Import cycle:', c
firstmods.add(first)
any_errors = True
- return not any_errors
+ return any_errors != 0
if __name__ == '__main__':
sys.exit(int(main(sys.argv)))
diff --git a/tests/test-module-imports.t b/tests/test-module-imports.t
--- a/tests/test-module-imports.t
+++ b/tests/test-module-imports.t
@@ -101,6 +101,7 @@
testpackage/subpackage/levelpriority.py higher-level import should come first: testpackage
testpackage/symbolimport.py direct symbol import from testpackage.unsorted
testpackage/unsorted.py imports not lexically sorted: os < sys
+ [1]
$ cd "$TESTDIR"/..
@@ -129,3 +130,4 @@
Import cycle: mercurial.cmdutil -> mercurial.context -> mercurial.subrepo -> mercurial.cmdutil
Import cycle: hgext.largefiles.basestore -> hgext.largefiles.localstore -> hgext.largefiles.basestore
Import cycle: mercurial.commands -> mercurial.commandserver -> mercurial.dispatch -> mercurial.commands
+ [1]
More information about the Mercurial-devel
mailing list