Add git clone for project to Open Existing dialog (#15244)

* expose git clone api

* add git clone option for projects in open existing dialog

* add sql carbon edits

* cleanup and error handling

* fix telemetry property

* addressing comments

* add gitignore

* copy git.d.ts from git extension

* remove copy of git.d.ts from data-workspace extension

* use single quotes

* Remove git copy from git clone PR (#15286)

* Remove copy git typings

* Remove gitignore

* update error messages

* lowercase

Co-authored-by: Charles Gagnon <chgagnon@microsoft.com>
This commit is contained in:
Kim Santiago
2021-04-30 08:12:22 -10:00
committed by GitHub
parent f2ee8b11b4
commit 25681defd8
8 changed files with 120 additions and 34 deletions

View File

@@ -3,7 +3,7 @@
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { Uri, Event, Disposable, ProviderResult } from 'vscode';
import { Uri, Event, Disposable, ProviderResult, CancellationToken, Progress } from 'vscode'; // {{SQL CARBON EDIT}} add CancellationToken
export { ProviderResult } from 'vscode';
export interface Git {
@@ -251,6 +251,14 @@ export interface API {
readonly onDidOpenRepository: Event<Repository>;
readonly onDidCloseRepository: Event<Repository>;
/**
* clones the repository at the specified url locally
* @param url url of repository to clone
* @param options
* @param cancellationToken
* @returns a promise to the string location where the repository was cloned to
*/
clone(url: string, options: ICloneOptions, cancellationToken?: CancellationToken): Promise<string>; // {{SQL CARBON EDIT}}
toGitUri(uri: Uri, ref: string): Uri;
getRepository(uri: Uri): Repository | null;
init(root: Uri): Promise<Repository | null>;
@@ -316,3 +324,10 @@ export const enum GitErrorCodes {
NoPathFound = 'NoPathFound',
UnknownPath = 'UnknownPath',
}
// {{SQL CARBON EDIT}} move ICloneOptions from git.ts to here since it's used in clone()
export interface ICloneOptions {
readonly parentPath: string;
readonly progress: Progress<{ increment: number }>;
readonly recursive?: boolean;
}