Feature/gh57 sc delete#58
Open
BenjiMilan wants to merge 2 commits into
Open
Conversation
There was a problem hiding this comment.
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
Deletecommand implementation for both Repo workspaces and standalone git repos. - Wires new
deletesubcommands into the Click CLI for feature/release/hotfix. - Adds unit tests validating local deletion and
-rremote 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 ... deleteinvocation succeeded; consider usingcheck=True(or assertingreturncode == 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 -rinvocation succeeded; since remote deletion adds additional git operations that can fail after local branch deletion, usecheck=True(or assertreturncode == 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}") |
Contributor
Author
There was a problem hiding this comment.
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: |
TB-1993
requested changes
May 14, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #57
Adds sc delete command with -r flag for remote deletion