Adds gitlens.openBranchInRemote command

Adds gitlens.openRepoInRemote command
This commit is contained in:
Eric Amodio
2017-05-22 16:06:45 -04:00
parent 49fa9b5078
commit 6d1a1ca346
9 changed files with 147 additions and 4 deletions

View File

@@ -32,6 +32,16 @@ export class OpenInRemoteCommand extends ActiveEditorCommand {
let placeHolder: string = '';
switch (args.resource.type) {
case 'branch':
// Check to see if the remote is in the branch
const index = args.resource.branch.indexOf('/');
if (index >= 0) {
const remoteName = args.resource.branch.substring(0, index);
const remote = args.remotes.find(r => r.name === remoteName);
if (remote !== undefined) {
args.resource.branch = args.resource.branch.substring(index + 1);
args.remotes = [remote];
}
}
placeHolder = `open ${args.resource.branch} branch in\u2026`;
break;
@@ -64,6 +74,11 @@ export class OpenInRemoteCommand extends ActiveEditorCommand {
break;
}
if (args.remotes.length === 1) {
const command = new OpenRemoteCommandQuickPickItem(args.remotes[0], args.resource);
return command.execute();
}
const pick = await RemotesQuickPick.show(args.remotes, placeHolder, args.resource, args.goBackCommand);
if (pick === undefined) return undefined;