diff --git a/RELEASE_NOTES.rst b/RELEASE_NOTES.rst index ca44919d..a7ee354f 100644 --- a/RELEASE_NOTES.rst +++ b/RELEASE_NOTES.rst @@ -1,8 +1,16 @@ Release notes ============= +0.19 +---- + +* ``openstack-doc-test``: Optimize translation imports, improve output + messages. +* ``autohelp.py``: Improve sanitizer. + 0.18.1 ------ + * Fix ``doc-tools-check-languages`` to handle all repositories and setups. diff --git a/os_doc_tools/doctest.py b/os_doc_tools/doctest.py index 0b6c4bd5..e181f9b2 100755 --- a/os_doc_tools/doctest.py +++ b/os_doc_tools/doctest.py @@ -319,6 +319,27 @@ def www_touched(): return www_changed and not other_changed +def only_po_touched(): + """Check whether only files in locale directory are touched.""" + + try: + git_args = ["git", "diff", "--name-only", "HEAD~1", "HEAD"] + modified_files = check_output(git_args).strip().split() + except (subprocess.CalledProcessError, OSError) as e: + print("git failed: %s" % e) + sys.exit(1) + + locale_changed = False + other_changed = False + for f in modified_files: + if "/locale/" in f and f.endswith((".po", ".pot")): + locale_changed = True + else: + other_changed = True + + return locale_changed and not other_changed + + def check_modified_affects_all(rootdir): """Check whether special files were modified. @@ -1447,6 +1468,10 @@ def doctest(): print("Only files in www directory changed, nothing to do.\n") return + if not CONF.force and not CONF.language and only_po_touched(): + print("Only files in locale directories changed, nothing to do.\n") + return + if CONF.check_syntax or CONF.check_niceness or CONF.check_links: if CONF.force: errors += validate_all_files(doc_path, FILE_EXCEPTIONS,