Revert "Merge from vscode merge-base (#22769)" (#22779)

This reverts commit 6bd0a17d3c.
This commit is contained in:
Karl Burtram
2023-04-18 21:44:05 -07:00
committed by GitHub
parent 6bd0a17d3c
commit 47a1745180
2389 changed files with 42588 additions and 92170 deletions

View File

@@ -21,9 +21,8 @@ export function isInCodespaces(): boolean {
async function handlePushError(repository: Repository, remote: Remote, refspec: string, owner: string, repo: string): Promise<void> {
const yes = localize('create a fork', "Create Fork");
const no = localize('no', "No");
const askFork = localize('fork', "You don't have permissions to push to '{0}/{1}' on GitHub. Would you like to create a fork and push to it instead?", owner, repo);
const answer = await window.showInformationMessage(askFork, yes, no);
const answer = await window.showInformationMessage(localize('fork', "You don't have permissions to push to '{0}/{1}' on GitHub. Would you like to create a fork and push to it instead?", owner, repo), yes, no);
if (answer !== yes) {
return;
}
@@ -103,19 +102,18 @@ async function handlePushError(repository: Repository, remote: Remote, refspec:
let title = `Update ${remoteName}`;
const head = repository.state.HEAD?.name;
let body: string | undefined;
if (head) {
const commit = await repository.getCommit(head);
title = commit.message.split('\n')[0];
body = commit.message.slice(title.length + 1).trim();
title = commit.message.replace(/\n.*$/m, '');
}
let body: string | undefined;
const templates = await findPullRequestTemplates(repository.rootUri);
if (templates.length > 0) {
templates.sort((a, b) => a.path.localeCompare(b.path));
const template = await pickPullRequestTemplate(repository.rootUri, templates);
const template = await pickPullRequestTemplate(templates);
if (template) {
body = new TextDecoder('utf-8').decode(await workspace.fs.readFile(template));
@@ -192,8 +190,8 @@ export async function findPullRequestTemplates(repositoryRootUri: Uri): Promise<
return results.flatMap(x => x.status === 'fulfilled' && x.value || []);
}
export async function pickPullRequestTemplate(repositoryRootUri: Uri, templates: Uri[]): Promise<Uri | undefined> {
const quickPickItemFromUri = (x: Uri) => ({ label: path.relative(repositoryRootUri.path, x.path), template: x });
export async function pickPullRequestTemplate(templates: Uri[]): Promise<Uri | undefined> {
const quickPickItemFromUri = (x: Uri) => ({ label: x.path, template: x });
const quickPickItems = [
{
label: localize('no pr template', "No template"),
@@ -203,8 +201,7 @@ export async function pickPullRequestTemplate(repositoryRootUri: Uri, templates:
...templates.map(quickPickItemFromUri)
];
const quickPickOptions: QuickPickOptions = {
placeHolder: localize('select pr template', "Select the Pull Request template"),
ignoreFocusOut: true
placeHolder: localize('select pr template', "Select the Pull Request template")
};
const pickedTemplate = await window.showQuickPick(quickPickItems, quickPickOptions);
return pickedTemplate?.template;
@@ -222,7 +219,7 @@ export class GithubPushErrorHandler implements PushErrorHandler {
return false;
}
const match = /^(?:https:\/\/github\.com\/|git@github\.com:)([^\/]+)\/([^\/.]+)/i.exec(remoteUrl);
const match = /^(?:https:\/\/github\.com\/|git@github\.com:)([^/]+)\/([^/.]+)(?:\.git)?$/i.exec(remoteUrl);
if (!match) {
return false;
}