Skip to content

Commit

Permalink
can commit all changes using SCM input box
Browse files Browse the repository at this point in the history
  • Loading branch information
JohnstonCode committed Oct 12, 2017
1 parent 0642da9 commit 5eac5d9
Show file tree
Hide file tree
Showing 7 changed files with 64 additions and 58 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
**v0.5.0**
=============================================

## What's New
- Can commit all changes using SCM input box

**v0.4.0**
=============================================

Expand Down
75 changes: 35 additions & 40 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,41 +1,36 @@
{
"name": "svn-scm",
"displayName": "svn-scm",
"description": "",
"version": "0.4.0",
"publisher": "johnstoncode",
"engines": {
"vscode": "^1.16.0"
},
"homepage": "https://github.com/JohnstonCode/svn-scm/blob/master/README.md",
"repository": {
"type": "git",
"url": "https://github.com/JohnstonCode/svn-scm.git"
},
"bugs": {
"url": "https://github.com/JohnstonCode/svn-scm/issues"
},
"categories": [
"Other",
"SCM Providers"
],
"activationEvents": [
"*"
],
"main": "./src/extension",
"scripts": {
"postinstall": "node ./node_modules/vscode/bin/install",
"test": "node ./node_modules/vscode/bin/test"
},
"dependencies": {
"svn-spawn": "^0.1.5"
},
"devDependencies": {
"typescript": "^2.5.2",
"vscode": "^1.1.5",
"mocha": "^3.5.0",
"eslint": "^4.6.1",
"@types/node": "^7.0.0",
"@types/mocha": "^2.2.42"
}
}
"name": "svn-scm",
"displayName": "svn-scm",
"description": "",
"version": "0.5.0",
"publisher": "johnstoncode",
"engines": {
"vscode": "^1.16.0"
},
"homepage": "https://github.com/JohnstonCode/svn-scm/blob/master/README.md",
"repository": {
"type": "git",
"url": "https://github.com/JohnstonCode/svn-scm.git"
},
"bugs": {
"url": "https://github.com/JohnstonCode/svn-scm/issues"
},
"categories": ["Other", "SCM Providers"],
"activationEvents": ["*"],
"main": "./src/extension",
"scripts": {
"postinstall": "node ./node_modules/vscode/bin/install",
"test": "node ./node_modules/vscode/bin/test"
},
"dependencies": {
"svn-spawn": "^0.1.5"
},
"devDependencies": {
"typescript": "^2.5.2",
"vscode": "^1.1.5",
"mocha": "^3.5.0",
"eslint": "^4.6.1",
"@types/node": "^7.0.0",
"@types/mocha": "^2.2.42"
}
}
26 changes: 14 additions & 12 deletions src/commands.js
Original file line number Diff line number Diff line change
@@ -1,25 +1,27 @@
const { commands, scm, window } = require("vscode");
const Svn = require("./svn");
const { inputCommitMessage } = require("./messages");
const { inputCommitMessage, changesCommitted } = require("./messages");
const svn = require("./svn");

function SvnCommands() {
this.svn = new Svn();

commands.registerCommand("svn.fileOpen", this.fileOpen);
commands.registerCommand("svn.commitAll", this.commitAll);
commands.registerCommand("svn.commitWithMessage", this.commitWithMessage);
}

SvnCommands.prototype.fileOpen = resourceUri => {
commands.executeCommand("vscode.open", resourceUri);
};

SvnCommands.prototype.commitAll = () => {
inputCommitMessage(scm.inputBox.value)
.then(result => this.svn.commitAll(result))
.then(() => {
scm.inputBox.value = "";
})
.catch(err => console.log(err));
SvnCommands.prototype.commitWithMessage = async function() {
this.svn = new svn();
let message = await inputCommitMessage(scm.inputBox.value);

try {
await this.svn.commit(message);
scm.inputBox.value = "";
changesCommitted();
} catch (error) {
console.log(error);
}
};

module.exports = SvnCommands;
5 changes: 5 additions & 0 deletions src/messages.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,10 @@ function inputCommitMessage(message) {
});
}

function changesCommitted() {
return window.showInformationMessage("Files Committed");
}

exports.noChangesToCommit = noChangesToCommit;
exports.inputCommitMessage = inputCommitMessage;
exports.changesCommitted = changesCommitted;
4 changes: 2 additions & 2 deletions src/svn.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ svn.prototype.getStatus = function() {
});
};

svn.prototype.commitAll = function(message) {
svn.prototype.commit = function(params) {
return new Promise((resolve, reject) => {
this.client.commit(
message,
params,
(err, data) => (err ? reject(err) : resolve(data))
);
});
Expand Down
4 changes: 1 addition & 3 deletions src/svnContentProvider.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,7 @@ svnContentProvider.prototype.provideTextDocumentContent = function(uri) {
return new Promise((resolve, reject) => {
this.svn
.cmd(["ls", relativePath])
.then(() => {
return this.svn.cmd(["cat", "-r", "HEAD", relativePath]);
})
.then(() => this.svn.cmd(["cat", "-r", "HEAD", relativePath]))
.then(result => {
resolve(result);
})
Expand Down
2 changes: 1 addition & 1 deletion src/svnSCM.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ var { Uri, scm } = require("vscode");
function svnSCM() {
this.sourceControl = scm.createSourceControl("svn", "svn");
this.sourceControl.acceptInputCommand = {
command: "svn.commitAll",
command: "svn.commitWithMessage",
title: "commit"
};
this.sourceControl.quickDiffProvider = this;
Expand Down

0 comments on commit 5eac5d9

Please sign in to comment.