Skip to content

Commit 7f3b9fa

Browse files
authored
Merge pull request #278 from JohnstonCode/277
removed unnecessary awaits
2 parents 721a4b5 + 955b724 commit 7f3b9fa

File tree

6 files changed

+29
-35
lines changed

6 files changed

+29
-35
lines changed

src/branches.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,14 +126,14 @@ export async function selectBranch(
126126
}
127127

128128
if (choice instanceof ParentFolderItem) {
129-
return await selectBranch(repository, allowNew, choice.path);
129+
return selectBranch(repository, allowNew, choice.path);
130130
}
131131
if (choice instanceof FolderItem) {
132132
if (choice.branch) {
133133
return choice.branch;
134134
}
135135

136-
return await selectBranch(repository, allowNew, choice.path);
136+
return selectBranch(repository, allowNew, choice.path);
137137
}
138138

139139
if (choice instanceof NewFolderItem) {

src/commands.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -440,7 +440,7 @@ export class SvnCommands implements IDisposable {
440440
path: path.join(basedir, `(HEAD) ${basename}`) // change document title
441441
});
442442

443-
return await commands.executeCommand<void>("vscode.open", uri, {
443+
return commands.executeCommand<void>("vscode.open", uri, {
444444
preview: true
445445
});
446446
}
@@ -546,10 +546,10 @@ export class SvnCommands implements IDisposable {
546546
}
547547

548548
if (!left) {
549-
return await commands.executeCommand<void>("vscode.open", right, opts);
549+
return commands.executeCommand<void>("vscode.open", right, opts);
550550
}
551551

552-
return await commands.executeCommand<void>(
552+
return commands.executeCommand<void>(
553553
"vscode.diff",
554554
left,
555555
right,
@@ -1078,7 +1078,7 @@ export class SvnCommands implements IDisposable {
10781078

10791079
const uris = selection.map(resource => resource.resourceUri);
10801080

1081-
return await this.addToIgnore(uris);
1081+
return this.addToIgnore(uris);
10821082
}
10831083

10841084
@command("svn.addToIgnoreExplorer")
@@ -1087,7 +1087,7 @@ export class SvnCommands implements IDisposable {
10871087
return;
10881088
}
10891089

1090-
return await this.addToIgnore(allUris);
1090+
return this.addToIgnore(allUris);
10911091
}
10921092

10931093
async addToIgnore(uris: Uri[]): Promise<void> {
@@ -1115,7 +1115,7 @@ export class SvnCommands implements IDisposable {
11151115

11161116
const oldName = mainUri.fsPath;
11171117

1118-
return await this.rename(repository, oldName);
1118+
return this.rename(repository, oldName);
11191119
}
11201120

11211121
@command("svn.rename", { repository: true })

src/decorators.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ function _sequentialize<T>(fn: Function, key: string): Function {
8686
return function(...args: any[]) {
8787
const currentPromise =
8888
(this[currentKey] as Promise<any>) || Promise.resolve(null);
89-
const run = async () => await fn.apply(this, args);
89+
const run = async () => fn.apply(this, args);
9090
this[currentKey] = currentPromise.then(run, run);
9191
return this[currentKey];
9292
};

src/ignoreitems.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -54,11 +54,7 @@ export async function inputIgnoreList(repository: Repository, uris: Uri[]) {
5454
return;
5555
}
5656

57-
return await repository.addToIgnore(
58-
[pick.expression],
59-
dirName,
60-
pick.recursive
61-
);
57+
return repository.addToIgnore([pick.expression], dirName, pick.recursive);
6258
}
6359

6460
const count = uris.length;

src/repository.ts

Lines changed: 18 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -619,29 +619,29 @@ export class Repository {
619619
}
620620

621621
async addFiles(files: string[]) {
622-
return await this.run(Operation.Add, () => this.repository.addFiles(files));
622+
return this.run(Operation.Add, () => this.repository.addFiles(files));
623623
}
624624

625625
async addChangelist(files: string[], changelist: string) {
626-
return await this.run(Operation.AddChangelist, () =>
626+
return this.run(Operation.AddChangelist, () =>
627627
this.repository.addChangelist(files, changelist)
628628
);
629629
}
630630

631631
async removeChangelist(files: string[]) {
632-
return await this.run(Operation.RemoveChangelist, () =>
632+
return this.run(Operation.RemoveChangelist, () =>
633633
this.repository.removeChangelist(files)
634634
);
635635
}
636636

637637
async getCurrentBranch() {
638-
return await this.run(Operation.CurrentBranch, async () => {
638+
return this.run(Operation.CurrentBranch, async () => {
639639
return this.repository.getCurrentBranch();
640640
});
641641
}
642642

643643
async branch(name: string) {
644-
return await this.run(Operation.NewBranch, async () => {
644+
return this.run(Operation.NewBranch, async () => {
645645
await this.repository.branch(name);
646646
this.updateNewCommits();
647647
});
@@ -655,57 +655,55 @@ export class Repository {
655655
}
656656

657657
async updateRevision(ignoreExternals: boolean = false): Promise<string> {
658-
return await this.run<string>(Operation.Update, async () => {
658+
return this.run<string>(Operation.Update, async () => {
659659
const response = await this.repository.update(ignoreExternals);
660660
this.updateNewCommits();
661661
return response;
662662
});
663663
}
664664

665665
async resolve(files: string[], action: string) {
666-
return await this.run(Operation.Resolve, () =>
666+
return this.run(Operation.Resolve, () =>
667667
this.repository.resolve(files, action)
668668
);
669669
}
670670

671671
async commitFiles(message: string, files: any[]) {
672-
return await this.run(Operation.Commit, () =>
672+
return this.run(Operation.Commit, () =>
673673
this.repository.commitFiles(message, files)
674674
);
675675
}
676676

677677
async revert(files: string[]) {
678-
return await this.run(Operation.Revert, () =>
679-
this.repository.revert(files)
680-
);
678+
return this.run(Operation.Revert, () => this.repository.revert(files));
681679
}
682680

683681
async patch(files: string[]) {
684-
return await this.run(Operation.Patch, () => this.repository.patch(files));
682+
return this.run(Operation.Patch, () => this.repository.patch(files));
685683
}
686684

687685
async patchChangelist(changelistName: string) {
688-
return await this.run(Operation.Patch, () =>
686+
return this.run(Operation.Patch, () =>
689687
this.repository.patchChangelist(changelistName)
690688
);
691689
}
692690

693691
async removeFiles(files: any[], keepLocal: boolean) {
694-
return await this.run(Operation.Remove, () =>
692+
return this.run(Operation.Remove, () =>
695693
this.repository.removeFiles(files, keepLocal)
696694
);
697695
}
698696

699697
async log() {
700-
return await this.run(Operation.Log, () => this.repository.log());
698+
return this.run(Operation.Log, () => this.repository.log());
701699
}
702700

703701
async cleanup() {
704-
return await this.run(Operation.CleanUp, () => this.repository.cleanup());
702+
return this.run(Operation.CleanUp, () => this.repository.cleanup());
705703
}
706704

707705
async finishCheckout() {
708-
return await this.run(Operation.SwitchBranch, () =>
706+
return this.run(Operation.SwitchBranch, () =>
709707
this.repository.finishCheckout()
710708
);
711709
}
@@ -715,21 +713,21 @@ export class Repository {
715713
directory: string,
716714
recursive: boolean = false
717715
) {
718-
return await this.run(Operation.Ignore, () =>
716+
return this.run(Operation.Ignore, () =>
719717
this.repository.addToIgnore(expressions, directory, recursive)
720718
);
721719
}
722720

723721
async rename(oldFile: string, newFile: string) {
724-
return await this.run(Operation.Rename, () =>
722+
return this.run(Operation.Rename, () =>
725723
this.repository.rename(oldFile, newFile)
726724
);
727725
}
728726

729727
async promptAuth(): Promise<boolean | undefined> {
730728
// Prevent multiple prompts for auth
731729
if (this.lastPromptAuth) {
732-
return await this.lastPromptAuth;
730+
return this.lastPromptAuth;
733731
}
734732

735733
this.lastPromptAuth = commands.executeCommand("svn.promptAuth");

src/svnRepository.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ export class Repository {
2929
options.username = this.username;
3030
options.password = this.password;
3131

32-
return await this.svn.exec(this.workspaceRoot, args, options);
32+
return this.svn.exec(this.workspaceRoot, args, options);
3333
}
3434

3535
removeAbsolutePath(file: string) {

0 commit comments

Comments
 (0)