Skip to content

Commit

Permalink
fix: check if upstream exists before attempting to set it as a local …
Browse files Browse the repository at this point in the history
…branch's upstream
  • Loading branch information
renatav committed Oct 1, 2024
1 parent b8f634e commit dc34ce5
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
10 changes: 10 additions & 0 deletions taf/git.py
Original file line number Diff line number Diff line change
Expand Up @@ -716,6 +716,10 @@ def clone_from_disk(
is_bare: bool = False,
keep_remote=False,
) -> None:
if "target1" in str(local_path):
import pdb

pdb.set_trace()
self.path.mkdir(parents=True, exist_ok=True)
pygit2.clone_repository(local_path, self.path, bare=is_bare)
if not self.is_git_repository:
Expand Down Expand Up @@ -1488,6 +1492,12 @@ def set_remote_url(self, new_url: str, remote: Optional[str] = "origin") -> None
self._git(f"remote set-url {remote} {new_url}")

def set_upstream(self, branch_name: str) -> None:
repo = self.pygit_repo
try:
repo.resolve_refish(f"origin/{branch_name}")
except KeyError:
return

self._git("branch -u origin/{}", branch_name)

def something_to_commit(self) -> bool:
Expand Down
9 changes: 0 additions & 9 deletions taf/updater/updater_pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,9 +180,6 @@ def run(self):
raise UpdateFailedError(message)

except Exception as e:
import pdb

pdb.set_trace()
self.handle_error(e)
break
except KeyboardInterrupt as e:
Expand Down Expand Up @@ -572,9 +569,6 @@ def _check_if_target_repos_clean(self, target_repos, branches_per_repo):
) = repository.branch_unpushed_commits(branch)
self.state.clean_check_data[repository.name].append(branch)
if contains_unpushed:
import pdb

pdb.set_trace()
if self.force and len(unpushed_commits):
taf_logger.info(
f"Resetting repository {repository.name} to clean state for a forced update."
Expand Down Expand Up @@ -665,9 +659,6 @@ def _clear_lvc():
users_head_sha = self.state.users_auth_repo.top_commit_of_branch(
default_branch
)
import pdb

pdb.set_trace()
if not _check_if_commit_on_branch(
self.state.validation_auth_repo, users_head_sha, default_branch
):
Expand Down

0 comments on commit dc34ce5

Please sign in to comment.