mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-14 01:25:37 -05:00
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:
@@ -5,8 +5,8 @@
|
||||
|
||||
import { Model } from '../model';
|
||||
import { Repository as BaseRepository, Resource } from '../repository';
|
||||
import { InputBox, Git, API, Repository, Remote, RepositoryState, Branch, ForcePushMode, Ref, Submodule, Commit, Change, RepositoryUIState, Status, LogOptions, APIState, CommitOptions, RefType, RemoteSourceProvider, CredentialsProvider, BranchQuery, PushErrorHandler, PublishEvent } from './git';
|
||||
import { Event, SourceControlInputBox, Uri, SourceControl, Disposable, commands } from 'vscode';
|
||||
import { InputBox, Git, API, Repository, Remote, RepositoryState, Branch, ForcePushMode, Ref, Submodule, Commit, Change, RepositoryUIState, Status, LogOptions, APIState, CommitOptions, RefType, RemoteSourceProvider, CredentialsProvider, BranchQuery, PushErrorHandler, PublishEvent, ICloneOptions } from './git'; // {{SQL CARBON EDIT}} add ICloneOptions
|
||||
import { Event, SourceControlInputBox, Uri, SourceControl, Disposable, commands, CancellationToken } from 'vscode'; // {{SQL CARBON EDIT}} add CancellationToken
|
||||
import { mapEvent } from '../util';
|
||||
import { toGitUri } from '../uri';
|
||||
import { pickRemoteSource, PickRemoteSourceOptions } from '../remoteSource';
|
||||
@@ -253,6 +253,11 @@ export class ApiImpl implements API {
|
||||
return this._model.repositories.map(r => new ApiRepository(r));
|
||||
}
|
||||
|
||||
// {{SQL CARBON EDIT}}
|
||||
async clone(url: string, options: ICloneOptions, cancellationToken?: CancellationToken): Promise<string> {
|
||||
return this._model.git.clone(url, options, cancellationToken);
|
||||
}
|
||||
|
||||
toGitUri(uri: Uri, ref: string): Uri {
|
||||
return toGitUri(uri, ref);
|
||||
}
|
||||
|
||||
17
extensions/git/src/api/git.d.ts
vendored
17
extensions/git/src/api/git.d.ts
vendored
@@ -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;
|
||||
}
|
||||
|
||||
@@ -12,9 +12,9 @@ import { EventEmitter } from 'events';
|
||||
import * as iconv from 'iconv-lite-umd';
|
||||
import * as filetype from 'file-type';
|
||||
import { assign, groupBy, IDisposable, toDisposable, dispose, mkdirp, readBytes, detectUnicodeEncoding, Encoding, onceEvent, splitInChunks, Limiter } from './util';
|
||||
import { CancellationToken, Progress, Uri } from 'vscode';
|
||||
import { CancellationToken, Uri } from 'vscode';
|
||||
import { detectEncoding } from './encoding';
|
||||
import { Ref, RefType, Branch, Remote, ForcePushMode, GitErrorCodes, LogOptions, Change, Status, CommitOptions, BranchQuery } from './api/git';
|
||||
import { Ref, RefType, Branch, Remote, ForcePushMode, GitErrorCodes, LogOptions, Change, Status, CommitOptions, BranchQuery, ICloneOptions } from './api/git'; // {{SQL CARBON EDIT}} add ICloneOptions
|
||||
import * as byline from 'byline';
|
||||
import { StringDecoder } from 'string_decoder';
|
||||
|
||||
@@ -354,11 +354,11 @@ function sanitizePath(path: string): string {
|
||||
|
||||
const COMMIT_FORMAT = '%H%n%aN%n%aE%n%at%n%ct%n%P%n%B';
|
||||
|
||||
export interface ICloneOptions {
|
||||
/*export interface ICloneOptions { {{SQL CARBON EDIT}} moved to git.d.ts
|
||||
readonly parentPath: string;
|
||||
readonly progress: Progress<{ increment: number }>;
|
||||
readonly recursive?: boolean;
|
||||
}
|
||||
}*/
|
||||
|
||||
export class Git {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user