You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am struggling to get the code working for checking out gerrit review.
`
class Git: def __init__(self, url: str, authcb: str, committer: str, workdir: Optional[str] = None) -> None: if not workdir: temp_git_dir = tempfile.mkdtemp(prefix="artcis_ci_lib_") dirname = hashlib.sha256(url.encode("utf-8")).hexdigest() self._workdir = os.path.join(temp_git_dir, dirname) else: self._workdir = workdir self._authentication_callback = authcb self._committer = committer logger.info("Checking out %s to %s...", url, self._workdir) self._repo = init_repository(self._workdir) self._remote = self._repo.remotes.create("origin", url) # type: ignore logger.debug("TODO: install sig handler that removes %s on exit", self._workdir) @property def workdir(self) -> str: return self._workdir def fetch_and_checkout(self, remote_ref: str, retries: int = 8) -> TransferProgress: for i in range(1, retries + 1): try: progress = self._remote.fetch([remote_ref], callbacks=self._authentication_callback) # type: ignore for _ in range(1800): sleep(0.1) if progress.received_objects == progress.total_objects: break if progress.received_objects != progress.total_objects: raise TimeoutError("Timeout while recieving objects") break except (TimeoutError, GitError) as err: if i >= retries: raise err backoff_time = 2**i logger.error("Failed to fetch repository, retrying in %s seconds...", backoff_time) time.sleep(backoff_time) continue self._repo.checkout("FETCH_HEAD") return progress # type: ignore
`
This is working fine with branches, but when trying out with merged commit revision or commit revision from gerrit review, this code isn't working.
i get below error when trying to checkout gerrit review with revision or any revision which is already merged into master: _pygit2.GitError: cannot fetch a specific object from the remote repository
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi,
I am struggling to get the code working for checking out gerrit review.
`
`
This is working fine with branches, but when trying out with merged commit revision or commit revision from gerrit review, this code isn't working.
i get below error when trying to checkout gerrit review with revision or any revision which is already merged into master:
_pygit2.GitError: cannot fetch a specific object from the remote repositoryUsing pygit2==1.15.1
Could you please help to solve this issue.
BetaWas this translation helpful?Give feedback.
All reactions