Skip to content

gh50 dev branches not pushing#51

Merged
BenjiMilan merged 1 commit intodevelopfrom
feature/gh50_Fix_develop_not_pushing
Apr 22, 2026
Merged

gh50 dev branches not pushing#51
BenjiMilan merged 1 commit intodevelopfrom
feature/gh50_Fix_develop_not_pushing

Conversation

@BenjiMilan
Copy link
Copy Markdown
Contributor

Closes #50

Due to check for remote commit existing when pushing branches, when merging a feature branch that was pushed back into develop, then pushing develop, this will cause that branch not to push as the commit already exists on the feature branch.

@BenjiMilan BenjiMilan requested a review from TB-1993 April 22, 2026 14:58
@BenjiMilan BenjiMilan self-assigned this Apr 22, 2026
Copilot AI review requested due to automatic review settings April 22, 2026 14:58
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes issue #50 where pushing develop (or master) could be skipped if the commit already existed on the remote in a different branch (e.g., a previously pushed feature branch), ensuring primary branches still push in that scenario.

Changes:

  • Adjust push eligibility logic to only skip when the remote contains the commit for non-primary branches.
  • Fix Branch primary-branch detection by using the public is_primary_branch() method in __post_init__ and renaming the method accordingly.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
src/sc/branching/commands/push.py Allows pushing primary branches even when the commit exists on the remote in another branch.
src/sc/branching/branch.py Corrects primary-branch detection by calling the method and exposing it as is_primary_branch().
Comments suppressed due to low confidence (1)

src/sc/branching/branch.py:55

  • Branch.__post_init__ now calls is_primary_branch(), but is_primary_branch() only treats self.type as a BranchType. There are call sites that construct Branch with a string type (e.g. Branch(base_branch_type, base_name) in commands/start.py where base_branch_type can be 'develop'/'master' and base_name is None). With the current implementation this will incorrectly be treated as non-primary and raise ValueError, breaking valid uses of Branch('develop')/Branch('master'). Consider normalizing self.type to BranchType in __post_init__ (when passed a str) or make is_primary_branch() compare on str(self.type) so it works for both enums and strings.
    def __post_init__(self):
        if not self.suffix and not self.is_primary_branch():
            raise ValueError("Can't create non primary branch with no suffix.")

    @property
    def name(self) -> str:
        if self.suffix:
            return f"{self.type}/{self.suffix}"
        return str(self.type)

    def is_primary_branch(self) -> bool:
        return self.type in {BranchType.DEVELOP, BranchType.MASTER}


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/sc/branching/commands/push.py Outdated
Comment thread src/sc/branching/commands/push.py Outdated
@BenjiMilan BenjiMilan force-pushed the feature/gh50_Fix_develop_not_pushing branch from 37febe1 to 0e0af8c Compare April 22, 2026 15:05
Copy link
Copy Markdown

@TB-1993 TB-1993 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, ship it!

@BenjiMilan BenjiMilan merged commit 92b9ffc into develop Apr 22, 2026
5 checks passed
@BenjiMilan BenjiMilan deleted the feature/gh50_Fix_develop_not_pushing branch April 22, 2026 15:25
@github-actions github-actions Bot locked and limited conversation to collaborators Apr 22, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: Develop branches not pushing properly

3 participants