Skip to content

Commit ef9c114

Browse files
Adds commands to Add Issue to Branch (#3881)
* Adds commands to Add Issue to Branch * Updates wording to "associate issue with branch" * Updates command title
1 parent ba0138e commit ef9c114

File tree

11 files changed

+406
-58
lines changed

11 files changed

+406
-58
lines changed

contributions.json

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@
2323
]
2424
}
2525
},
26+
"gitlens.associateIssueWithBranch": {
27+
"label": "Associate Issue with Branch...",
28+
"commandPalette": "gitlens:enabled && !gitlens:readonly && !gitlens:untrusted && !gitlens:hasVirtualFolders"
29+
},
2630
"gitlens.annotations.nextChange": {
2731
"label": "Next Change",
2832
"icon": "$(arrow-down)"
@@ -1453,6 +1457,19 @@
14531457
]
14541458
}
14551459
},
1460+
"gitlens.graph.associateIssueWithBranch": {
1461+
"label": "Associate Issue with Branch...",
1462+
"enablement": "!operationInProgress",
1463+
"menus": {
1464+
"webview/context": [
1465+
{
1466+
"when": "webviewItem =~ /gitlens:branch\\b(?!.*?\\b\\+remote\\b)/ && !gitlens:hasVirtualFolders && !gitlens:readonly && !gitlens:untrusted",
1467+
"group": "1_gitlens_actions",
1468+
"order": 8
1469+
}
1470+
]
1471+
}
1472+
},
14561473
"gitlens.graph.cherryPick": {
14571474
"label": "Cherry Pick Commit...",
14581475
"enablement": "!operationInProgress",
@@ -4739,6 +4756,19 @@
47394756
]
47404757
}
47414758
},
4759+
"gitlens.views.associateIssueWithBranch": {
4760+
"label": "Associate Issue with Branch...",
4761+
"enablement": "!operationInProgress",
4762+
"menus": {
4763+
"view/item/context": [
4764+
{
4765+
"when": "viewItem =~ /gitlens:branch\\b(?!.*?\\b\\+remote\\b)/ && !listMultiSelection && !gitlens:hasVirtualFolders && !gitlens:readonly && !gitlens:untrusted",
4766+
"group": "1_gitlens_actions",
4767+
"order": 8
4768+
}
4769+
]
4770+
}
4771+
},
47424772
"gitlens.views.addRemote": {
47434773
"label": "Add Remote...",
47444774
"icon": "$(add)",

docs/telemetry-events.md

Lines changed: 103 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,105 @@ or
160160
}
161161
```
162162

163+
### associateIssueWithBranch/action
164+
165+
> Sent when the user chooses to manage integrations
166+
167+
```typescript
168+
{
169+
'instance': number,
170+
'action': 'manage' | 'connect',
171+
'connected': boolean,
172+
'items.count': number
173+
}
174+
```
175+
176+
### associateIssueWithBranch/issue/action
177+
178+
> Sent when the user takes an action on an issue
179+
180+
```typescript
181+
{
182+
'instance': number,
183+
'action': 'soft-open',
184+
'connected': boolean,
185+
[`item.${string}`]: string | number | boolean,
186+
'items.count': number
187+
}
188+
```
189+
190+
### associateIssueWithBranch/issue/chosen
191+
192+
> Sent when the user chooses an issue to associate with the branch in the second step
193+
194+
```typescript
195+
{
196+
'instance': number,
197+
'connected': boolean,
198+
[`item.${string}`]: string | number | boolean,
199+
'items.count': number
200+
}
201+
```
202+
203+
### associateIssueWithBranch/open
204+
205+
> Sent when the user opens Start Work; use `instance` to correlate an Associate Issue with Branch "session"
206+
207+
```typescript
208+
{
209+
'instance': number
210+
}
211+
```
212+
213+
### associateIssueWithBranch/opened
214+
215+
> Sent when the launchpad is opened; use `instance` to correlate an Associate Issue with Branch "session"
216+
217+
```typescript
218+
{
219+
'instance': number,
220+
'connected': boolean,
221+
'items.count': number
222+
}
223+
```
224+
225+
### associateIssueWithBranch/steps/connect
226+
227+
> Sent when the user reaches the "connect an integration" step of Associate Issue with Branch
228+
229+
```typescript
230+
{
231+
'instance': number,
232+
'connected': boolean,
233+
'items.count': number
234+
}
235+
```
236+
237+
### associateIssueWithBranch/steps/issue
238+
239+
> Sent when the user reaches the "choose an issue" step of Associate Issue with Branch
240+
241+
```typescript
242+
{
243+
'instance': number,
244+
'connected': boolean,
245+
'items.count': number
246+
}
247+
```
248+
249+
### associateIssueWithBranch/title/action
250+
251+
> Sent when the user chooses to connect an integration
252+
253+
```typescript
254+
{
255+
'instance': number,
256+
'action': 'connect',
257+
'connected': boolean,
258+
'items.count': number
259+
}
260+
```
261+
163262
### cloudIntegrations/connected
164263

165264
> Sent when connected to one or more cloud-based integrations from gkdev
@@ -960,7 +1059,7 @@ void
9601059
{
9611060
'instance': number,
9621061
'items.error': string,
963-
'action': 'open' | 'code-suggest' | 'merge' | 'soft-open' | 'switch' | 'open-worktree' | 'switch-and-code-suggest' | 'show-overview' | 'open-changes' | 'open-in-graph' | 'pin' | 'unpin' | 'snooze' | 'unsnooze' | 'open-suggestion' | 'open-suggestion-browser',
1062+
'action': 'soft-open' | 'open' | 'code-suggest' | 'merge' | 'switch' | 'open-worktree' | 'switch-and-code-suggest' | 'show-overview' | 'open-changes' | 'open-in-graph' | 'pin' | 'unpin' | 'snooze' | 'unsnooze' | 'open-suggestion' | 'open-suggestion-browser',
9641063
'groups.blocked.collapsed': boolean,
9651064
'groups.blocked.count': number,
9661065
'groups.count': number,
@@ -1257,7 +1356,7 @@ void
12571356
{
12581357
'instance': number,
12591358
'items.error': string,
1260-
'action': 'settings' | 'feedback' | 'open-on-gkdev' | 'refresh' | 'connect',
1359+
'action': 'settings' | 'connect' | 'feedback' | 'open-on-gkdev' | 'refresh',
12611360
'groups.blocked.collapsed': boolean,
12621361
'groups.blocked.count': number,
12631362
'groups.count': number,
@@ -1298,7 +1397,7 @@ void
12981397
'provider': string,
12991398
'repoPrivacy': 'private' | 'public' | 'local',
13001399
'repository.visibility': 'private' | 'public' | 'local',
1301-
'source': 'account' | 'subscription' | 'graph' | 'patchDetails' | 'settings' | 'timeline' | 'home' | 'code-suggest' | 'cloud-patches' | 'commandPalette' | 'deeplink' | 'inspect' | 'inspect-overview' | 'integrations' | 'launchpad' | 'launchpad-indicator' | 'launchpad-view' | 'notification' | 'prompt' | 'quick-wizard' | 'remoteProvider' | 'startWork' | 'trial-indicator' | 'scm-input' | 'walkthrough' | 'whatsnew' | 'worktrees'
1400+
'source': 'account' | 'subscription' | 'graph' | 'patchDetails' | 'settings' | 'timeline' | 'home' | 'view' | 'code-suggest' | 'associateIssueWithBranch' | 'cloud-patches' | 'commandPalette' | 'deeplink' | 'inspect' | 'inspect-overview' | 'integrations' | 'launchpad' | 'launchpad-indicator' | 'launchpad-view' | 'notification' | 'prompt' | 'quick-wizard' | 'remoteProvider' | 'startWork' | 'trial-indicator' | 'scm-input' | 'walkthrough' | 'whatsnew' | 'worktrees'
13021401
}
13031402
```
13041403

@@ -1468,7 +1567,7 @@ void
14681567
```typescript
14691568
{
14701569
'instance': number,
1471-
'action': 'connect' | 'manage',
1570+
'action': 'manage' | 'connect',
14721571
'connected': boolean,
14731572
'items.count': number
14741573
}

package.json

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5746,6 +5746,11 @@
57465746
"category": "GitLens",
57475747
"icon": "$(person-add)"
57485748
},
5749+
{
5750+
"command": "gitlens.associateIssueWithBranch",
5751+
"title": "Associate Issue with Branch...",
5752+
"category": "GitLens"
5753+
},
57495754
{
57505755
"command": "gitlens.annotations.nextChange",
57515756
"title": "Next Change",
@@ -6302,6 +6307,11 @@
63026307
"title": "Add as Co-author",
63036308
"icon": "$(person-add)"
63046309
},
6310+
{
6311+
"command": "gitlens.graph.associateIssueWithBranch",
6312+
"title": "Associate Issue with Branch...",
6313+
"enablement": "!operationInProgress"
6314+
},
63056315
{
63066316
"command": "gitlens.graph.cherryPick",
63076317
"title": "Cherry Pick Commit...",
@@ -7553,6 +7563,11 @@
75537563
"title": "Add Co-authors...",
75547564
"icon": "$(person-add)"
75557565
},
7566+
{
7567+
"command": "gitlens.views.associateIssueWithBranch",
7568+
"title": "Associate Issue with Branch...",
7569+
"enablement": "!operationInProgress"
7570+
},
75567571
{
75577572
"command": "gitlens.views.addRemote",
75587573
"title": "Add Remote...",
@@ -9850,6 +9865,10 @@
98509865
"command": "gitlens.applyPatchFromClipboard",
98519866
"when": "gitlens:enabled && !gitlens:untrusted && !gitlens:hasVirtualFolders"
98529867
},
9868+
{
9869+
"command": "gitlens.associateIssueWithBranch",
9870+
"when": "gitlens:enabled && !gitlens:readonly && !gitlens:untrusted && !gitlens:hasVirtualFolders"
9871+
},
98539872
{
98549873
"command": "gitlens.browseRepoAtRevision",
98559874
"when": "!gitlens:hasVirtualFolders && gitlens:enabled && resourceScheme =~ /^(gitlens|git|pr)$/"
@@ -10250,6 +10269,10 @@
1025010269
"command": "gitlens.graph.addAuthor",
1025110270
"when": "false"
1025210271
},
10272+
{
10273+
"command": "gitlens.graph.associateIssueWithBranch",
10274+
"when": "false"
10275+
},
1025310276
{
1025410277
"command": "gitlens.graph.cherryPick",
1025510278
"when": "false"
@@ -11206,6 +11229,10 @@
1120611229
"command": "gitlens.views.applyChanges",
1120711230
"when": "false"
1120811231
},
11232+
{
11233+
"command": "gitlens.views.associateIssueWithBranch",
11234+
"when": "false"
11235+
},
1120911236
{
1121011237
"command": "gitlens.views.branches.copy",
1121111238
"when": "false"
@@ -15205,6 +15232,11 @@
1520515232
"when": "viewItem =~ /gitlens:branch\\b(?!.*?\\b\\+(current|checkedout)\\b)(?!.*?\\b\\+closed\\b)/ && listMultiSelection && !gitlens:hasVirtualFolders && !gitlens:readonly && !gitlens:untrusted",
1520615233
"group": "1_gitlens_actions@7"
1520715234
},
15235+
{
15236+
"command": "gitlens.views.associateIssueWithBranch",
15237+
"when": "viewItem =~ /gitlens:branch\\b(?!.*?\\b\\+remote\\b)/ && !listMultiSelection && !gitlens:hasVirtualFolders && !gitlens:readonly && !gitlens:untrusted",
15238+
"group": "1_gitlens_actions@8"
15239+
},
1520815240
{
1520915241
"command": "gitlens.views.createBranch",
1521015242
"when": "viewItem =~ /gitlens:branch\\b(?!.*?\\b\\+closed\\b)/ && !listMultiSelection && !gitlens:hasVirtualFolders && !gitlens:readonly && !gitlens:untrusted",
@@ -18091,6 +18123,11 @@
1809118123
"when": "webviewItem =~ /gitlens:branch\\b(?!.*?\\b\\+(current|checkedout)\\b)/ && !gitlens:hasVirtualFolders && !gitlens:readonly && !gitlens:untrusted",
1809218124
"group": "1_gitlens_actions@7"
1809318125
},
18126+
{
18127+
"command": "gitlens.graph.associateIssueWithBranch",
18128+
"when": "webviewItem =~ /gitlens:branch\\b(?!.*?\\b\\+remote\\b)/ && !gitlens:hasVirtualFolders && !gitlens:readonly && !gitlens:untrusted",
18129+
"group": "1_gitlens_actions@8"
18130+
},
1809418131
{
1809518132
"command": "gitlens.graph.createBranch",
1809618133
"when": "webviewItem =~ /gitlens:branch\\b/ && !gitlens:hasVirtualFolders && !gitlens:readonly && !gitlens:untrusted",

src/commands/quickWizard.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
import { GlCommand } from '../constants.commands';
22
import type { Container } from '../container';
33
import type { LaunchpadCommandArgs } from '../plus/launchpad/launchpad';
4-
import type { StartWorkCommandArgs } from '../plus/startWork/startWork';
4+
import type { AssociateIssueWithBranchCommandArgs, StartWorkCommandArgs } from '../plus/startWork/startWork';
55
import { command } from '../system/vscode/command';
66
import type { CommandContext } from './base';
77
import type { QuickWizardCommandArgsWithCompletion } from './quickWizard.base';
88
import { QuickWizardCommandBase } from './quickWizard.base';
99

10-
export type QuickWizardCommandArgs = LaunchpadCommandArgs | StartWorkCommandArgs;
10+
export type QuickWizardCommandArgs = LaunchpadCommandArgs | StartWorkCommandArgs | AssociateIssueWithBranchCommandArgs;
1111

1212
@command()
1313
export class QuickWizardCommand extends QuickWizardCommandBase {
1414
constructor(container: Container) {
15-
super(container, [GlCommand.ShowLaunchpad, GlCommand.StartWork]);
15+
super(container, [GlCommand.ShowLaunchpad, GlCommand.StartWork, GlCommand.AssociateIssueWithBranch]);
1616
}
1717

1818
protected override preExecute(
@@ -26,6 +26,9 @@ export class QuickWizardCommand extends QuickWizardCommandBase {
2626
case GlCommand.StartWork:
2727
return this.execute({ command: 'startWork', ...args });
2828

29+
case GlCommand.AssociateIssueWithBranch:
30+
return this.execute({ command: 'associateIssueWithBranch', ...args });
31+
2932
default:
3033
return this.execute(args);
3134
}

src/commands/quickWizard.utils.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import type { StoredRecentUsage } from '../constants.storage';
22
import type { Container } from '../container';
33
import { LaunchpadCommand } from '../plus/launchpad/launchpad';
4-
import { StartWorkCommand } from '../plus/startWork/startWork';
4+
import { AssociateIssueWithBranchCommand, StartWorkCommand } from '../plus/startWork/startWork';
55
import { configuration } from '../system/vscode/configuration';
66
import { getContext } from '../system/vscode/context';
77
import { BranchGitCommand } from './git/branch';
@@ -117,6 +117,10 @@ export class QuickWizardRootStep implements QuickPickStep<QuickCommand> {
117117
if (args?.command === 'startWork') {
118118
this.hiddenItems.push(new StartWorkCommand(container, args));
119119
}
120+
121+
if (args?.command === 'associateIssueWithBranch') {
122+
this.hiddenItems.push(new AssociateIssueWithBranchCommand(container, args));
123+
}
120124
}
121125

122126
private _command: QuickCommand | undefined;

src/constants.commands.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ export const actionCommandPrefix = 'gitlens.action.';
55

66
export const enum GlCommand {
77
AddAuthors = 'gitlens.addAuthors',
8+
AssociateIssueWithBranch = 'gitlens.associateIssueWithBranch',
89
BrowseRepoAtRevision = 'gitlens.browseRepoAtRevision',
910
BrowseRepoAtRevisionInNewWindow = 'gitlens.browseRepoAtRevisionInNewWindow',
1011
BrowseRepoBeforeRevision = 'gitlens.browseRepoBeforeRevision',
@@ -572,6 +573,7 @@ export type TreeViewCommands = `gitlens.views.${
572573
| 'addAuthors'
573574
| 'addAuthor'
574575
| 'addAuthor.multi'
576+
| 'associateIssueWithBranch'
575577
| 'openBranchOnRemote'
576578
| 'openBranchOnRemote.multi'
577579
| 'copyRemoteCommitUrl'
@@ -697,6 +699,7 @@ type GraphWebviewCommands = `graph.${
697699
| 'pull'
698700
| 'fetch'
699701
| 'pushWithForce'
702+
| 'associateIssueWithBranch'
700703
| 'publishBranch'
701704
| 'switchToAnotherBranch'
702705
| 'createBranch'

0 commit comments

Comments
 (0)