forked from JohnstonCode/svn-scm
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrevertExplorer.ts
41 lines (33 loc) · 915 Bytes
/
revertExplorer.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
import { Uri, window } from "vscode";
import { checkAndPromptDepth, confirmRevert } from "../input/revert";
import { Command } from "./command";
export class RevertExplorer extends Command {
constructor() {
super("svn.revertExplorer");
}
public async execute(_mainUri?: Uri, allUris?: Uri[]) {
if (!allUris) {
return;
}
const uris = allUris;
if (uris.length === 0 || !(await confirmRevert())) {
return;
}
const depth = await checkAndPromptDepth(uris);
if (!depth) {
return;
}
await this.runByRepository(uris, async (repository, resources) => {
if (!repository) {
return;
}
const paths = resources.map(resource => resource.fsPath);
try {
await repository.revert(paths, depth);
} catch (error) {
console.log(error);
window.showErrorMessage("Unable to revert");
}
});
}
}