-
Notifications
You must be signed in to change notification settings - Fork 177
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Recovery functionality for Git #838
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It mostly looks good. I added some comment to improve its readability.
perceval/backends/core/git.py
Outdated
hashes = repo.get_commits_from_packs(packs, from_commit) | ||
gitshow = repo.show(hashes) | ||
commits = self.parse_git_log_from_iter(gitshow) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We might want to encapsulate these under a new method __fetch_from_packs(...)
.
tests/test_git.py
Outdated
@@ -706,6 +706,95 @@ def test_fetch_from_file(self): | |||
self.assertEqual(commit['category'], 'commit') | |||
self.assertEqual(commit['tag'], 'http://example.com.git') | |||
|
|||
def test_fetch_recovery(self): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The test looks great but I think you can improve it splitting in on different cases and not having everything tested on the same one.
perceval/backend.py
Outdated
@@ -1035,6 +1035,7 @@ def __init__(self): | |||
self.max_offset = None | |||
self.last_offset = None | |||
self.extras = None | |||
self.last_search_fields = None |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this field needed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The summary does not contain any information related to the last commit or the last item collected. I think this field (search_fields) contains that information for all the backends and can be used later in the scheduler to identify it.
f0a480c
to
c52b82a
Compare
c52b82a
to
d93332b
Compare
This commit implements the recovery functionality in the fetch method of the Git backend, enabling the recovery of Perceval execution from a specific commit. Now, users can specify a recovery commit to start fetching commits from that point, ensuring robustness against failures. Signed-off-by: Jose Javier Merchante <jjmerchante@bitergia.com>
d93332b
to
2db6922
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
This PR implements the recovery functionality in the fetch method of the Git backend.
It also includes the last item search fields in the summary to allow recovering from the last item.