Skip to content

Commit fc31c8c

Browse files
committed
added right click to changes to commit
1 parent 42d2ff0 commit fc31c8c

File tree

3 files changed

+37
-2
lines changed

3 files changed

+37
-2
lines changed

package.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,11 @@
4444
"light": "icons/light/add.svg",
4545
"dark": "icons/dark/add.svg"
4646
}
47+
},
48+
{
49+
"command": "svn.commit",
50+
"title": "Commit Selected",
51+
"category": "SVN"
4752
}
4853
],
4954
"menus": {
@@ -55,6 +60,11 @@
5560
"command": "svn.add",
5661
"when": "scmProvider == svn && scmResourceGroup == unversioned",
5762
"group": "inline"
63+
},
64+
{
65+
"command": "svn.commit",
66+
"when": "scmProvider == svn && scmResourceGroup == changes",
67+
"group": "1_modification"
5868
}
5969
],
6070
"editor/title": []

src/commands.js

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,11 @@ function SvnCommands(model) {
1919
commandId: "svn.fileOpen",
2020
method: this.fileOpen,
2121
options: {}
22+
},
23+
{
24+
commandId: "svn.commit",
25+
method: this.commit,
26+
options: { repository: true }
2227
}
2328
];
2429

@@ -89,6 +94,7 @@ SvnCommands.prototype.commitWithMessage = async function(repository) {
8994
await repository.repository.commitFiles(message, filePaths);
9095
repository.sourceControl.inputBox.value = "";
9196
changesCommitted();
97+
repository.update();
9298
} catch (error) {
9399
window.showErrorMessage("Unable to commit");
94100
}
@@ -104,4 +110,19 @@ SvnCommands.prototype.addFile = async uri => {
104110
}
105111
};
106112

113+
SvnCommands.prototype.commit = async function(repository, ...args) {
114+
const paths = args.map(resourceState => {
115+
return resourceState.resourceUri.fsPath;
116+
});
117+
118+
try {
119+
const message = await inputCommitMessage();
120+
await repository.repository.commitFiles(message, paths);
121+
changesCommitted();
122+
repository.update();
123+
} catch (error) {
124+
window.showErrorMessage("Unable to commit");
125+
}
126+
};
127+
107128
module.exports = SvnCommands;

src/svn.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,9 +86,13 @@ svn.prototype.list = async function(filePath) {
8686
};
8787

8888
svn.prototype.commitFiles = function(message, files) {
89-
files = files.join(" ");
89+
args = ["commit", "-m", message];
9090

91-
return this.exec("", ["commit", "-m", message, files]);
91+
for (file of files) {
92+
args.push(file);
93+
}
94+
95+
return this.exec("", args);
9296
};
9397

9498
module.exports = svn;

0 commit comments

Comments
 (0)