import-checker.py: exit with code 0 if no error is detected
authorFUJIWARA Katsunori <foozy@lares.dti.ne.jp>
Fri, 03 Jul 2015 06:56:03 +0900
changeset 25731 cd1daab5d036
parent 25730 c380d5273e91
child 25732 b94df10cc3b5
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.
contrib/import-checker.py
tests/test-module-imports.t
--- a/contrib/import-checker.py	Fri Jul 03 06:56:03 2015 +0900
+++ b/contrib/import-checker.py	Fri Jul 03 06:56:03 2015 +0900
@@ -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)))
--- a/tests/test-module-imports.t	Fri Jul 03 06:56:03 2015 +0900
+++ b/tests/test-module-imports.t	Fri Jul 03 06:56:03 2015 +0900
@@ -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]