diff --git a/rsl_rl/utils/utils.py b/rsl_rl/utils/utils.py index 88dd741..f8d3103 100644 --- a/rsl_rl/utils/utils.py +++ b/rsl_rl/utils/utils.py @@ -65,15 +65,21 @@ def store_code_state(logdir, repositories) -> list: for repository_file_path in repositories: try: repo = git.Repo(repository_file_path, search_parent_directories=True) - except git.InvalidGitRepositoryError: + except Exception: + print(f"Could not find git repository in {repository_file_path}. Skipping.") # skip if not a git repository continue # get the name of the repository repo_name = pathlib.Path(repo.working_dir).name t = repo.head.commit.tree diff_file_name = os.path.join(git_log_dir, f"{repo_name}.diff") - content = f"--- git status ---\n{repo.git.status()} \n\n\n--- git diff ---\n{repo.git.diff(t)}" + # check if the diff file already exists + if os.path.isfile(diff_file_name): + continue + # write the diff file + print(f"Storing git diff for '{repo_name}' in: {diff_file_name}") with open(diff_file_name, "x") as f: + content = f"--- git status ---\n{repo.git.status()} \n\n\n--- git diff ---\n{repo.git.diff(t)}" f.write(content) # add the file path to the list of files to be uploaded file_paths.append(diff_file_name) diff --git a/setup.py b/setup.py index 8d1e5c7..b933467 100644 --- a/setup.py +++ b/setup.py @@ -5,7 +5,7 @@ from setuptools import find_packages, setup setup( name="rsl_rl", - version="2.0.1", + version="2.0.2", packages=find_packages(), author="ETH Zurich, NVIDIA CORPORATION", maintainer="Nikita Rudin, David Hoeller",