Skip to content

Feature/gh57 sc delete#58

Open
BenjiMilan wants to merge 2 commits into
developfrom
feature/gh57_sc_delete
Open

Feature/gh57 sc delete#58
BenjiMilan wants to merge 2 commits into
developfrom
feature/gh57_sc_delete

Conversation

@BenjiMilan
Copy link
Copy Markdown
Contributor

Closes #57

Adds sc delete command with -r flag for remote deletion

@BenjiMilan BenjiMilan requested a review from TB-1993 May 14, 2026 08:37
@BenjiMilan BenjiMilan self-assigned this May 14, 2026
Copilot AI review requested due to automatic review settings May 14, 2026 08:37
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

Adds a new sc <branch_type> delete [name] command to remove feature/release/hotfix branches across a Repo workspace (and optionally on remotes via -r), with accompanying test coverage.

Changes:

  • Introduces Delete command implementation for both Repo workspaces and standalone git repos.
  • Wires new delete subcommands into the Click CLI for feature/release/hotfix.
  • Adds unit tests validating local deletion and -r remote deletion behavior.

Reviewed changes

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

File Description
src/sc/branching/commands/delete.py Implements branch deletion logic (local + optional remote) for git and repo project types.
src/sc/branching/branching.py Exposes SCBranching.delete(...) and routes to the new command.
src/sc/branching_cli.py Adds delete subcommands and -r/--remote option for feature/release/hotfix groups.
tests/branching/test_delete.py Adds tests for delete behavior across project + manifest repos, including remote deletion.
Comments suppressed due to low confidence (2)

tests/branching/test_delete.py:67

  • This test doesn’t assert that the sc ... delete invocation succeeded; consider using check=True (or asserting returncode == 0) so the test fails if the CLI exits non-zero.
        top_dir = self.repo_client.create("hotfix/donut")

        subprocess.run(["sc", "hotfix", "delete", "donut"], cwd=top_dir)

tests/branching/test_delete.py:83

  • This test doesn’t assert that the sc ... delete -r invocation succeeded; since remote deletion adds additional git operations that can fail after local branch deletion, use check=True (or assert returncode == 0) to avoid silently passing on a broken command.
        top_dir = self.repo_client.create("feature/donut")

        subprocess.run(["sc", "feature", "delete", "donut", "-r"], cwd=top_dir)


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

Comment on lines +54 to +58
if self.remote:
if not remote_name:
remote_name = repo.remotes[0].name
repo.git.push(remote_name, f":{self.branch.name}")
repo.git.update_ref("-d", f"refs/remotes/m/{self.branch.name}")
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

It says this but it worked on old sc and works in the tests with different remote names?


manifest = ScManifest.from_repo_root(self.top_dir / '.repo')
for proj in manifest.projects:
if proj.lock_status == None:
Comment thread tests/branching/test_delete.py
Comment thread tests/branching/test_delete.py
Comment thread src/sc/branching/commands/delete.py
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature: sc delete

3 participants