diff options
Diffstat (limited to 'tools/tryselect/push.py')
-rw-r--r-- | tools/tryselect/push.py | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/tools/tryselect/push.py b/tools/tryselect/push.py index cf5e646c8c..a4811682bc 100644 --- a/tools/tryselect/push.py +++ b/tools/tryselect/push.py @@ -121,7 +121,7 @@ def task_labels_from_try_config(try_task_config): if try_task_config["version"] == 2: parameters = try_task_config.get("parameters", {}) if "try_task_config" in parameters: - return parameters["try_task_config"]["tasks"] + return parameters["try_task_config"].get("tasks") else: return None elif try_task_config["version"] == 1: @@ -183,6 +183,21 @@ def display_push_estimates(try_task_config): ) +# improves on `" ".join(sys.argv[:])` by requoting argv items containing spaces or single quotes +def get_sys_argv(injected_argv=None): + argv_to_use = injected_argv or sys.argv[:] + + formatted_argv = [] + for item in argv_to_use: + if " " in item or "'" in item: + formatted_item = f'"{item}"' + else: + formatted_item = item + formatted_argv.append(formatted_item) + + return " ".join(formatted_argv) + + def push_to_try( method, msg, @@ -206,9 +221,12 @@ def push_to_try( # Format the commit message closed_tree_string = " ON A CLOSED TREE" if closed_tree else "" - commit_message = "{}{}\n\nPushed via `mach try {}`".format( + the_cmdline = get_sys_argv() + full_commandline_entry = f"mach try command: `{the_cmdline}`" + commit_message = "{}{}\n\n{}\n\nPushed via `mach try {}`".format( msg, closed_tree_string, + full_commandline_entry, method, ) |