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

(un)stage directory #600

Merged
merged 3 commits into from Jan 2, 2019

Conversation

Projects
None yet
3 participants
@UziTech
Copy link
Contributor

UziTech commented Dec 18, 2018

Add stageDirectory and unstageDirectory commands to (un)stage entire folder in tree view

fixes #599

@UziTech

This comment has been minimized.

Copy link
Contributor

UziTech commented Dec 18, 2018

This is just a start to the PR to get an idea of how to do it.

I am new to vscode and have never created/edited an extension before, so constructive criticism is appreciated.

If this is not the right direction feel free to close this PR

const fileNodes: (CommitFileNode | StatusFileNode)[] = [];

for (const fileNode of fileNodes) {
void (await this.stageFile(fileNode));

This comment has been minimized.

@UziTech

UziTech Dec 18, 2018

Contributor

I'm not sure if staging each file individually is the way to do it or if there is a way to pass a directory path to Container.git.stageFile.

This comment has been minimized.

@eamodio

eamodio Dec 22, 2018

Owner

I think I would recommend adding a stageDirectory method to GitService, and it could call the same underlying Git.add method since the fileName parameter can really be a pathspec (and probably should be renamed)

See here: https://git-scm.com/docs/git-add#git-add-ltpathspecgt82308203

This comment has been minimized.

@eamodio

eamodio Dec 22, 2018

Owner

And similar should be true for unstaging -- Git.reset can take a set of paths (although not a pathspec)

See here: https://git-scm.com/docs/git-reset#git-reset-emgitresetem-qlttree-ishgt--ltpathsgt82308203

@eamodio

This comment has been minimized.

Copy link
Owner

eamodio commented Dec 22, 2018

@UziTech Thanks for the PR! Looks like you are on the right track and should hopefully be straight forward to finish it up. Let me know if you have any other questions. (And sorry for the delay in responding)

@UziTech UziTech changed the title WIP: stage directory (un)stage directory Dec 23, 2018

@UziTech

This comment has been minimized.

Copy link
Contributor

UziTech commented Dec 23, 2018

I think this should work. I'm not sure how to test it. Is there a way to install local extensions in vscode?

@eamodio

This comment has been minimized.

Copy link
Owner

eamodio commented Dec 24, 2018

You can build/package everything by running npm run pack. That will generate a vsix, which you can install in vscode. From the ... menu on the Extensions side bar, choose Install from VSIX...

But you should be able to test it much easier than all that. You can run npm run watch (or just hit Ctrl+Shift+B in vscode) and then hit F5 in vscode and it will launch another vscode instance where you can easily debug GitLens.

@UziTech

This comment has been minimized.

Copy link
Contributor

UziTech commented Dec 27, 2018

For some reason I keep getting an error when running npm run pack

ERROR in ./src/vsls/vsls.ts
Module not found: Error: Can't resolve 'vsls' in 'C:\Users\tjbrix\Documents\projects\GitHub\vscode-gitlens\src\vsls'

even though vsls is in the node_modules folder.

I tried it in the master branch and get the same error

@eamodio

This comment has been minimized.

Copy link
Owner

eamodio commented Dec 27, 2018

@UziTech Ugh sorry about that. Because of issues with the vsls package I was relying on hand-edits. I have made changes to the webpack.config.js that will automatically apply the edits (if needed) when you run npm run build, npm run watch, etc. That should resolve the issues you are experiencing.

Just rebase your changes onto the develop branch and the build issues should be resolved.

@eamodio

This comment has been minimized.

Copy link
Owner

eamodio commented Dec 27, 2018

Please also change the base of your PR from master to develop

@eamodio

This comment has been minimized.

Copy link
Owner

eamodio commented Dec 27, 2018

@UziTech FYI, I added a CONTRIBUTING.md file that may help as well.

@UziTech UziTech changed the base branch from master to develop Dec 27, 2018

@UziTech UziTech force-pushed the UziTech:stageDirectory branch from d32091d to 25f74c4 Dec 27, 2018

@UziTech

This comment has been minimized.

Copy link
Contributor

UziTech commented Dec 27, 2018

I rebased on develop, tested it with the debugger and everything seems to be working. 🎉

image

@ragvri

This comment has been minimized.

Copy link

ragvri commented Dec 28, 2018

@UziTech, you are doing God's work here. I wanted this feature since eons. Hopefully, it will be merged :)

@eamodio eamodio force-pushed the UziTech:stageDirectory branch from 25f74c4 to e6146c2 Jan 2, 2019

@eamodio eamodio merged commit 6b60917 into eamodio:develop Jan 2, 2019

@eamodio

This comment has been minimized.

Copy link
Owner

eamodio commented Jan 2, 2019

@UziTech This has been released as part of GitLens 9.3 -- thanks for your contribution!

FYI, I made some minor changes, to restrict the commands to only show up for working tree folders and also added the commands to the inline toolbar

@UziTech UziTech deleted the UziTech:stageDirectory branch Jan 2, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment