message: Optimized getBranches to use parallel requests
diff: @@ -83,8 +83,11 @@ export class Repository {
  async getBranches() {
  const repoUrl = await this.getRepoUrl();
  - const branches = [];
  + let branches:string[] = [];
  + let promises = [];
  +
  + promises.push(new Promise<string[]>(async resolve => {
  let trunkExists = await this.svn.exec("", [
  "ls",
  repoUrl + "/trunk",
  @@ -93,19 +96,24 @@ export class Repository {
  ]);
  if (trunkExists.exitCode === 0) {
  - branches.push("trunk");
  + resolve(["trunk"]);
  + return;
  }
  + resolve([]);
  + }));
  const trees = ["branches", "tags"];
  for (let index in trees) {
  + promises.push(new Promise<string[]>(async resolve => {
  const tree = trees[index];
  const branchUrl = repoUrl + "/" + tree;
  const result = await this.svn.list(branchUrl);
  if (result.exitCode !== 0) {
  - continue;
  + resolve([]);
  + return;
  }
  const list = result.stdout
  @@ -114,9 +122,15 @@ export class Repository {
  .split(/[\r\n]+/)
  .map((i: string) => tree + "/" + i);
  - branches.push(...list);
  + resolve(list);
  + }));
  }
  + const all = await Promise.all<any>(promises);
  + all.forEach(list => {
  + branches.push(...list);
  + });
  +
  return branches;
  }
  