mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-04-09 21:44:28 +00:00
Improve support for submodules in code_style.py
This commit improves support for submodules within code_style.py. A new function get_submodule_hash retrieves the submodule hash at the time of a commit allowing an appropriate diff to be seen. Signed-off-by: Harry Ramsey <harry.ramsey@arm.com>
This commit is contained in:
parent
467edcd64a
commit
da8f42a357
@ -103,8 +103,10 @@ def get_src_files(since: Optional[str]) -> List[str]:
|
|||||||
"--name-only", "--pretty=", "--"] + src_files
|
"--name-only", "--pretty=", "--"] + src_files
|
||||||
output = subprocess.check_output(cmd, universal_newlines=True)
|
output = subprocess.check_output(cmd, universal_newlines=True)
|
||||||
committed_changed_files = output.split()
|
committed_changed_files = output.split()
|
||||||
|
|
||||||
# ... the framework submodule
|
# ... the framework submodule
|
||||||
cmd = ["git", "-C", "framework", "log", since + "..HEAD",
|
framework_since = get_submodule_hash(since, "framework")
|
||||||
|
cmd = ["git", "-C", "framework", "log", framework_since + "..HEAD",
|
||||||
"--name-only", "--pretty=", "--"] + framework_src_files
|
"--name-only", "--pretty=", "--"] + framework_src_files
|
||||||
output = subprocess.check_output(cmd, universal_newlines=True,
|
output = subprocess.check_output(cmd, universal_newlines=True,
|
||||||
env=framework_env)
|
env=framework_env)
|
||||||
@ -137,6 +139,12 @@ def get_src_files(since: Optional[str]) -> List[str]:
|
|||||||
is_file_autogenerated(filename))]
|
is_file_autogenerated(filename))]
|
||||||
return src_files
|
return src_files
|
||||||
|
|
||||||
|
def get_submodule_hash(commit: str, submodule: str) -> str:
|
||||||
|
"""Get the commit hash of a submodule at a given commit in the Git repository."""
|
||||||
|
cmd = ["git", "ls-tree", commit, submodule]
|
||||||
|
output = subprocess.check_output(cmd, universal_newlines=True)
|
||||||
|
return output.split()[2]
|
||||||
|
|
||||||
def get_uncrustify_version() -> str:
|
def get_uncrustify_version() -> str:
|
||||||
"""
|
"""
|
||||||
Get the version string from Uncrustify
|
Get the version string from Uncrustify
|
||||||
|
Loading…
x
Reference in New Issue
Block a user