66'use strict' ;
77
88import { commands , Uri , Command , EventEmitter , Event , scm , SourceControl , SourceControlInputBox , SourceControlResourceGroup , SourceControlResourceState , SourceControlResourceDecorations , SourceControlInputBoxValidation , Disposable , ProgressLocation , window , workspace , WorkspaceEdit , ThemeColor , DecorationData , Memento , SourceControlInputBoxValidationType } from 'vscode' ;
9- import { Repository as BaseRepository , Commit , GitErrorCodes , Stash , GitError , Submodule , DiffOptions } from './git' ;
9+ import { Repository as BaseRepository , Commit , GitErrorCodes , Stash , GitError , Submodule } from './git' ;
1010import { anyEvent , filterEvent , eventToPromise , dispose , find , isDescendant , IDisposable , onceEvent , EmptyDisposable , debounceEvent } from './util' ;
1111import { memoize , throttle , debounce } from './decorators' ;
1212import { toGitUri } from './uri' ;
@@ -277,14 +277,20 @@ export class Resource implements SourceControlResourceState {
277277
278278export enum Operation {
279279 Status = 'Status' ,
280+ Config = 'Config' ,
280281 Diff = 'Diff' ,
282+ MergeBase = 'MergeBase' ,
281283 Add = 'Add' ,
282284 RevertFiles = 'RevertFiles' ,
283285 Commit = 'Commit' ,
284286 Clean = 'Clean' ,
285287 Branch = 'Branch' ,
288+ GetBranch = 'GetBranch' ,
289+ SetBranchUpstream = 'SetBranchUpstream' ,
290+ HashObject = 'HashObject' ,
286291 Checkout = 'Checkout' ,
287292 Reset = 'Reset' ,
293+ Remote = 'Remote' ,
288294 Fetch = 'Fetch' ,
289295 Pull = 'Pull' ,
290296 Push = 'Push' ,
@@ -650,13 +656,53 @@ export class Repository implements Disposable {
650656 }
651657 }
652658
659+ getConfigs ( ) : Promise < { key : string ; value : string ; } [ ] > {
660+ return this . run ( Operation . Config , ( ) => this . repository . getConfigs ( 'local' ) ) ;
661+ }
662+
663+ getConfig ( key : string ) : Promise < string > {
664+ return this . run ( Operation . Config , ( ) => this . repository . config ( 'local' , key ) ) ;
665+ }
666+
667+ setConfig ( key : string , value : string ) : Promise < string > {
668+ return this . run ( Operation . Config , ( ) => this . repository . config ( 'local' , key , value ) ) ;
669+ }
670+
653671 @throttle
654672 async status ( ) : Promise < void > {
655673 await this . run ( Operation . Status ) ;
656674 }
657675
658- diff ( path : string , cached = false ) : Promise < string > {
659- return this . run ( Operation . Diff , ( ) => this . repository . diff ( path , cached ) ) ;
676+ diffWithHEAD ( path : string ) : Promise < string > {
677+ return this . run ( Operation . Diff , ( ) => this . repository . diffWithHEAD ( path ) ) ;
678+ }
679+
680+ diffWith ( ref : string , path : string ) : Promise < string > {
681+ return this . run ( Operation . Diff , ( ) => this . repository . diffWith ( ref , path ) ) ;
682+ }
683+
684+ diffIndexWithHEAD ( path : string ) : Promise < string > {
685+ return this . run ( Operation . Diff , ( ) => this . repository . diffIndexWithHEAD ( path ) ) ;
686+ }
687+
688+ diffIndexWith ( ref : string , path : string ) : Promise < string > {
689+ return this . run ( Operation . Diff , ( ) => this . repository . diffIndexWith ( ref , path ) ) ;
690+ }
691+
692+ diffBlobs ( object1 : string , object2 : string ) : Promise < string > {
693+ return this . run ( Operation . Diff , ( ) => this . repository . diffBlobs ( object1 , object2 ) ) ;
694+ }
695+
696+ diffBetween ( ref1 : string , ref2 : string , path : string ) : Promise < string > {
697+ return this . run ( Operation . Diff , ( ) => this . repository . diffBetween ( ref1 , ref2 , path ) ) ;
698+ }
699+
700+ getMergeBase ( ref1 : string , ref2 : string ) : Promise < string > {
701+ return this . run ( Operation . MergeBase , ( ) => this . repository . getMergeBase ( ref1 , ref2 ) ) ;
702+ }
703+
704+ async hashObject ( data : string ) : Promise < string > {
705+ return this . run ( Operation . HashObject , ( ) => this . repository . hashObject ( data ) ) ;
660706 }
661707
662708 async add ( resources : Uri [ ] ) : Promise < void > {
@@ -758,6 +804,14 @@ export class Repository implements Disposable {
758804 await this . run ( Operation . RenameBranch , ( ) => this . repository . renameBranch ( name ) ) ;
759805 }
760806
807+ async getBranch ( name : string ) : Promise < Branch > {
808+ return await this . run ( Operation . GetBranch , ( ) => this . repository . getBranch ( name ) ) ;
809+ }
810+
811+ async setBranchUpstream ( name : string , upstream : string ) : Promise < void > {
812+ await this . run ( Operation . SetBranchUpstream , ( ) => this . repository . setBranchUpstream ( name , upstream ) ) ;
813+ }
814+
761815 async merge ( ref : string ) : Promise < void > {
762816 await this . run ( Operation . Merge , ( ) => this . repository . merge ( ref ) ) ;
763817 }
@@ -782,6 +836,14 @@ export class Repository implements Disposable {
782836 await this . run ( Operation . DeleteRef , ( ) => this . repository . deleteRef ( ref ) ) ;
783837 }
784838
839+ async addRemote ( name : string , url : string ) : Promise < void > {
840+ await this . run ( Operation . Remote , ( ) => this . repository . addRemote ( name , url ) ) ;
841+ }
842+
843+ async removeRemote ( name : string ) : Promise < void > {
844+ await this . run ( Operation . Remote , ( ) => this . repository . removeRemote ( name ) ) ;
845+ }
846+
785847 @throttle
786848 async fetchDefault ( ) : Promise < void > {
787849 await this . run ( Operation . Fetch , ( ) => this . repository . fetch ( ) ) ;
@@ -805,7 +867,7 @@ export class Repository implements Disposable {
805867 }
806868
807869 @throttle
808- async pull ( head : Branch | undefined ) : Promise < void > {
870+ async pull ( head ? : Branch ) : Promise < void > {
809871 let remote : string | undefined ;
810872 let branch : string | undefined ;
811873
0 commit comments