diff --git a/cadetrdm/options.py b/cadetrdm/options.py index b4d24a6..63c0fd5 100644 --- a/cadetrdm/options.py +++ b/cadetrdm/options.py @@ -86,7 +86,7 @@ def load_json_str(cls, string, **loader_kwargs): return cls.loads(string) def get_hash(self): - excluded_keys = {"commit_message", "push", "debug", "force"} + excluded_keys = {"branch_prefix", "commit_message", "push", "debug", "force"} remaining_dict = remove_invalid_keys(self, excluded_keys=excluded_keys) dump = json.dumps( remaining_dict, diff --git a/cadetrdm/repositories.py b/cadetrdm/repositories.py index 595e79f..52125a2 100644 --- a/cadetrdm/repositories.py +++ b/cadetrdm/repositories.py @@ -948,12 +948,11 @@ def get_new_output_branch_name(self): project_repo_hash = str(self.head.commit) timestamp = datetime.now().strftime("%Y-%m-%d_%H-%M-%S") + branch_name = f"{timestamp}_{self.active_branch}_{project_repo_hash[:7]}" + if self.options and "branch_prefix" in self.options: - branch_prefix = self.options["branch_prefix"]+"_" - else: - branch_prefix = "" + branch_name = f"{self.options['branch_prefix']}_{branch_name}" - branch_name = branch_prefix+"_".join([timestamp, str(self.active_branch), project_repo_hash[:7]]) return branch_name def check_results_main(self):