Skip to content

Commit 72e201c

Browse files
committed
fixes #84
1 parent fc88008 commit 72e201c

File tree

5 files changed

+55
-4
lines changed

5 files changed

+55
-4
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
# **v1.11.0**
2+
3+
## What's New
4+
5+
* @JohnstonCode Added commit message list
6+
17
# **v1.10.0**
28

39
## What's New

package.json

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "svn-scm",
33
"displayName": "SVN",
44
"description": "Integrated Subversion source control",
5-
"version": "1.10.0",
5+
"version": "1.11.0",
66
"publisher": "johnstoncode",
77
"engines": {
88
"vscode": "^1.17.0"
@@ -126,6 +126,11 @@
126126
"command": "svn.resolve",
127127
"title": "Resolve Conflicts",
128128
"category": "SVN"
129+
},
130+
{
131+
"command": "svn.log",
132+
"title": "Show commit messages",
133+
"category": "SVN"
129134
}
130135
],
131136
"menus": {
@@ -151,6 +156,10 @@
151156
{
152157
"command": "svn.resolve",
153158
"when": "config.svn.enabled"
159+
},
160+
{
161+
"command": "svn.log",
162+
"when": "config.svn.enabled"
154163
}
155164
],
156165
"scm/resourceGroup/context": [],
@@ -282,6 +291,12 @@
282291
"description":
283292
"Allow to show in source control the list the external folders",
284293
"default": false
294+
},
295+
"svn.log.length": {
296+
"type": "number",
297+
"minimum": 1,
298+
"description": "Number of commit messages to log",
299+
"default": 50
285300
}
286301
}
287302
}

src/commands.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -575,6 +575,20 @@ export class SvnCommands {
575575
}
576576
}
577577

578+
@command("svn.log", { repository: true })
579+
async log(repository: Repository) {
580+
try {
581+
const result = await repository.repository.log();
582+
// send the log results to a new tab
583+
workspace.openTextDocument({ content: result }).then(doc => {
584+
window.showTextDocument(doc);
585+
});
586+
} catch (error) {
587+
console.error(error);
588+
window.showErrorMessage("Unable to log");
589+
}
590+
}
591+
578592
private runByRepository<T>(
579593
resource: Uri,
580594
fn: (repository: Repository, resource: Uri) => Promise<T>

src/svn.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ export class Svn {
133133
this.version = options.version;
134134
}
135135

136-
private log(output: string): void {
136+
private logOutput(output: string): void {
137137
this._onOutput.emit("log", output);
138138
}
139139

@@ -144,7 +144,7 @@ export class Svn {
144144
}
145145

146146
if (options.log !== false) {
147-
this.log(
147+
this.logOutput(
148148
`[${this.lastCwd.split(/[\\\/]+/).pop()}]$ svn ${args.join(" ")}\n`
149149
);
150150
}
@@ -180,7 +180,7 @@ export class Svn {
180180
stdout = iconv.decode(stdout, encoding);
181181

182182
if (options.log !== false && stderr.length > 0) {
183-
this.log(`${stderr}\n`);
183+
this.logOutput(`${stderr}\n`);
184184
}
185185

186186
return { exitCode, stdout, stderr };
@@ -310,4 +310,8 @@ export class Svn {
310310
resolve(file: string, action: string) {
311311
return this.exec("", ["resolve", "--accept", action, file]);
312312
}
313+
314+
log(rootPath: string, length: string) {
315+
return this.exec(rootPath, ["log", "--limit", length]);
316+
}
313317
}

src/svnRepository.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -300,4 +300,16 @@ export class Repository {
300300

301301
return result.stdout;
302302
}
303+
304+
async log() {
305+
const config = workspace.getConfiguration("svn");
306+
const logLength = config.get<string>("log.length") || "50";
307+
const result = await this.svn.log(this.workspaceRoot, logLength);
308+
309+
if (result.exitCode !== 0) {
310+
throw new Error(result.stderr);
311+
}
312+
313+
return result.stdout;
314+
}
303315
}

0 commit comments

Comments
 (0)