diff --git a/src/sc/branching/branch.py b/src/sc/branching/branch.py index 24f6bf9..8dc0c5c 100644 --- a/src/sc/branching/branch.py +++ b/src/sc/branching/branch.py @@ -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 @@ -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} diff --git a/src/sc/branching/commands/push.py b/src/sc/branching/commands/push.py index 5491d5f..af40f45 100644 --- a/src/sc/branching/commands/push.py +++ b/src/sc/branching/commands/push.py @@ -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