diff --git a/CHANGELOG.md b/CHANGELOG.md index 1ec534f6..69bcdfa4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,6 +18,25 @@ and this project adheres to [Semantic Versioning][semver]. ### Fixed +## [0.13.3] - 11/18/2021 + + +### Added + + +### Changed + +- Update create local branch git command - remove checkout ([197]) +- Iterate throuh all urls when checking if a local repo is synced with remote ([197]) + + +### Fixed + + +[197]: https://github.com/openlawlibrary/taf/pull/197 + + + ## [0.13.2] - 11/11/2021 @@ -582,7 +601,8 @@ 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.13.2...HEAD +[Unreleased]: https://github.com/openlawlibrary/taf/compare/v0.13.3...HEAD +[0.13.3]: https://github.com/openlawlibrary/taf/compare/v0.13.2...v0.13.3 [0.13.2]: https://github.com/openlawlibrary/taf/compare/v0.13.1...v0.13.2 [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 diff --git a/setup.py b/setup.py index 45e3c47c..46d1295e 100644 --- a/setup.py +++ b/setup.py @@ -1,7 +1,7 @@ from setuptools import find_packages, setup PACKAGE_NAME = "taf" -VERSION = "0.13.2" +VERSION = "0.13.3" AUTHOR = "Open Law Library" AUTHOR_EMAIL = "info@openlawlib.org" DESCRIPTION = "Implementation of archival authentication" diff --git a/taf/git.py b/taf/git.py index 8ff4678f..bd0c20ff 100644 --- a/taf/git.py +++ b/taf/git.py @@ -518,9 +518,7 @@ def create_local_branch(self, branch_name): to check out previously checked out branch """ if not self.branch_exists(branch_name, include_remotes=False): - current_branch = self.get_current_branch() - self.checkout_branch(branch_name) - self.checkout_branch(current_branch) + self._git(f"branch {branch_name} {self.remotes[0]}/{branch_name}") def checkout_commit(self, commit): self._git( @@ -852,23 +850,25 @@ def synced_with_remote(self, branch=None, url=None): """Checks if local branch is synced with its remote branch""" # check if the latest local commit matches # the latest remote commit on the specified branch - branch = branch or self.default_branch - if url is None: - if self.urls is not None and len(self.urls): - url = self.urls[0] - else: - url = self.get_remote_url() - - tracking_branch = self.get_tracking_branch(branch, strip_remote=True) - if not tracking_branch: - return False + urls = ( + [url] + if url is not None + else self.urls + if self.urls + else [self.get_remote_url()] + ) + for url in urls: + branch = branch or self.default_branch + tracking_branch = self.get_tracking_branch(branch, strip_remote=True) + if not tracking_branch: + return False - try: - local_commit = self._git(f"rev-parse {branch}") - except GitError as e: - if "unknown revision or path not in the working tree" not in str(e): - raise e - local_commit = None + try: + local_commit = self._git(f"rev-parse {branch}") + except GitError as e: + if "unknown revision or path not in the working tree" not in str(e): + raise e + local_commit = None remote_commit = self.get_last_remote_commit(url, tracking_branch)