diff --git a/tools/importer/README.md b/tools/importer/README.md index e5d2ca1cce..8174a09901 100644 --- a/tools/importer/README.md +++ b/tools/importer/README.md @@ -16,6 +16,7 @@ Note: Only files present in folder will be copied, directories inside the folder `commit_sha` is list of commits present in mbed-os repo. These commits will be applied after copying files and folders listed above.Each commit in the commit_sha list is cherry-picked and applied with the -x option, which records the SHA of the source commit in the commit message. Note: You must resolve any conflicts that arise during this cherry-pick process. Make sure that the "(cherry picked from commit ...)" statement is present in the commit message. Re-execute the python script to apply rest of the SHA commits. +```json { "files" : [ { @@ -41,9 +42,10 @@ Note: You must resolve any conflicts that arise during this cherry-pick process. ], "commit_sha" : [ "428acae1b2ac15c3ad523e8d40755a9301220822", - "d9d622afe0ca8c7ab9d24c17f9fe59b54dcc61c9", + {"sha": "d9d622afe0ca8c7ab9d24c17f9fe59b54dcc61c9", "msg": "Fix ..."} ] } +``` ### Input to importer.py 1. Repository: -r ( Example: CMSIS / Mbed-tls) diff --git a/tools/importer/importer.py b/tools/importer/importer.py index b2d1138507..2b67105c49 100644 --- a/tools/importer/importer.py +++ b/tools/importer/importer.py @@ -157,6 +157,10 @@ def get_last_cherry_pick_sha(branch): return sha +def normalize_commit_sha(sha_lst): + return [_sha['sha'] if isinstance(_sha, dict) else _sha for _sha in sha_lst] + + if __name__ == "__main__": parser = argparse.ArgumentParser(description=__doc__, @@ -269,7 +273,7 @@ if __name__ == "__main__": # Checkout the feature branch branch_checkout(branch) - commit_sha = json_data["commit_sha"] + commit_sha = normalize_commit_sha(json_data["commit_sha"]) last_sha = get_last_cherry_pick_sha(branch) # Few commits are already applied, check the next in sequence