1
1
import type { ConfigurationChangeEvent } from 'vscode' ;
2
- import { Disposable , workspace } from 'vscode' ;
2
+ import { Disposable , Uri , workspace } from 'vscode' ;
3
3
import type { CreatePullRequestActionContext } from '../../api/gitlens' ;
4
4
import type { EnrichedAutolink } from '../../autolinks' ;
5
5
import { getAvatarUriFromGravatarEmail } from '../../avatars' ;
@@ -23,6 +23,7 @@ import type { GitBranch } from '../../git/models/branch';
23
23
import { getAssociatedIssuesForBranch , getBranchTargetInfo } from '../../git/models/branch.utils' ;
24
24
import type { GitFileChangeShape } from '../../git/models/file' ;
25
25
import type { Issue } from '../../git/models/issue' ;
26
+ import type { GitPausedOperationStatus } from '../../git/models/pausedOperationStatus' ;
26
27
import type { PullRequest } from '../../git/models/pullRequest' ;
27
28
import { getComparisonRefsForPullRequest } from '../../git/models/pullRequest' ;
28
29
import { getReferenceFromBranch } from '../../git/models/reference.utils' ;
@@ -49,7 +50,7 @@ import type { Deferrable } from '../../system/function';
49
50
import { debounce } from '../../system/function' ;
50
51
import { filterMap } from '../../system/iterable' ;
51
52
import { getSettledValue } from '../../system/promise' ;
52
- import { executeActionCommand , executeCommand , registerCommand } from '../../system/vscode/command' ;
53
+ import { executeActionCommand , executeCommand , executeCoreCommand , registerCommand } from '../../system/vscode/command' ;
53
54
import { configuration } from '../../system/vscode/configuration' ;
54
55
import { getContext , onDidChangeContext } from '../../system/vscode/context' ;
55
56
import { openUrl , openWorkspace } from '../../system/vscode/utils' ;
@@ -114,6 +115,9 @@ interface BranchRef {
114
115
repoPath : string ;
115
116
branchId : string ;
116
117
}
118
+ interface GitPausedOperationCommandArgs {
119
+ operation : GitPausedOperationStatus ;
120
+ }
117
121
118
122
// type AutolinksInfo = Awaited<GetOverviewBranch['autolinks']>;
119
123
type BranchMergeTargetStatusInfo = Awaited < GetOverviewBranch [ 'mergeTarget' ] > ;
@@ -309,6 +313,10 @@ export class HomeWebviewProvider implements WebviewProvider<State, State, HomeWe
309
313
registerCommand ( 'gitlens.home.rebaseCurrentOnto' , this . rebaseCurrentOnto , this ) ,
310
314
registerCommand ( 'gitlens.home.startWork' , this . startWork , this ) ,
311
315
registerCommand ( 'gitlens.home.createCloudPatch' , this . createCloudPatch , this ) ,
316
+ registerCommand ( 'gitlens.home.skipPausedOperation' , this . skipPausedOperation , this ) ,
317
+ registerCommand ( 'gitlens.home.continuePausedOperation' , this . continuePausedOperation , this ) ,
318
+ registerCommand ( 'gitlens.home.abortPausedOperation' , this . abortPausedOperation , this ) ,
319
+ registerCommand ( 'gitlens.home.openRebaseEditor' , this . openRebaseEditor , this ) ,
312
320
] ;
313
321
}
314
322
@@ -454,6 +462,33 @@ export class HomeWebviewProvider implements WebviewProvider<State, State, HomeWe
454
462
} ) ;
455
463
}
456
464
465
+ private async abortPausedOperation ( pausedOpArgs : GitPausedOperationCommandArgs ) {
466
+ await this . container . git . status ( pausedOpArgs . operation . repoPath ) . abortPausedOperation ?.( ) ;
467
+ }
468
+
469
+ private async continuePausedOperation ( pausedOpArgs : GitPausedOperationCommandArgs ) {
470
+ if ( pausedOpArgs . operation . type === 'revert' ) return ;
471
+ await this . container . git . status ( pausedOpArgs . operation . repoPath ) . continuePausedOperation ?.( ) ;
472
+ }
473
+
474
+ private async skipPausedOperation ( pausedOpArgs : GitPausedOperationCommandArgs ) {
475
+ if ( pausedOpArgs . operation . type === 'merge' ) return ;
476
+
477
+ await this . container . git . status ( pausedOpArgs . operation . repoPath ) . continuePausedOperation ?.( { skip : true } ) ;
478
+ }
479
+
480
+ private async openRebaseEditor ( pausedOpArgs : GitPausedOperationCommandArgs ) {
481
+ if ( pausedOpArgs . operation . type !== 'rebase' ) return ;
482
+
483
+ const repo = this . _repositoryBranches . get ( pausedOpArgs . operation . repoPath ) ?. repo ;
484
+ if ( repo == null ) return ;
485
+
486
+ const rebaseTodoUri = Uri . joinPath ( repo . uri , '.git' , 'rebase-merge' , 'git-rebase-todo' ) ;
487
+ await executeCoreCommand ( 'vscode.openWith' , rebaseTodoUri , 'gitlens.rebase' , {
488
+ preview : false ,
489
+ } ) ;
490
+ }
491
+
457
492
private async createCloudPatch ( refs : BranchRef ) {
458
493
const status = await this . container . git . status ( refs . repoPath ) . getStatus ( ) ;
459
494
if ( status == null ) return ;
0 commit comments