File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -511,6 +511,7 @@ export function registerCommands(
511511 } ) ,
512512 ) ;
513513
514+ let isCheckingOutFromReadonlyFile = false ;
514515 context . subscriptions . push ( vscode . commands . registerCommand ( 'pr.checkoutFromReadonlyFile' , async ( ) => {
515516 const uri = vscode . window . activeTextEditor ?. document . uri ;
516517 if ( uri ?. scheme !== Schemes . Pr ) {
@@ -528,9 +529,15 @@ export function registerCommands(
528529 if ( ! folderManager || ! githubRepository ) {
529530 return ;
530531 }
531- const prModel = await folderManager . fetchById ( githubRepository , Number ( prUriPropserties . prNumber ) ) ;
532- if ( prModel ) {
533- return ReviewManager . getReviewManagerForFolderManager ( reviewsManager . reviewManagers , folderManager ) ?. switch ( prModel ) ;
532+ const prModel = await vscode . window . withProgress ( { location : vscode . ProgressLocation . Window } , ( ) => folderManager . fetchById ( githubRepository ! , Number ( prUriPropserties . prNumber ) ) ) ;
533+ if ( prModel && ! isCheckingOutFromReadonlyFile ) {
534+ isCheckingOutFromReadonlyFile = true ;
535+ try {
536+ await ReviewManager . getReviewManagerForFolderManager ( reviewsManager . reviewManagers , folderManager ) ?. switch ( prModel ) ;
537+ } catch ( e ) {
538+ vscode . window . showErrorMessage ( vscode . l10n . t ( 'Unable to check out pull request from read-only file: {0}' , e instanceof Error ? e . message : 'unknown' ) ) ;
539+ }
540+ isCheckingOutFromReadonlyFile = false ;
534541 }
535542 } ) ) ;
536543
You can’t perform that action at this time.
0 commit comments