Skip to content
Snippets Groups Projects
Commit b71d2f18 authored by Ronald Jäpel's avatar Ronald Jäpel
Browse files

Restructure log.csv for better readability

parent 4c4a2891
No related branches found
No related tags found
No related merge requests found
...@@ -169,7 +169,7 @@ def initialize_from_remote(project_url, path_to_repo: str = None): ...@@ -169,7 +169,7 @@ def initialize_from_remote(project_url, path_to_repo: str = None):
with open(json_path, "r") as file_handle: with open(json_path, "r") as file_handle:
meta_dict = json.load(file_handle) meta_dict = json.load(file_handle)
output_folder_name = os.path.join(path_to_repo, meta_dict["output_foldername"]) output_folder_name = os.path.join(path_to_repo, meta_dict["output_folder_name"])
ssh_remotes = list(meta_dict["output_remotes"].values()) ssh_remotes = list(meta_dict["output_remotes"].values())
http_remotes = [ssh_url_to_http_url(url) for url in ssh_remotes] http_remotes = [ssh_url_to_http_url(url) for url in ssh_remotes]
for output_remote in ssh_remotes + http_remotes: for output_remote in ssh_remotes + http_remotes:
......
...@@ -328,8 +328,8 @@ class ProjectRepo(BaseRepo): ...@@ -328,8 +328,8 @@ class ProjectRepo(BaseRepo):
:return: the new branch name :return: the new branch name
""" """
project_repo_hash = str(self.head.commit) project_repo_hash = str(self.head.commit)
timestamp = datetime.now().strftime("%Y-%m-%d-%H-%M-%S-%f")[:-4] timestamp = datetime.now().strftime("%Y-%m-%d_%H-%M-%S")
branch_name = "_".join([str(self.active_branch), project_repo_hash[:7], self.output_folder, timestamp]) branch_name = "_".join([self.output_folder, "from", str(self.active_branch), project_repo_hash[:7], timestamp])
return branch_name return branch_name
def check_results_master(self): def check_results_master(self):
...@@ -345,7 +345,7 @@ class ProjectRepo(BaseRepo): ...@@ -345,7 +345,7 @@ class ProjectRepo(BaseRepo):
""" """
self._output_repo._git.checkout(self._most_recent_branch) self._output_repo._git.checkout(self._most_recent_branch)
def update_output_master_logs(self, message=None): def update_output_master_logs(self, ):
""" """
Dumps all the metadata information about the project repositories state and Dumps all the metadata information about the project repositories state and
the commit hash and branch name of the ouput repository into the master branch of the commit hash and branch name of the ouput repository into the master branch of
...@@ -354,6 +354,7 @@ class ProjectRepo(BaseRepo): ...@@ -354,6 +354,7 @@ class ProjectRepo(BaseRepo):
output_branch_name = str(self._output_repo.active_branch) output_branch_name = str(self._output_repo.active_branch)
output_repo_hash = str(self._output_repo.head.commit) output_repo_hash = str(self._output_repo.head.commit)
output_commit_message = self._output_repo.active_branch.commit.message
self._output_repo._git.checkout("master") self._output_repo._git.checkout("master")
...@@ -366,12 +367,14 @@ class ProjectRepo(BaseRepo): ...@@ -366,12 +367,14 @@ class ProjectRepo(BaseRepo):
# this also has to be changed in the gitattributes of the init repo func # this also has to be changed in the gitattributes of the init repo func
csv_filepath = os.path.join(logs_folderpath, "log.csv") csv_filepath = os.path.join(logs_folderpath, "log.csv")
meta_info_dict = {"Output repo branch": output_branch_name, meta_info_dict = {
"Output repo commit hash": output_repo_hash, "Output repo commit message": output_commit_message,
"Project repo commit hash": str(self.head.commit), "Output repo branch": output_branch_name,
"Project repo folder name": os.path.split(self.working_dir)[-1], "Output repo commit hash": output_repo_hash,
"Project repo remotes": [str(remote.url) for remote in self.remotes], "Project repo commit hash": str(self.head.commit),
} "Project repo folder name": os.path.split(self.working_dir)[-1],
"Project repo remotes": [str(remote.url) for remote in self.remotes],
}
csv_header = ",".join(meta_info_dict.keys()) csv_header = ",".join(meta_info_dict.keys())
csv_data = ",".join([str(x) for x in meta_info_dict.values()]) csv_data = ",".join([str(x) for x in meta_info_dict.values()])
...@@ -399,9 +402,8 @@ class ProjectRepo(BaseRepo): ...@@ -399,9 +402,8 @@ class ProjectRepo(BaseRepo):
self.copy_code(code_copy_folderpath) self.copy_code(code_copy_folderpath)
self._output_repo.add(".") self._output_repo.add(".")
if message is None: self._output_repo._git.commit("-m", f"log for '{output_commit_message}' \n"
message = output_branch_name f"of branch '{output_branch_name}'")
self._output_repo._git.commit("-m", message)
self._output_repo._git.checkout(output_branch_name) self._output_repo._git.checkout(output_branch_name)
self._most_recent_branch = output_branch_name self._most_recent_branch = output_branch_name
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment