diff contrib/import-checker.py @ 25064:3bbbadf69d0a

import-checker: loop to get list of locally defined modules at first This is a preparation for subsequent patches, which expect that all locally defined (= mercurial specific) modules are already known before examinations. Looping twice for specified modules is a little redundant, but reasonable cost for improvement in subsequent patches.
author FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
date Thu, 14 May 2015 01:49:10 +0900
parents 723e364488f4
children 7358b5d9991e
line wrap: on
line diff
--- a/contrib/import-checker.py	Thu May 14 01:49:10 2015 +0900
+++ b/contrib/import-checker.py	Thu May 14 01:49:10 2015 +0900
@@ -221,11 +221,14 @@
     if argv[1] == '-':
         argv = argv[:1]
         argv.extend(l.rstrip() for l in sys.stdin.readlines())
+    localmods = {}
     used_imports = {}
     any_errors = False
     for source_path in argv[1:]:
+        modname = dotted_name_of_path(source_path, trimpure=True)
+        localmods[modname] = source_path
+    for modname, source_path in sorted(localmods.iteritems()):
         f = open(source_path)
-        modname = dotted_name_of_path(source_path, trimpure=True)
         src = f.read()
         used_imports[modname] = sorted(
             imported_modules(src, ignore_nested=True))