Skip to content
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

[git] Update references changed on the remote repo only #853

Merged
merged 1 commit into from
Dec 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions perceval/backends/core/git.py
Original file line number Diff line number Diff line change
Expand Up @@ -1304,6 +1304,8 @@ def _update_references(self, refs):
self._update_ref(old_ref, delete=True)

# Update new references
current_refs = {ref.refname: ref.hash for ref in self._discover_refs()}

for new_ref in refs:
refname = new_ref.refname

Expand All @@ -1315,6 +1317,10 @@ def _update_references(self, refs):
logger.debug("Reference %s not needed; ignored for updating in sync process",
refname)
continue
elif refname in current_refs and new_ref.hash == current_refs[refname]:
logger.debug("Reference %s already up to date in sync process",
refname)
continue
else:
self._update_ref(new_ref)

Expand Down
14 changes: 14 additions & 0 deletions releases/unreleased/git-sync-perfomance-improved.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
title: Git sync improved for `--latest-items` flag
category: performance
author: Santiago Dueñas <sduenas@bitergia.com>
issue: null
notes: >
The speed updating a git repository when `--lates-items`
is set was very poor. The main problem was when the
references were updated to the new hashes. All the
active refs on the repository were modified, even when
they were up-to-date. Now, only references updated
on the remote repository are modified on the local one.
Repositories are synched 2 times faster than before.

Loading