From d35ff0a12e5b4c25ef5c2f7481ad42766a8303fb Mon Sep 17 00:00:00 2001 From: Renata Date: Fri, 22 Oct 2021 03:55:03 +0200 Subject: [PATCH 1/3] Pass default branch to sorted_commits_and_branches_per_repositories method --- taf/auth_repo.py | 10 ++++++---- taf/updater/updater.py | 2 +- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/taf/auth_repo.py b/taf/auth_repo.py index 49f68129..c37b1b16 100644 --- a/taf/auth_repo.py +++ b/taf/auth_repo.py @@ -184,7 +184,7 @@ def set_last_validated_commit(self, commit): Path(self.conf_dir, self.LAST_VALIDATED_FILENAME).write_text(commit) def sorted_commits_and_branches_per_repositories( - self, commits, target_repos=None, custom_fns=None + self, commits, target_repos=None, custom_fns=None, default_branch=None ): """Return a dictionary consisting of branches and commits belonging to it for every target repository: @@ -202,7 +202,7 @@ def sorted_commits_and_branches_per_repositories( file is not updated everytime something is committed to the authentication repo. """ repositories_commits = defaultdict(dict) - targets = self.targets_at_revisions(*commits, target_repos=target_repos) + targets = self.targets_at_revisions(*commits, target_repos=target_repos, default_branch=default_branch) previous_commits = {} for commit in commits: for target_path, target_data in targets[commit].items(): @@ -231,8 +231,10 @@ def sorted_commits_and_branches_per_repositories( ) return repositories_commits - def targets_at_revisions(self, *commits, target_repos=None): + def targets_at_revisions(self, *commits, target_repos=None, default_branch=None): targets = defaultdict(dict) + if default_branch is None: + default_branch = self.default_branch for commit in commits: # repositories.json might not exit, if the current commit is # the initial commit @@ -267,7 +269,7 @@ def targets_at_revisions(self, *commits, target_repos=None): ) if target_content is not None: target_commit = target_content.pop("commit") - target_branch = target_content.pop("branch", "master") + target_branch = target_content.pop("branch", default_branch) targets[commit][target_path] = { "branch": target_branch, "commit": target_commit, diff --git a/taf/updater/updater.py b/taf/updater/updater.py index 42e8dbcd..90661eae 100644 --- a/taf/updater/updater.py +++ b/taf/updater/updater.py @@ -599,7 +599,7 @@ def _commits_ret(commits, existing_repo, update_successful): users_auth_repo, commits ) repositories_branches_and_commits = ( - users_auth_repo.sorted_commits_and_branches_per_repositories(commits) + users_auth_repo.sorted_commits_and_branches_per_repositories(commits, default_branch=default_branch) ) additional_commits_per_repo, targets_data = _update_target_repositories( From eca9bb99e49ce338d148bb652b58245b53e67d57 Mon Sep 17 00:00:00 2001 From: Renata Date: Fri, 22 Oct 2021 04:06:28 +0200 Subject: [PATCH 2/3] Formatting --- taf/auth_repo.py | 4 +++- taf/updater/updater.py | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/taf/auth_repo.py b/taf/auth_repo.py index c37b1b16..f63a4e56 100644 --- a/taf/auth_repo.py +++ b/taf/auth_repo.py @@ -202,7 +202,9 @@ def sorted_commits_and_branches_per_repositories( file is not updated everytime something is committed to the authentication repo. """ repositories_commits = defaultdict(dict) - targets = self.targets_at_revisions(*commits, target_repos=target_repos, default_branch=default_branch) + targets = self.targets_at_revisions( + *commits, target_repos=target_repos, default_branch=default_branch + ) previous_commits = {} for commit in commits: for target_path, target_data in targets[commit].items(): diff --git a/taf/updater/updater.py b/taf/updater/updater.py index 90661eae..2b5404b2 100644 --- a/taf/updater/updater.py +++ b/taf/updater/updater.py @@ -599,7 +599,9 @@ def _commits_ret(commits, existing_repo, update_successful): users_auth_repo, commits ) repositories_branches_and_commits = ( - users_auth_repo.sorted_commits_and_branches_per_repositories(commits, default_branch=default_branch) + users_auth_repo.sorted_commits_and_branches_per_repositories( + commits, default_branch=default_branch + ) ) additional_commits_per_repo, targets_data = _update_target_repositories( From c8a0384955df05325f9d652c50ddfcc0e1bfdf53 Mon Sep 17 00:00:00 2001 From: Renata Date: Fri, 22 Oct 2021 04:30:09 +0200 Subject: [PATCH 3/3] Release 0.13.1 --- CHANGELOG.md | 19 +++++++++++++++++-- setup.py | 2 +- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index dae29d9e..49f287fc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,10 +14,23 @@ and this project adheres to [Semantic Versioning][semver]. ### Changed +### Fixed + +## [0.13.1] - 10/22/2021 + +### Added + + +### Changed ### Fixed +- Pass default branch to sorted_commits_and_branches_per_repositories ([185]) + + +[185] https://github.com/openlawlibrary/taf/pull/185 + ## [0.13.0] - 10/20/2021 @@ -32,7 +45,7 @@ and this project adheres to [Semantic Versioning][semver]. ### Fixed -[183] https://github.com/openlawlibrary/taf/pull/184 +[184] https://github.com/openlawlibrary/taf/pull/184 ## [0.12.0] - 10/18/2021 @@ -549,7 +562,9 @@ and this project adheres to [Semantic Versioning][semver]. [keepachangelog]: https://keepachangelog.com/en/1.0.0/ [semver]: https://semver.org/spec/v2.0.0.html -[Unreleased]: https://github.com/openlawlibrary/taf/compare/v0.12.0...HEAD +[Unreleased]: https://github.com/openlawlibrary/taf/compare/v0.13.1...HEAD +[0.13.1]: https://github.com/openlawlibrary/taf/compare/v0.13.0...v0.13.1 +[0.13.0]: https://github.com/openlawlibrary/taf/compare/v0.12.0...v0.13.0 [0.12.0]: https://github.com/openlawlibrary/taf/compare/v0.11.2...v0.12.0 [0.11.1]: https://github.com/openlawlibrary/taf/compare/v0.11.1...v0.11.2 [0.11.1]: https://github.com/openlawlibrary/taf/compare/v0.11.0...v0.11.1 diff --git a/setup.py b/setup.py index 36707b04..45161bc9 100644 --- a/setup.py +++ b/setup.py @@ -1,7 +1,7 @@ from setuptools import find_packages, setup PACKAGE_NAME = "taf" -VERSION = "0.13.0" +VERSION = "0.13.1" AUTHOR = "Open Law Library" AUTHOR_EMAIL = "info@openlawlib.org" DESCRIPTION = "Implementation of archival authentication"