@@ -860,17 +860,16 @@ class HistoryItemActionRunner2 extends ActionRunner {
860
860
const selection = this . getSelectedHistoryItems ( ) ;
861
861
const contextIsSelected = selection . some ( s => s === context ) ;
862
862
if ( contextIsSelected && selection . length > 1 ) {
863
- args . push ( ...[ selection [ 0 ] , selection [ selection . length - 1 ] ]
864
- . map ( h => (
865
- {
866
- id : h . historyItemViewModel . historyItem . id ,
867
- parentIds : h . historyItemViewModel . historyItem . parentIds ,
868
- message : h . historyItemViewModel . historyItem . message ,
869
- author : h . historyItemViewModel . historyItem . author ,
870
- icon : h . historyItemViewModel . historyItem . icon ,
871
- timestamp : h . historyItemViewModel . historyItem . timestamp ,
872
- statistics : h . historyItemViewModel . historyItem . statistics ,
873
- } satisfies ISCMHistoryItem ) ) ) ;
863
+ args . push ( ...selection . map ( h => (
864
+ {
865
+ id : h . historyItemViewModel . historyItem . id ,
866
+ parentIds : h . historyItemViewModel . historyItem . parentIds ,
867
+ message : h . historyItemViewModel . historyItem . message ,
868
+ author : h . historyItemViewModel . historyItem . author ,
869
+ icon : h . historyItemViewModel . historyItem . icon ,
870
+ timestamp : h . historyItemViewModel . historyItem . timestamp ,
871
+ statistics : h . historyItemViewModel . historyItem . statistics ,
872
+ } satisfies ISCMHistoryItem ) ) ) ;
874
873
} else {
875
874
args . push ( {
876
875
id : context . historyItemViewModel . historyItem . id ,
@@ -1905,6 +1904,60 @@ registerAction2(class extends Action2 {
1905
1904
}
1906
1905
} ) ;
1907
1906
1907
+ registerAction2 ( class extends Action2 {
1908
+ constructor ( ) {
1909
+ super ( {
1910
+ id : 'workbench.scm.action.scm.viewChanges' ,
1911
+ title : localize ( 'viewChanges' , "View Changes" ) ,
1912
+ f1 : false ,
1913
+ menu : [
1914
+ {
1915
+ id : MenuId . SCMChangesContext ,
1916
+ group : '0_view' ,
1917
+ when : ContextKeyExpr . equals ( 'config.multiDiffEditor.experimental.enabled' , true )
1918
+ }
1919
+ ]
1920
+ } ) ;
1921
+ }
1922
+
1923
+ override async run ( accessor : ServicesAccessor , provider : ISCMProvider , ...historyItems : ISCMHistoryItem [ ] ) {
1924
+ const commandService = accessor . get ( ICommandService ) ;
1925
+
1926
+ if ( ! provider || historyItems . length === 0 ) {
1927
+ return ;
1928
+ }
1929
+
1930
+ const historyItem = historyItems [ 0 ] ;
1931
+ const historyItemLast = historyItems [ historyItems . length - 1 ] ;
1932
+ const historyProvider = provider . historyProvider . get ( ) ;
1933
+
1934
+ if ( historyItems . length > 1 ) {
1935
+ const ancestor = await historyProvider ?. resolveHistoryItemGroupCommonAncestor2 ( [ historyItem . id , historyItemLast . id ] ) ;
1936
+ if ( ! ancestor || ( ancestor !== historyItem . id && ancestor !== historyItemLast . id ) ) {
1937
+ return ;
1938
+ }
1939
+ }
1940
+
1941
+ const historyItemParentId = historyItemLast . parentIds . length > 0 ? historyItemLast . parentIds [ 0 ] : undefined ;
1942
+ const historyItemChanges = await historyProvider ?. provideHistoryItemChanges ( historyItem . id , historyItemParentId ) ;
1943
+
1944
+ if ( ! historyItemChanges ?. length ) {
1945
+ return ;
1946
+ }
1947
+
1948
+ const title = historyItems . length === 1 ?
1949
+ `${ historyItems [ 0 ] . id . substring ( 0 , 8 ) } - ${ historyItems [ 0 ] . message } ` :
1950
+ localize ( 'historyItemChangesEditorTitle' , "All Changes ({0} ↔ {1})" , historyItem . id . substring ( 0 , 8 ) , historyItemLast . id . substring ( 0 , 8 ) ) ;
1951
+
1952
+ const rootUri = provider . rootUri ;
1953
+ const multiDiffSourceUri = rootUri ?
1954
+ rootUri . with ( { scheme : 'scm-history-item' , path : `${ rootUri . path } /${ historyItem . id } ..${ historyItemParentId } ` } ) :
1955
+ URI . from ( { scheme : 'scm-history-item' , path : `${ provider . label } /${ historyItem . id } ..${ historyItemParentId } ` } , true ) ;
1956
+
1957
+ commandService . executeCommand ( '_workbench.openMultiDiffEditor' , { title, multiDiffSourceUri, resources : historyItemChanges } ) ;
1958
+ }
1959
+ } ) ;
1960
+
1908
1961
class RepositoryVisibilityAction extends Action2 {
1909
1962
1910
1963
private repository : ISCMRepository ;
@@ -3367,8 +3420,8 @@ export class SCMViewPane extends ViewPane {
3367
3420
3368
3421
const rootUri = e . element . repository . provider . rootUri ;
3369
3422
const multiDiffSourceUri = rootUri ?
3370
- rootUri . with ( { scheme : 'scm-history-item' , path : `${ rootUri . path } /${ historyItem . id } ` } ) :
3371
- { scheme : 'scm-history-item' , path : `${ e . element . repository . provider . label } /${ historyItem . id } ` } ;
3423
+ rootUri . with ( { scheme : 'scm-history-item' , path : `${ rootUri . path } /${ historyItem . id } .. ${ historyItemParentId } ` } ) :
3424
+ URI . from ( { scheme : 'scm-history-item' , path : `${ e . element . repository . provider . label } /${ historyItem . id } .. ${ historyItemParentId } ` } , true ) ;
3372
3425
3373
3426
await this . commandService . executeCommand ( '_workbench.openMultiDiffEditor' , { title, multiDiffSourceUri, resources : historyItemChanges } ) ;
3374
3427
}
0 commit comments