33 * Licensed under the MIT License. See License.txt in the project root for license information.
44 *--------------------------------------------------------------------------------------------*/
55
6- import { CancellationToken , Event , SourceControlInputBox , Uri } from 'vscode' ;
6+ import { Uri , Event , Disposable , ProviderResult } from 'vscode' ;
7+ export { ProviderResult } from 'vscode' ;
78
89export interface Git {
910 readonly path : string ;
@@ -41,7 +42,10 @@ export interface Commit {
4142 readonly hash : string ;
4243 readonly message : string ;
4344 readonly parents : string [ ] ;
44- readonly authorEmail ?: string | undefined ;
45+ readonly authorDate ?: Date ;
46+ readonly authorName ?: string ;
47+ readonly authorEmail ?: string ;
48+ readonly commitDate ?: Date ;
4549}
4650
4751export interface Submodule {
@@ -110,9 +114,29 @@ export interface RepositoryUIState {
110114 readonly onDidChange : Event < void > ;
111115}
112116
117+ /**
118+ * Log options.
119+ */
113120export interface LogOptions {
114- // Max number of log entries to retrieve. If not specified, the default is 32.
121+ /** Max number of log entries to retrieve. If not specified, the default is 32. */
115122 readonly maxEntries ?: number ;
123+ readonly path ?: string ;
124+ }
125+
126+ export interface CommitOptions {
127+ all ?: boolean | 'tracked' ;
128+ amend ?: boolean ;
129+ signoff ?: boolean ;
130+ signCommit ?: boolean ;
131+ empty ?: boolean ;
132+ noVerify ?: boolean ;
133+ }
134+
135+ export interface BranchQuery {
136+ readonly remote ?: boolean ;
137+ readonly pattern ?: string ;
138+ readonly count ?: number ;
139+ readonly contains ?: string ;
116140}
117141
118142export interface Repository {
@@ -153,6 +177,7 @@ export interface Repository {
153177 createBranch ( name : string , checkout : boolean , ref ?: string ) : Promise < void > ;
154178 deleteBranch ( name : string , force ?: boolean ) : Promise < void > ;
155179 getBranch ( name : string ) : Promise < Branch > ;
180+ getBranches ( query : BranchQuery ) : Promise < Ref [ ] > ;
156181 setBranchUpstream ( name : string , upstream : string ) : Promise < void > ;
157182
158183 getMergeBase ( ref1 : string , ref2 : string ) : Promise < string > ;
@@ -162,13 +187,48 @@ export interface Repository {
162187
163188 addRemote ( name : string , url : string ) : Promise < void > ;
164189 removeRemote ( name : string ) : Promise < void > ;
190+ renameRemote ( name : string , newName : string ) : Promise < void > ;
165191
166192 fetch ( remote ?: string , ref ?: string , depth ?: number ) : Promise < void > ;
167193 pull ( unshallow ?: boolean ) : Promise < void > ;
168194 push ( remoteName ?: string , branchName ?: string , setUpstream ?: boolean ) : Promise < void > ;
169195
170196 blame ( path : string ) : Promise < string > ;
171197 log ( options ?: LogOptions ) : Promise < Commit [ ] > ;
198+
199+ commit ( message : string , opts ?: CommitOptions ) : Promise < void > ;
200+ }
201+
202+ export interface RemoteSource {
203+ readonly name : string ;
204+ readonly description ?: string ;
205+ readonly url : string | string [ ] ;
206+ }
207+
208+ export interface RemoteSourceProvider {
209+ readonly name : string ;
210+ readonly icon ?: string ; // codicon name
211+ readonly supportsQuery ?: boolean ;
212+ getRemoteSources ( query ?: string ) : ProviderResult < RemoteSource [ ] > ;
213+ publishRepository ?( repository : Repository ) : Promise < void > ;
214+ }
215+
216+ export interface Credentials {
217+ readonly username : string ;
218+ readonly password : string ;
219+ }
220+
221+ export interface CredentialsProvider {
222+ getCredentials ( host : Uri ) : ProviderResult < Credentials > ;
223+ }
224+
225+ export interface PushErrorHandler {
226+ handlePushError (
227+ repository : Repository ,
228+ remote : Remote ,
229+ refspec : string ,
230+ error : Error & { gitErrorCode : GitErrorCodes } ,
231+ ) : Promise < boolean > ;
172232}
173233
174234export type APIState = 'uninitialized' | 'initialized' ;
@@ -180,6 +240,14 @@ export interface API {
180240 readonly repositories : Repository [ ] ;
181241 readonly onDidOpenRepository : Event < Repository > ;
182242 readonly onDidCloseRepository : Event < Repository > ;
243+
244+ toGitUri ( uri : Uri , ref : string ) : Uri ;
245+ getRepository ( uri : Uri ) : Repository | null ;
246+ init ( root : Uri ) : Promise < Repository | null > ;
247+
248+ registerRemoteSourceProvider ( provider : RemoteSourceProvider ) : Disposable ;
249+ registerCredentialsProvider ( provider : CredentialsProvider ) : Disposable ;
250+ registerPushErrorHandler ( handler : PushErrorHandler ) : Disposable ;
183251}
184252
185253export interface GitExtension {
@@ -216,6 +284,7 @@ export const enum GitErrorCodes {
216284 CantOpenResource = 'CantOpenResource' ,
217285 GitNotFound = 'GitNotFound' ,
218286 CantCreatePipe = 'CantCreatePipe' ,
287+ PermissionDenied = 'PermissionDenied' ,
219288 CantAccessRemote = 'CantAccessRemote' ,
220289 RepositoryNotFound = 'RepositoryNotFound' ,
221290 RepositoryIsLocked = 'RepositoryIsLocked' ,
0 commit comments