Skip to content

Commit 42aef09

Browse files
committed
Merge remote-tracking branch 'remotes/upstream/master' into multiple_svn_folders
2 parents fc1d2be + 9b8df50 commit 42aef09

File tree

9 files changed

+95
-31
lines changed

9 files changed

+95
-31
lines changed

CHANGELOG.md

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,26 @@
22

33
## What's New
44

5-
* @edgardmessias Added support to configure non-standard layout. To configure, edit the options:
6-
* "svn.layout.trunk" : Relative path for 'trunk' in SVN URL, 'null' to disable. (Ex.: 'trunk', 'main')
7-
* "svn.layout.branches" : Relative path for 'branches' in SVN URL, 'null' to disable. (Ex.: 'branches', 'versions')
8-
* "svn.layout.tags" : Relative path for 'tags' in SVN URL, 'null' to disable. (Ex.: 'tags', 'stamps')
9-
* @edgardmessias Added support to configure diff changes. To configure, edit the options:
10-
* "svn.diff.withHead" : Show diff changes using latest revision in the repository. Set false to use latest revision in local folder
5+
* @edgardmessias Added support to configure non-standard layout. To configure,
6+
edit the options:
7+
* "svn.layout.trunk" : Relative path for 'trunk' in SVN URL, 'null' to
8+
disable. (Ex.: 'trunk', 'main')
9+
* "svn.layout.branches" : Relative path for 'branches' in SVN URL, 'null' to
10+
disable. (Ex.: 'branches', 'versions')
11+
* "svn.layout.tags" : Relative path for 'tags' in SVN URL, 'null' to disable.
12+
(Ex.: 'tags', 'stamps')
13+
* @edgardmessias Added support to configure diff changes. To configure, edit the
14+
options:
15+
* "svn.diff.withHead" : Show diff changes using latest revision in the
16+
repository. Set false to use latest revision in local folder
17+
* @JohnstonCode Commit info message now shows what revision it was
18+
* @JohnstonCode Added svn update to scm title commands
19+
* @JohnstonCode Added confirmation message to revert command
1120

1221
## Bug Fixes
1322

1423
* @edgardmessias Fixed config option form svn path
24+
* @JohnstonCode Fixed conflicted files not having an icon
1525

1626
# **v1.3.2**
1727

package.json

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,11 @@
7777
"command": "svn.revert",
7878
"title": "Revert Selected",
7979
"category": "SVN"
80+
},
81+
{
82+
"command": "svn.update",
83+
"title": "Svn update",
84+
"category": "SVN"
8085
}
8186
],
8287
"menus": {
@@ -90,6 +95,10 @@
9095
{
9196
"command": "svn.switchBranch",
9297
"when": "config.svn.enabled"
98+
},
99+
{
100+
"command": "svn.update",
101+
"when": "config.svn.enabled"
93102
}
94103
],
95104
"scm/resourceGroup/context": [],
@@ -133,22 +142,26 @@
133142
},
134143
"svn.diff.withHead": {
135144
"type": "boolean",
136-
"description": "Show diff changes using latest revision in the repository. Set false to use latest revision in local folder",
145+
"description":
146+
"Show diff changes using latest revision in the repository. Set false to use latest revision in local folder",
137147
"default": true
138148
},
139149
"svn.layout.trunk": {
140150
"type": ["string", "null"],
141-
"description": "Relative path for 'trunk' in SVN URL, 'null' to disable. (Ex.: 'trunk', 'main')",
151+
"description":
152+
"Relative path for 'trunk' in SVN URL, 'null' to disable. (Ex.: 'trunk', 'main')",
142153
"default": "trunk"
143154
},
144155
"svn.layout.branches": {
145156
"type": ["string", "null"],
146-
"description": "Relative path for 'branches' in SVN URL, 'null' to disable. (Ex.: 'branches', 'versions')",
157+
"description":
158+
"Relative path for 'branches' in SVN URL, 'null' to disable. (Ex.: 'branches', 'versions')",
147159
"default": "branches"
148160
},
149161
"svn.layout.tags": {
150162
"type": ["string", "null"],
151-
"description": "Relative path for 'tags' in SVN URL, 'null' to disable. (Ex.: 'tags', 'stamps')",
163+
"description":
164+
"Relative path for 'tags' in SVN URL, 'null' to disable. (Ex.: 'tags', 'stamps')",
152165
"default": "tags"
153166
}
154167
}

src/commands.ts

Lines changed: 29 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import {
66
TextDocumentShowOptions,
77
QuickPickItem
88
} from "vscode";
9-
import { inputCommitMessage, changesCommitted } from "./messages";
9+
import { inputCommitMessage } from "./messages";
1010
import { Svn } from "./svn";
1111
import { Model } from "./model";
1212
import { Repository } from "./repository";
@@ -154,9 +154,12 @@ export class SvnCommands {
154154
});
155155

156156
try {
157-
await repository.repository.commitFiles(message, filePaths);
157+
const result = await repository.repository.commitFiles(
158+
message,
159+
filePaths
160+
);
161+
window.showInformationMessage(result);
158162
repository.inputBox.value = "";
159-
changesCommitted();
160163
repository.update();
161164
} catch (error) {
162165
console.error(error);
@@ -182,7 +185,6 @@ export class SvnCommands {
182185

183186
@command("svn.commit", { repository: true })
184187
async commit(repository: Repository, ...args: any[][]): Promise<void> {
185-
console.log(args);
186188
try {
187189
const paths = args[0].map(state => {
188190
return state.resourceUri.fsPath;
@@ -193,8 +195,8 @@ export class SvnCommands {
193195
return;
194196
}
195197

196-
await repository.repository.commitFiles(message, paths);
197-
changesCommitted();
198+
const result = await repository.repository.commitFiles(message, paths);
199+
window.showInformationMessage(result);
198200
repository.update();
199201
} catch (error) {
200202
console.error(error);
@@ -302,6 +304,16 @@ export class SvnCommands {
302304

303305
@command("svn.revert", { repository: true })
304306
async revert(repository: Repository, ...args: any[][]) {
307+
const yes = "Yes I'm sure";
308+
const answer = await window.showWarningMessage(
309+
"Are you sure? This will wipe all local changes.",
310+
yes
311+
);
312+
313+
if (answer !== yes) {
314+
return;
315+
}
316+
305317
try {
306318
const paths = args[0].map(state => {
307319
return state.resourceUri.fsPath;
@@ -314,4 +326,15 @@ export class SvnCommands {
314326
window.showErrorMessage("Unable to revert");
315327
}
316328
}
329+
330+
@command("svn.update", { repository: true })
331+
async update(repository: Repository) {
332+
try {
333+
const result = await repository.repository.update();
334+
window.showInformationMessage(result);
335+
} catch (error) {
336+
console.error(error);
337+
window.showErrorMessage("Unable to update");
338+
}
339+
}
317340
}

src/messages.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,3 @@ export function inputCommitMessage(message?: string) {
2121
.then(string => resolve(string));
2222
});
2323
}
24-
25-
export function changesCommitted() {
26-
return window.showInformationMessage("Files Committed");
27-
}

src/resource.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ export class Resource {
4545
Modified: this.getIconUri("modified", "light"),
4646
Added: this.getIconUri("added", "light"),
4747
Deleted: this.getIconUri("deleted", "light"),
48-
Conflicted: this.getIconUri("conflicted", "light"),
48+
conflict: this.getIconUri("conflict", "light"),
4949
Replaced: this.getIconUri("replaced", "light"),
5050
Unversioned: this.getIconUri("unversioned", "light"),
5151
Missing: this.getIconUri("missing", "light")
@@ -54,7 +54,7 @@ export class Resource {
5454
Modified: this.getIconUri("modified", "dark"),
5555
Added: this.getIconUri("added", "dark"),
5656
Deleted: this.getIconUri("deleted", "dark"),
57-
Conflicted: this.getIconUri("conflicted", "dark"),
57+
conflict: this.getIconUri("conflict", "dark"),
5858
Replaced: this.getIconUri("replaced", "dark"),
5959
Unversioned: this.getIconUri("unversioned", "dark"),
6060
Missing: this.getIconUri("missing", "dark")
@@ -64,8 +64,8 @@ export class Resource {
6464
switch (this.type) {
6565
case "added":
6666
return Icons[theme].Added;
67-
case "conflicted":
68-
return Icons[theme].Conflicted;
67+
case "conflict":
68+
return Icons[theme].conflict;
6969
case "deleted":
7070
return Icons[theme].Deleted;
7171
case "modified":

src/svn.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -236,4 +236,8 @@ export class Svn {
236236

237237
return this.exec("", args);
238238
}
239+
240+
update(root: string) {
241+
return this.exec(root, ["update"]);
242+
}
239243
}

src/svnRepository.ts

Lines changed: 25 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,11 @@ export class Repository {
2424
return status;
2525
}
2626

27-
async show(path: string, revision?: string, options: CpOptions = {}): Promise<string> {
27+
async show(
28+
path: string,
29+
revision?: string,
30+
options: CpOptions = {}
31+
): Promise<string> {
2832
const result = await this.svn.show(path, revision, options);
2933

3034
if (result.exitCode !== 0) {
@@ -41,7 +45,9 @@ export class Repository {
4145
throw new Error(result.stderr);
4246
}
4347

44-
return result.stdout;
48+
const outputMessage = result.stdout.match(/Committed revision (.*)\./i)[0];
49+
50+
return outputMessage;
4551
}
4652

4753
addFile(filePath: string) {
@@ -68,8 +74,10 @@ export class Repository {
6874
const branchesLayout = config.get<string>("layout.branches");
6975
const tagsLayout = config.get<string>("layout.tags");
7076

71-
const trees = [trunkLayout, branchesLayout, tagsLayout].filter(x => x != null);
72-
const regex = new RegExp("<url>(.*?)\/(" + trees.join("|") + ").*?<\/url>");
77+
const trees = [trunkLayout, branchesLayout, tagsLayout].filter(
78+
x => x != null
79+
);
80+
const regex = new RegExp("<url>(.*?)/(" + trees.join("|") + ").*?</url>");
7381

7482
const info = await this.svn.info(this.root);
7583

@@ -171,9 +179,7 @@ export class Repository {
171179
const repoUrl = await this.getRepoUrl();
172180
const newBranch = repoUrl + "/" + branchesLayout + "/" + name;
173181
const resultBranch = await this.svn.info(this.root);
174-
const currentBranch = resultBranch.stdout
175-
.match(/<url>(.*?)<\/url>/)[1];
176-
182+
const currentBranch = resultBranch.stdout.match(/<url>(.*?)<\/url>/)[1];
177183
const result = await this.svn.copy(currentBranch, newBranch, name);
178184

179185
if (result.exitCode !== 0) {
@@ -212,4 +218,16 @@ export class Repository {
212218

213219
return result.stdout;
214220
}
221+
222+
async update() {
223+
const result = await this.svn.update(this.root);
224+
225+
if (result.exitCode !== 0) {
226+
throw new Error(result.stderr);
227+
}
228+
229+
const message = result.stdout.match(/At revision (.*)\./i)[0];
230+
231+
return message;
232+
}
215233
}

0 commit comments

Comments
 (0)