Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: adds branch command to unset upstream #1944

Merged
merged 1 commit into from
Aug 30, 2024

Conversation

cdloh
Copy link
Contributor

@cdloh cdloh commented Aug 29, 2024

No description provided.

@cdloh cdloh force-pushed the feature/unset-upstream branch 2 times, most recently from 4d597df to 449f6d0 Compare August 29, 2024 16:18
@kaste
Copy link
Collaborator

kaste commented Aug 29, 2024

Ah, that's useful.

We actually have a command in the Command Palette to unset the tracking information for the checked out branch, that is gs_unset_tracking_information

class gs_unset_tracking_information(GsWindowCommand):
defaults = {
"branch": push.take_current_branch_name,
}
def run(self, branch):
self.git("branch", branch, "--unset-upstream")
self.window.status_message("Removed the upstream information for {}".format(branch))
util.view.refresh_gitsavvy_interfaces(self.window)

Let's just delegate to that command. We do this quite often in this interface. Something among self.window.run_command.... Also probably check if the selected branch is a remote branch, e.g.

def run(self, edit):
if self.selected_branch.is_remote:
flash(self.view, "Cannot configure remote branches.")
return

and if it actually has upstream/tracking set.

@cdloh
Copy link
Contributor Author

cdloh commented Aug 29, 2024

Thanks @kaste. I think I've implemented all of those changes.

I couldn't find any docs or relevant tests but happy to if I've missed something.

@kaste
Copy link
Collaborator

kaste commented Aug 30, 2024

Excellent.

I usually don't have tests for these ... basically simple wrappers. Most logic is in the parent classes e.g. CommandForSingleBranch.

Actually, happy that this is such a simple diff/patch as well.

(I still need to fix these mypy errors; the latest mypy version got smarter and I did not pin the version here. 😬)

Let's roll.

@kaste kaste merged commit 742d3be into timbrel:master Aug 30, 2024
5 of 8 checks passed
@kaste
Copy link
Collaborator

kaste commented Aug 30, 2024

🥁

@cdloh
Copy link
Contributor Author

cdloh commented Aug 30, 2024

many thanks for maintaining the plugin @kaste! Not sure how much time I save with it weekly. All muscle memory now.

How long does package control take to pickup the new version?

@cdloh cdloh deleted the feature/unset-upstream branch August 30, 2024 20:16
@kaste
Copy link
Collaborator

kaste commented Aug 30, 2024

It's a crawler... checks every 3 hours

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.

2 participants