Skip to content

Commit

Permalink
ability to add un-tracked files in source control view
Browse files Browse the repository at this point in the history
  • Loading branch information
JohnstonCode committed Oct 19, 2017
1 parent ffdd0ef commit 6a56878
Show file tree
Hide file tree
Showing 6 changed files with 56 additions and 2 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
**v0.6.0**
=============================================

## What's New
- Can add un-tracked files in source control view

**v0.5.1**
=============================================

Expand Down
1 change: 1 addition & 0 deletions icons/add.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion icons/unversioned.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
29 changes: 28 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "svn-scm",
"displayName": "svn-scm",
"description": "",
"version": "0.5.1",
"version": "0.6.0",
"publisher": "johnstoncode",
"engines": {
"vscode": "^1.16.0"
Expand Down Expand Up @@ -32,5 +32,32 @@
"eslint": "^4.6.1",
"@types/node": "^7.0.0",
"@types/mocha": "^2.2.42"
},
"contributes": {
"commands": [
{
"command": "svn.add",
"title": "add",
"category": "svn",
"icon": {
"light": "icons/add.svg",
"dark": "icons/add.svg"
}
}
],
"menus": {
"commandPalette": [],
"scm/title": [],
"scm/resourceGroup/context": [],
"scm/resourceState/context": [
{
"command": "svn.add",
"when": "scmProvider == svn && scmResourceGroup == unversioned",
"group": "inline"
}
],
"editor/title": []
},
"configuration": {}
}
}
11 changes: 11 additions & 0 deletions src/commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ const svn = require("./svn");
function SvnCommands() {
commands.registerCommand("svn.fileOpen", this.fileOpen);
commands.registerCommand("svn.commitWithMessage", this.commitWithMessage);
commands.registerCommand("svn.add", this.addFile);
}

SvnCommands.prototype.fileOpen = resourceUri => {
Expand All @@ -24,4 +25,14 @@ SvnCommands.prototype.commitWithMessage = async function() {
}
};

SvnCommands.prototype.addFile = async uri => {
this.svn = new svn();

try {
await this.svn.add(uri.resourceUri.path);
} catch (error) {
console.log(error);
}
};

module.exports = SvnCommands;
9 changes: 9 additions & 0 deletions src/svn.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,13 @@ svn.prototype.commit = function(params) {
});
};

svn.prototype.add = function(filePath) {
return new Promise((resolve, reject) => {
this.client.add(
filePath,
(err, data) => (err ? reject(err) : resolve(data))
);
});
};

module.exports = svn;

0 comments on commit 6a56878

Please sign in to comment.