From 22f4fe62cae5daafca2f4144f02202bbeb58b859 Mon Sep 17 00:00:00 2001 From: "Babak K. Shandiz" Date: Thu, 28 Apr 2022 14:12:39 +0000 Subject: [PATCH 1/5] =?UTF-8?q?=F0=9F=94=A8=20Set=20ignoreFocusOut=20to=20?= =?UTF-8?q?true=20on=20PR=20template=20selection?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Babak K. Shandiz --- extensions/github/src/pushErrorHandler.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/extensions/github/src/pushErrorHandler.ts b/extensions/github/src/pushErrorHandler.ts index 5948c526ea1aa..a4004c2a1923d 100644 --- a/extensions/github/src/pushErrorHandler.ts +++ b/extensions/github/src/pushErrorHandler.ts @@ -199,7 +199,8 @@ export async function pickPullRequestTemplate(templates: Uri[]): Promise Date: Thu, 28 Apr 2022 14:28:34 +0000 Subject: [PATCH 2/5] =?UTF-8?q?=F0=9F=94=A8=20Translate=20PR=20template=20?= =?UTF-8?q?paths=20to=20relative=20in=20quick=20pick=20list?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Babak K. Shandiz --- extensions/github/src/pushErrorHandler.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/extensions/github/src/pushErrorHandler.ts b/extensions/github/src/pushErrorHandler.ts index a4004c2a1923d..609896600b717 100644 --- a/extensions/github/src/pushErrorHandler.ts +++ b/extensions/github/src/pushErrorHandler.ts @@ -111,7 +111,7 @@ async function handlePushError(repository: Repository, remote: Remote, refspec: if (templates.length > 0) { templates.sort((a, b) => a.path.localeCompare(b.path)); - const template = await pickPullRequestTemplate(templates); + const template = await pickPullRequestTemplate(repository.rootUri, templates); if (template) { body = new TextDecoder('utf-8').decode(await workspace.fs.readFile(template)); @@ -188,8 +188,8 @@ export async function findPullRequestTemplates(repositoryRootUri: Uri): Promise< return results.flatMap(x => x.status === 'fulfilled' && x.value || []); } -export async function pickPullRequestTemplate(templates: Uri[]): Promise { - const quickPickItemFromUri = (x: Uri) => ({ label: x.path, template: x }); +export async function pickPullRequestTemplate(repositoryRootUri: Uri, templates: Uri[]): Promise { + const quickPickItemFromUri = (x: Uri) => ({ label: path.relative(repositoryRootUri.path, x.path), template: x }); const quickPickItems = [ { label: localize('no pr template', "No template"), From 64e7f3a11b705d0b8cf173286cbb2ae173629287 Mon Sep 17 00:00:00 2001 From: "Babak K. Shandiz" Date: Thu, 28 Apr 2022 14:29:25 +0000 Subject: [PATCH 3/5] =?UTF-8?q?=F0=9F=92=84=20Shorten=20line=20length?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Babak K. Shandiz --- extensions/github/src/pushErrorHandler.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/extensions/github/src/pushErrorHandler.ts b/extensions/github/src/pushErrorHandler.ts index 609896600b717..3a774aa9a6806 100644 --- a/extensions/github/src/pushErrorHandler.ts +++ b/extensions/github/src/pushErrorHandler.ts @@ -21,8 +21,9 @@ export function isInCodespaces(): boolean { async function handlePushError(repository: Repository, remote: Remote, refspec: string, owner: string, repo: string): Promise { 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(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); + const answer = await window.showInformationMessage(askFork, yes, no); if (answer === no) { return; } From 7059b377933c7df08f1a1dd1f953d4d24a53279a Mon Sep 17 00:00:00 2001 From: "Babak K. Shandiz" Date: Thu, 28 Apr 2022 14:34:58 +0000 Subject: [PATCH 4/5] =?UTF-8?q?=E2=9A=97=EF=B8=8F=20Update=20tests=20with?= =?UTF-8?q?=20latest=20required=20args?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Babak K. Shandiz --- extensions/github/src/test/github.test.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/extensions/github/src/test/github.test.ts b/extensions/github/src/test/github.test.ts index 871a617ab462d..9a6c6b12ffaf3 100644 --- a/extensions/github/src/test/github.test.ts +++ b/extensions/github/src/test/github.test.ts @@ -43,7 +43,7 @@ suite('github smoke test', function () { const template1 = Uri.file("some-imaginary-template-1"); const templates = [template0, template1]; - const pick = pickPullRequestTemplate(templates); + const pick = pickPullRequestTemplate(Uri.file("/"), templates); await commands.executeCommand('workbench.action.quickOpenSelectNext'); await commands.executeCommand('workbench.action.quickOpenSelectNext'); @@ -55,7 +55,7 @@ suite('github smoke test', function () { test('selecting first quick-pick item should return undefined', async () => { const templates = [Uri.file("some-imaginary-file")]; - const pick = pickPullRequestTemplate(templates); + const pick = pickPullRequestTemplate(Uri.file("/"), templates); await commands.executeCommand('workbench.action.quickOpenSelectNext'); await commands.executeCommand('workbench.action.acceptSelectedQuickOpenItem'); From 2dc0d02ae8c260a530746032002377c5dec90915 Mon Sep 17 00:00:00 2001 From: "Babak K. Shandiz" Date: Tue, 3 May 2022 09:53:50 +0000 Subject: [PATCH 5/5] =?UTF-8?q?=E2=9A=97=EF=B8=8F=20Update=20GitHub=20exte?= =?UTF-8?q?nsion=20unit=20tests?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Babak K. Shandiz --- extensions/github/src/test/github.test.ts | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/extensions/github/src/test/github.test.ts b/extensions/github/src/test/github.test.ts index 9a6c6b12ffaf3..2fc5fbd23a5e6 100644 --- a/extensions/github/src/test/github.test.ts +++ b/extensions/github/src/test/github.test.ts @@ -18,15 +18,15 @@ suite('github smoke test', function () { test('should find all templates', async function () { const expectedValuesSorted = [ - '/PULL_REQUEST_TEMPLATE/a.md', - '/PULL_REQUEST_TEMPLATE/b.md', - '/docs/PULL_REQUEST_TEMPLATE.md', - '/docs/PULL_REQUEST_TEMPLATE/a.md', - '/docs/PULL_REQUEST_TEMPLATE/b.md', - '/.github/PULL_REQUEST_TEMPLATE.md', - '/.github/PULL_REQUEST_TEMPLATE/a.md', - '/.github/PULL_REQUEST_TEMPLATE/b.md', - '/PULL_REQUEST_TEMPLATE.md' + 'PULL_REQUEST_TEMPLATE/a.md', + 'PULL_REQUEST_TEMPLATE/b.md', + 'docs/PULL_REQUEST_TEMPLATE.md', + 'docs/PULL_REQUEST_TEMPLATE/a.md', + 'docs/PULL_REQUEST_TEMPLATE/b.md', + '.github/PULL_REQUEST_TEMPLATE.md', + '.github/PULL_REQUEST_TEMPLATE/a.md', + '.github/PULL_REQUEST_TEMPLATE/b.md', + 'PULL_REQUEST_TEMPLATE.md' ]; expectedValuesSorted.sort();