Skip to content
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
4 changes: 2 additions & 2 deletions src/sc/branching/branch.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class Branch:
suffix: str = None

def __post_init__(self):
if not self.suffix and not self._is_primary_branch:
if not self.suffix and not self.is_primary_branch():
raise ValueError("Can't create non primary branch with no suffix.")

@property
Expand All @@ -50,5 +50,5 @@ def name(self) -> str:
return f"{self.type}/{self.suffix}"
return str(self.type)

def _is_primary_branch(self) -> bool:
def is_primary_branch(self) -> bool:
return self.type in {BranchType.DEVELOP, BranchType.MASTER}
5 changes: 4 additions & 1 deletion src/sc/branching/commands/push.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,10 @@ def _can_push_project(self, proj: ProjectElementInterface) -> bool:
if not self._local_branch_exists(proj_repo, proj_branch_name):
logger.info("Branch doesn't exist in project. Skipping.")
return False
if self._remote_contains_commit(proj_repo, proj.remote):
if (
not self.branch.is_primary_branch()
and self._remote_contains_commit(proj_repo, proj.remote)
):
logger.info("Remote already contains commit. Skipping.")
return False
return True
Expand Down
Loading