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

Adds feature to prune remotes. Fixes #556 #815

Merged
merged 1 commit into from Aug 13, 2019

Conversation

@zaboyle
Copy link
Contributor

commented Aug 7, 2019

Description

A request for the option to prune a remote was made in #556
There was some discussion as to the exact functionality that people wanted:

The main concern I believe was to simply prune the remote

There was also talk to remove any local branches tracking pruned remote branches, which I thought might be better for a feature separate from pruning, as it alters the local repo in a way most would not expect

EDIT: it was agreed upon in #556 that this feature should just prune the remote. A new issue to implement the second functionality was made at #817

Also, I wasn't sure which icon to use, but thought that the icon-branch.svg fit the best. I can change this if people wish

Testing

To test this feature with my test gitlab repo, I did the following:
1 - create a new remote branch on gitlab, and add a file to it
2 - from gitlens, fetch the remote to which I made these changes. Make sure the remote branch is seen
3 - merge the remote branch into remote master and delete on merging
4 - pull from the remote
5 - run git remote prune --dry-run <remoteName> to ensure there was indeed a branch to prune
6 - use the "prune" functionality added in gitlens
7 - check to make sure the remote branch disappears in gitlens. Also run another git remote prune --dry-run <remoteName> just to be safe

Screenshots:

image

steps 1 and 2 (feature-pr remote branch is still in remote)

image

step 3

image

steps 4 and 5 (check that there is indeed a branch to prune)

image

image

step 6 and 7 (after pressing the "prune" button in gitlens)

Checklist

  • I have followed the guidelines in the Contributing document
  • My changes are based off of the develop branch
  • My changes follow the coding style of this project
  • My changes build without any errors or warnings
  • My changes have been formatted and linted
  • My changes include any required corresponding changes to the documentation
  • My changes have been rebased and squashed to the minimal number (typically 1) of relevant commits
  • My changes have a descriptive commit message with a short title, including a Fixes $XXX - or Closes #XXX - prefix to auto-close the issue that your PR addresses
@zaboyle zaboyle marked this pull request as ready for review Aug 8, 2019
Copy link
Owner

left a comment

@zaboyle Thanks again for your contribution!

Thank you

I have just a few changes before landing this -- thanks!

"command": "gitlens.views.pruneRemote",
"title": "Prune Remote",
"category": "GitLens",
"icon": {

This comment has been minimized.

Copy link
@eamodio

eamodio Aug 12, 2019

Owner

I would suggest removing the icon altogether, since I don't think this command warrants an inline toolbar button. (Also branch doesn't feel quite right either).

@@ -4650,6 +4663,16 @@
"when": "!gitlens:readonly && viewItem =~ /gitlens:remotes\\b/",
"group": "1_gitlens@1"
},
{
"command": "gitlens.views.pruneRemote",

This comment has been minimized.

Copy link
@eamodio

eamodio Aug 12, 2019

Owner

Let's remove the inline command here.

"group": "inline@97"
},
{
"command": "gitlens.views.pruneRemote",

This comment has been minimized.

Copy link
@eamodio

eamodio Aug 12, 2019

Owner

Can you move this down to be right after gitlens.views.fetch, and then change the group to be 1_gitlens@2 so that way Fetch will still be the first command on the context-menu

@@ -2382,6 +2382,15 @@
"light": "images/light/icon-checkout.svg"
}
},
{
"command": "gitlens.views.pruneRemote",
"title": "Prune Remote",

This comment has been minimized.

Copy link
@eamodio

eamodio Aug 12, 2019

Owner

Since this command will only show up on a remote, let's just call it Prune

This comment has been minimized.

Copy link
@zaboyle

zaboyle Aug 12, 2019

Author Contributor

should the methods in viewCommands.ts, gitService.ts, and git.ts also just be called prune? Or should I leave them as is?

This comment has been minimized.

Copy link
@eamodio

eamodio Aug 12, 2019

Owner

Good as is. Thanks!

@zaboyle

This comment has been minimized.

Copy link
Contributor Author

commented Aug 12, 2019

@eamodio Awesome, I'll make those changes tomorrow! Should I squash them locally and push the changed history to my fork, or should I just add on another commit that can be squashed from Github? Not sure if the first option will delete this pull request or something

@eamodio

This comment has been minimized.

Copy link
Owner

commented Aug 12, 2019

Great thank you! You can do it either way as long as you keep pushing to the same branch you opened the PR on it will update the PR. Although I noticed that you used the same branch as develop as your last PR. In the future it would be best to create a new branch for each PR

@zaboyle zaboyle force-pushed the zaboyle:develop branch from 4d7136d to 47ae10b Aug 12, 2019
@zaboyle

This comment has been minimized.

Copy link
Contributor Author

commented Aug 12, 2019

Just pushed those changes 👍
Also sorry about not creating new branches! I'll do that from now on!
Thanks again for your help!

@eamodio eamodio merged commit f274bc1 into eamodio:develop Aug 13, 2019
@eamodio

This comment has been minimized.

Copy link
Owner

commented Aug 13, 2019

Looks great -- thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.