forked from JohnstonCode/svn-scm
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrevert.ts
39 lines (31 loc) · 1011 Bytes
/
revert.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
import { SourceControlResourceState, window } from "vscode";
import { checkAndPromptDepth, confirmRevert } from "../input/revert";
import { Command } from "./command";
export class Revert extends Command {
constructor() {
super("svn.revert");
}
public async execute(...resourceStates: SourceControlResourceState[]) {
const selection = await this.getResourceStates(resourceStates);
if (selection.length === 0 || !(await confirmRevert())) {
return;
}
const uris = selection.map(resource => resource.resourceUri);
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");
}
});
}
}