Merge from vscode 8e0f348413f4f616c23a88ae30030efa85811973 (#6381)

* Merge from vscode 8e0f348413f4f616c23a88ae30030efa85811973

* disable strict null check
This commit is contained in:
Anthony Dresser
2019-07-15 22:35:46 -07:00
committed by GitHub
parent f720ec642f
commit 0b7e7ddbf9
2406 changed files with 59140 additions and 35464 deletions

View File

@@ -56,7 +56,13 @@ class CheckoutRemoteHeadItem extends CheckoutItem {
return;
}
await repository.checkoutTracking(this.ref.name);
const branches = await repository.findTrackingBranches(this.ref.name);
if (branches.length > 0) {
await repository.checkout(branches[0].name!);
} else {
await repository.checkoutTracking(this.ref.name);
}
}
}
@@ -196,7 +202,7 @@ function createCheckoutItems(repository: Repository): CheckoutItem[] {
enum PushType {
Push,
PushTo,
PushTags,
PushFollowTags,
}
interface PushOptions {
@@ -481,10 +487,10 @@ export class CommandCenter {
(_, token) => this.git.clone(url!, parentPath, token)
);
const choices = [];
let message = localize('proposeopen', "Would you like to open the cloned repository?");
const open = localize('openrepo', "Open Repository");
choices.push(open);
const open = localize('openrepo', "Open");
const openNewWindow = localize('openreponew', "Open in New Window");
const choices = [open, openNewWindow];
const addToWorkspace = localize('add', "Add to Workspace");
if (workspace.workspaceFolders) {
@@ -509,6 +515,8 @@ export class CommandCenter {
commands.executeCommand('vscode.openFolder', uri);
} else if (result === addToWorkspace) {
workspace.updateWorkspaceFolders(workspace.workspaceFolders!.length, 0, { uri });
} else if (result === openNewWindow) {
commands.executeCommand('vscode.openFolder', uri, true);
}
} catch (err) {
if (/already exists and is not an empty directory/.test(err && err.stderr || '')) {
@@ -593,10 +601,10 @@ export class CommandCenter {
await this.git.init(repositoryPath);
const choices = [];
let message = localize('proposeopen init', "Would you like to open the initialized repository?");
const open = localize('openrepo', "Open Repository");
choices.push(open);
const open = localize('openrepo', "Open");
const openNewWindow = localize('openreponew', "Open in New Window");
const choices = [open, openNewWindow];
if (!askToOpen) {
return;
@@ -615,6 +623,8 @@ export class CommandCenter {
commands.executeCommand('vscode.openFolder', uri);
} else if (result === addToWorkspace) {
workspace.updateWorkspaceFolders(workspace.workspaceFolders!.length, 0, { uri });
} else if (result === openNewWindow) {
commands.executeCommand('vscode.openFolder', uri, true);
} else {
await this.model.openRepository(repositoryPath);
}
@@ -663,7 +673,6 @@ export class CommandCenter {
if (!(resource instanceof Resource)) {
// can happen when called from a keybinding
console.log('WHAT');
resource = this.getSCMResource();
}
@@ -728,6 +737,8 @@ export class CommandCenter {
}
const HEAD = await this.getLeftResource(resource);
const basename = path.basename(resource.resourceUri.fsPath);
const title = `${basename} (HEAD)`;
if (!HEAD) {
window.showWarningMessage(localize('HEAD not available', "HEAD version of '{0}' is not available.", path.basename(resource.resourceUri.fsPath)));
@@ -738,7 +749,7 @@ export class CommandCenter {
preview
};
return await commands.executeCommand<void>('vscode.open', HEAD, opts);
return await commands.executeCommand<void>('vscode.open', HEAD, opts, title);
}
@command('git.openChange')
@@ -1560,8 +1571,11 @@ export class CommandCenter {
@command('git.renameBranch', { repository: true })
async renameBranch(repository: Repository): Promise<void> {
const placeHolder = localize('provide branch name', "Please provide a branch name");
const name = await window.showInputBox({ placeHolder });
const name = await window.showInputBox({
placeHolder: localize('branch name', "Branch name"),
prompt: localize('provide branch name', "Please provide a branch name"),
value: repository.HEAD && repository.HEAD.name
});
if (!name || name.trim().length === 0) {
return;
@@ -1753,10 +1767,8 @@ export class CommandCenter {
}
}
if (pushOptions.pushType === PushType.PushTags) {
await repository.pushTags(undefined, forcePushMode);
window.showInformationMessage(localize('push with tags success', "Successfully pushed with tags."));
if (pushOptions.pushType === PushType.PushFollowTags) {
await repository.pushFollowTags(undefined, forcePushMode);
return;
}
@@ -1813,13 +1825,13 @@ export class CommandCenter {
}
@command('git.pushWithTags', { repository: true })
async pushWithTags(repository: Repository): Promise<void> {
await this._push(repository, { pushType: PushType.PushTags });
async pushFollowTags(repository: Repository): Promise<void> {
await this._push(repository, { pushType: PushType.PushFollowTags });
}
@command('git.pushWithTagsForce', { repository: true })
async pushWithTagsForce(repository: Repository): Promise<void> {
await this._push(repository, { pushType: PushType.PushTags, forcePush: true });
async pushFollowTagsForce(repository: Repository): Promise<void> {
await this._push(repository, { pushType: PushType.PushFollowTags, forcePush: true });
}
@command('git.pushTo', { repository: true })