# HG changeset patch # User FUJIWARA Katsunori # Date 1431535750 -32400 # Node ID 3bbbadf69d0a2e7404d44e84086baf9f4766c756 # Parent 723e364488f41bcb3a035df6032c4ec6beef9602 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. diff -r 723e364488f4 -r 3bbbadf69d0a contrib/import-checker.py --- 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))