Skip to content
Merged
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
16 changes: 12 additions & 4 deletions cadetrdm/repositories.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,11 +179,19 @@ def has_changes_upstream(self):
try:
remote = self.remotes[0]
remote_branches = remote.fetch()
correct_remote_branches = [fetch_info for fetch_info in remote_branches
if fetch_info.name == f"{remote.name}/{self.active_branch.name}"]
correct_remote_branches = [
remote_branch for remote_branch in remote_branches
if remote_branch.name == f"{remote.name}/{self.active_branch.name}"
]
if len(correct_remote_branches) > 1:
raise RuntimeError(f"Remote has multiple branches matching local branch {self.active_branch.name}: "
f"{[branch.name for branch in correct_remote_branches]}")
raise RuntimeError(
f"Remote has multiple branches matching local branch {self.active_branch.name}: "
f"{[branch.name for branch in correct_remote_branches]}"
)

if not correct_remote_branches:
print(f"Branch {self.active_branch.name} does not exist upstream yet.")
return False
remote_hash = str(correct_remote_branches[0].commit)

if self.current_commit_hash != remote_hash and remote_hash not in self.log:
Expand Down