diff --git a/CHANGELOG.md b/CHANGELOG.md index e6010101..30045149 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,9 @@ +# **v1.11.0** + +## What's New + +* @JohnstonCode Added commit message list + # **v1.10.0** ## What's New diff --git a/package.json b/package.json index fe1df291..f6c558a8 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "svn-scm", "displayName": "SVN", "description": "Integrated Subversion source control", - "version": "1.10.0", + "version": "1.11.0", "publisher": "johnstoncode", "engines": { "vscode": "^1.17.0" @@ -126,6 +126,11 @@ "command": "svn.resolve", "title": "Resolve Conflicts", "category": "SVN" + }, + { + "command": "svn.log", + "title": "Show commit messages", + "category": "SVN" } ], "menus": { @@ -151,6 +156,10 @@ { "command": "svn.resolve", "when": "config.svn.enabled" + }, + { + "command": "svn.log", + "when": "config.svn.enabled" } ], "scm/resourceGroup/context": [], @@ -282,6 +291,12 @@ "description": "Allow to show in source control the list the external folders", "default": false + }, + "svn.log.length": { + "type": "number", + "minimum": 1, + "description": "Number of commit messages to log", + "default": 50 } } } diff --git a/src/commands.ts b/src/commands.ts index 69b49d5e..31e99a23 100644 --- a/src/commands.ts +++ b/src/commands.ts @@ -575,6 +575,20 @@ export class SvnCommands { } } + @command("svn.log", { repository: true }) + async log(repository: Repository) { + try { + const result = await repository.repository.log(); + // send the log results to a new tab + workspace.openTextDocument({ content: result }).then(doc => { + window.showTextDocument(doc); + }); + } catch (error) { + console.error(error); + window.showErrorMessage("Unable to log"); + } + } + private runByRepository( resource: Uri, fn: (repository: Repository, resource: Uri) => Promise diff --git a/src/svn.ts b/src/svn.ts index 791a9bfb..4ac34603 100644 --- a/src/svn.ts +++ b/src/svn.ts @@ -133,7 +133,7 @@ export class Svn { this.version = options.version; } - private log(output: string): void { + private logOutput(output: string): void { this._onOutput.emit("log", output); } @@ -144,7 +144,7 @@ export class Svn { } if (options.log !== false) { - this.log( + this.logOutput( `[${this.lastCwd.split(/[\\\/]+/).pop()}]$ svn ${args.join(" ")}\n` ); } @@ -180,7 +180,7 @@ export class Svn { stdout = iconv.decode(stdout, encoding); if (options.log !== false && stderr.length > 0) { - this.log(`${stderr}\n`); + this.logOutput(`${stderr}\n`); } return { exitCode, stdout, stderr }; @@ -310,4 +310,8 @@ export class Svn { resolve(file: string, action: string) { return this.exec("", ["resolve", "--accept", action, file]); } + + log(rootPath: string, length: string) { + return this.exec(rootPath, ["log", "--limit", length]); + } } diff --git a/src/svnRepository.ts b/src/svnRepository.ts index 5a9ddbe9..8e660411 100644 --- a/src/svnRepository.ts +++ b/src/svnRepository.ts @@ -300,4 +300,16 @@ export class Repository { return result.stdout; } + + async log() { + const config = workspace.getConfiguration("svn"); + const logLength = config.get("log.length") || "50"; + const result = await this.svn.log(this.workspaceRoot, logLength); + + if (result.exitCode !== 0) { + throw new Error(result.stderr); + } + + return result.stdout; + } }