Skip to content

Commit 6a56878

Browse files
committed
ability to add un-tracked files in source control view
1 parent ffdd0ef commit 6a56878

File tree

6 files changed

+56
-2
lines changed

6 files changed

+56
-2
lines changed

CHANGELOG.md

+6
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
**v0.6.0**
2+
=============================================
3+
4+
## What's New
5+
- Can add un-tracked files in source control view
6+
17
**v0.5.1**
28
=============================================
39

icons/add.svg

+1
Loading

icons/unversioned.svg

+1-1
Loading

package.json

+28-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "svn-scm",
33
"displayName": "svn-scm",
44
"description": "",
5-
"version": "0.5.1",
5+
"version": "0.6.0",
66
"publisher": "johnstoncode",
77
"engines": {
88
"vscode": "^1.16.0"
@@ -32,5 +32,32 @@
3232
"eslint": "^4.6.1",
3333
"@types/node": "^7.0.0",
3434
"@types/mocha": "^2.2.42"
35+
},
36+
"contributes": {
37+
"commands": [
38+
{
39+
"command": "svn.add",
40+
"title": "add",
41+
"category": "svn",
42+
"icon": {
43+
"light": "icons/add.svg",
44+
"dark": "icons/add.svg"
45+
}
46+
}
47+
],
48+
"menus": {
49+
"commandPalette": [],
50+
"scm/title": [],
51+
"scm/resourceGroup/context": [],
52+
"scm/resourceState/context": [
53+
{
54+
"command": "svn.add",
55+
"when": "scmProvider == svn && scmResourceGroup == unversioned",
56+
"group": "inline"
57+
}
58+
],
59+
"editor/title": []
60+
},
61+
"configuration": {}
3562
}
3663
}

src/commands.js

+11
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ const svn = require("./svn");
55
function SvnCommands() {
66
commands.registerCommand("svn.fileOpen", this.fileOpen);
77
commands.registerCommand("svn.commitWithMessage", this.commitWithMessage);
8+
commands.registerCommand("svn.add", this.addFile);
89
}
910

1011
SvnCommands.prototype.fileOpen = resourceUri => {
@@ -24,4 +25,14 @@ SvnCommands.prototype.commitWithMessage = async function() {
2425
}
2526
};
2627

28+
SvnCommands.prototype.addFile = async uri => {
29+
this.svn = new svn();
30+
31+
try {
32+
await this.svn.add(uri.resourceUri.path);
33+
} catch (error) {
34+
console.log(error);
35+
}
36+
};
37+
2738
module.exports = SvnCommands;

src/svn.js

+9
Original file line numberDiff line numberDiff line change
@@ -31,4 +31,13 @@ svn.prototype.commit = function(params) {
3131
});
3232
};
3333

34+
svn.prototype.add = function(filePath) {
35+
return new Promise((resolve, reject) => {
36+
this.client.add(
37+
filePath,
38+
(err, data) => (err ? reject(err) : resolve(data))
39+
);
40+
});
41+
};
42+
3443
module.exports = svn;

0 commit comments

Comments
 (0)