Skip to content

Commit 523d46b

Browse files
inu yashaJohnstonCode
authored andcommitted
fix: Fixed bug when svn path contains @ (#548)
1 parent 4d3fa92 commit 523d46b

File tree

2 files changed

+13
-9
lines changed

2 files changed

+13
-9
lines changed

src/svnRepository.ts

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import { parseSvnList } from "./listParser";
1919
import { parseSvnLog } from "./logParser";
2020
import { parseStatusXml } from "./statusParser";
2121
import { Svn } from "./svn";
22-
import { fixPathSeparator, unwrap } from "./util";
22+
import { fixPathSeparator, fixPegRevision, unwrap } from "./util";
2323

2424
export class Repository {
2525
private _infoCache: { [index: string]: ISvnInfo } = {};
@@ -46,7 +46,7 @@ export class Repository {
4646
}
4747

4848
public async updateInfo() {
49-
const result = await this.exec(["info", "--xml", this.root]);
49+
const result = await this.exec(["info", "--xml", fixPegRevision(this.root)]);
5050
this._info = await parseInfoXml(result.stdout);
5151
}
5252

@@ -69,12 +69,7 @@ export class Repository {
6969
file = ".";
7070
}
7171

72-
// Fix Peg Revision Algorithm (http://svnbook.red-bean.com/en/1.8/svn.advanced.pegrevs.html)
73-
if (/@/.test(file)) {
74-
file += "@";
75-
}
76-
77-
return file;
72+
return fixPegRevision(file);
7873
}
7974

8075
public async getStatus(params: {
@@ -520,7 +515,7 @@ export class Repository {
520515
"-v"
521516
];
522517
if (target !== undefined) {
523-
args.push(target instanceof Uri ? target.toString(true) : target);
518+
args.push(fixPegRevision(target instanceof Uri ? target.toString(true) : target));
524519
}
525520
const result = await this.exec(args);
526521

src/util.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,3 +189,12 @@ export function unwrap<T>(maybeT?: T): T {
189189
}
190190
return maybeT;
191191
}
192+
193+
export function fixPegRevision(file: string) {
194+
// Fix Peg Revision Algorithm (http://svnbook.red-bean.com/en/1.8/svn.advanced.pegrevs.html)
195+
if (/@/.test(file)) {
196+
file += "@";
197+
}
198+
199+
return file;
200+
}

0 commit comments

Comments
 (0)