mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 18:46:40 -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:
@@ -20,10 +20,12 @@ export const EnterWorkspaceConfirmation = localize('dataworkspace.enterWorkspace
|
|||||||
export const WorkspaceContainsNotAddedProjects = localize('dataworkspace.workspaceContainsNotAddedProjects', "The current workspace contains one or more projects that have not been added to the workspace. Use the 'Open existing' dialog to add projects to the projects pane.");
|
export const WorkspaceContainsNotAddedProjects = localize('dataworkspace.workspaceContainsNotAddedProjects', "The current workspace contains one or more projects that have not been added to the workspace. Use the 'Open existing' dialog to add projects to the projects pane.");
|
||||||
export const LaunchOpenExisitingDialog = localize('dataworkspace.launchOpenExistingDialog', "Launch Open existing dialog");
|
export const LaunchOpenExisitingDialog = localize('dataworkspace.launchOpenExistingDialog', "Launch Open existing dialog");
|
||||||
export const DoNotShowAgain = localize('dataworkspace.doNotShowAgain', "Do not show again");
|
export const DoNotShowAgain = localize('dataworkspace.doNotShowAgain', "Do not show again");
|
||||||
export const ProjectsFailedToLoad = localize('dataworkspace.projectsFailedToLoad', "Some projects failed to load. Please open console for more information");
|
export const ProjectsFailedToLoad = localize('dataworkspace.projectsFailedToLoad', "Some projects failed to load. To view more details, [open the developer console](command:workbench.action.toggleDevTools)");
|
||||||
export const fileDoesNotExist = (name: string): string => { return localize('fileDoesNotExist', "File '{0}' doesn't exist", name); };
|
export const fileDoesNotExist = (name: string): string => { return localize('fileDoesNotExist', "File '{0}' doesn't exist", name); };
|
||||||
export const projectNameNull = localize('projectNameNull', "Project name is null");
|
export const projectNameNull = localize('projectNameNull', "Project name is null");
|
||||||
export const noPreviousData = (tableName: string): string => { return localize('noPreviousData', "Prior {0} for the current project will appear here, please run to see the results.", tableName); };
|
export const noPreviousData = (tableName: string): string => { return localize('noPreviousData', "Prior {0} for the current project will appear here, please run to see the results.", tableName); };
|
||||||
|
export const gitCloneMessage = (url: string): string => { return localize('gitCloneMessage', "Cloning git repository '{0}'...", url); };
|
||||||
|
export const gitCloneError = localize('gitCloneError', "Error during git clone. View git output for more details");
|
||||||
|
|
||||||
// config settings
|
// config settings
|
||||||
export const projectsConfigurationKey = 'projects';
|
export const projectsConfigurationKey = 'projects';
|
||||||
|
|||||||
@@ -81,6 +81,14 @@ export interface IWorkspaceService {
|
|||||||
*/
|
*/
|
||||||
createProject(name: string, location: vscode.Uri, projectTypeId: string, workspaceFile?: vscode.Uri): Promise<vscode.Uri>;
|
createProject(name: string, location: vscode.Uri, projectTypeId: string, workspaceFile?: vscode.Uri): Promise<vscode.Uri>;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Clones git repository and adds projects to workspace
|
||||||
|
* @param url The url to clone from
|
||||||
|
* @param localClonePath local path to clone repository to
|
||||||
|
* @param workspaceFile workspace file to add the projects to
|
||||||
|
*/
|
||||||
|
gitCloneProject(url: string, localClonePath: string, workspaceFile: vscode.Uri): Promise<void>;
|
||||||
|
|
||||||
readonly isProjectProviderAvailable: boolean;
|
readonly isProjectProviderAvailable: boolean;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -49,7 +49,11 @@ export class OpenExistingDialog extends DialogBase {
|
|||||||
try {
|
try {
|
||||||
// the selected location should be an existing directory
|
// the selected location should be an existing directory
|
||||||
if (this.targetTypeRadioCardGroup?.selectedCardId === constants.Project) {
|
if (this.targetTypeRadioCardGroup?.selectedCardId === constants.Project) {
|
||||||
await this.validateFile(this.filePathTextBox!.value!, constants.Project.toLowerCase());
|
if (this.localRadioButton?.checked) {
|
||||||
|
await this.validateFile(this.filePathTextBox!.value!, constants.Project.toLowerCase());
|
||||||
|
} else {
|
||||||
|
await this.validateClonePath(<string>this.localClonePathTextBox!.value);
|
||||||
|
}
|
||||||
|
|
||||||
if (this.workspaceInputBox!.enabled) {
|
if (this.workspaceInputBox!.enabled) {
|
||||||
await this.validateNewWorkspace(false);
|
await this.validateNewWorkspace(false);
|
||||||
@@ -101,6 +105,8 @@ export class OpenExistingDialog extends DialogBase {
|
|||||||
.withAdditionalProperties({ selectedTarget: 'workspace' })
|
.withAdditionalProperties({ selectedTarget: 'workspace' })
|
||||||
.send();
|
.send();
|
||||||
|
|
||||||
|
// show git output channel
|
||||||
|
vscode.commands.executeCommand('git.showOutput');
|
||||||
// after this executes, the git extension will show a popup asking if you want to enter the workspace
|
// after this executes, the git extension will show a popup asking if you want to enter the workspace
|
||||||
await vscode.commands.executeCommand('git.clone', (<azdata.InputBoxComponent>this.gitRepoTextBoxComponent?.component).value, this.localClonePathTextBox!.value);
|
await vscode.commands.executeCommand('git.clone', (<azdata.InputBoxComponent>this.gitRepoTextBoxComponent?.component).value, this.localClonePathTextBox!.value);
|
||||||
} else {
|
} else {
|
||||||
@@ -113,14 +119,22 @@ export class OpenExistingDialog extends DialogBase {
|
|||||||
const validateWorkspace = await this.workspaceService.validateWorkspace();
|
const validateWorkspace = await this.workspaceService.validateWorkspace();
|
||||||
let addProjectsPromise: Promise<void>;
|
let addProjectsPromise: Promise<void>;
|
||||||
|
|
||||||
if (validateWorkspace) {
|
if (this.remoteGitRepoRadioButton!.checked) {
|
||||||
telemetryProps.workspaceProjectRelativity = calculateRelativity(this.filePathTextBox!.value!, this.workspaceInputBox!.value!);
|
TelemetryReporter.createActionEvent(TelemetryViews.OpenExistingDialog, TelemetryActions.GitClone)
|
||||||
telemetryProps.cancelled = 'false';
|
.withAdditionalProperties({ selectedTarget: 'project' })
|
||||||
addProjectsPromise = this.workspaceService.addProjectsToWorkspace([vscode.Uri.file(this.filePathTextBox!.value!)], vscode.Uri.file(this.workspaceInputBox!.value!));
|
.send();
|
||||||
|
|
||||||
|
addProjectsPromise = this.workspaceService.gitCloneProject((<azdata.InputBoxComponent>this.gitRepoTextBoxComponent?.component).value!, this.localClonePathTextBox!.value!, vscode.Uri.file(this.workspaceInputBox!.value!));
|
||||||
} else {
|
} else {
|
||||||
telemetryProps.workspaceProjectRelativity = 'none';
|
if (validateWorkspace) {
|
||||||
telemetryProps.cancelled = 'true';
|
telemetryProps.workspaceProjectRelativity = calculateRelativity(this.filePathTextBox!.value!, this.workspaceInputBox!.value!);
|
||||||
addProjectsPromise = this.workspaceService.addProjectsToWorkspace([vscode.Uri.file(this.filePathTextBox!.value!)], vscode.Uri.file(this.workspaceInputBox!.value!));
|
telemetryProps.cancelled = 'false';
|
||||||
|
addProjectsPromise = this.workspaceService.addProjectsToWorkspace([vscode.Uri.file(this.filePathTextBox!.value!)], vscode.Uri.file(this.workspaceInputBox!.value!));
|
||||||
|
} else {
|
||||||
|
telemetryProps.workspaceProjectRelativity = 'none';
|
||||||
|
telemetryProps.cancelled = 'true';
|
||||||
|
addProjectsPromise = this.workspaceService.addProjectsToWorkspace([vscode.Uri.file(this.filePathTextBox!.value!)], vscode.Uri.file(this.workspaceInputBox!.value!));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TelemetryReporter.createActionEvent(TelemetryViews.OpenExistingDialog, TelemetryActions.OpeningProject)
|
TelemetryReporter.createActionEvent(TelemetryViews.OpenExistingDialog, TelemetryActions.OpeningProject)
|
||||||
@@ -198,14 +212,21 @@ export class OpenExistingDialog extends DialogBase {
|
|||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
const gitRepoTextBox = view.modelBuilder.inputBox().withProperties<azdata.InputBoxProperties>({
|
||||||
|
ariaLabel: constants.GitRepoUrlTitle,
|
||||||
|
placeHolder: constants.GitRepoUrlPlaceholder,
|
||||||
|
required: true,
|
||||||
|
width: constants.DefaultInputWidth
|
||||||
|
}).component();
|
||||||
|
|
||||||
|
this.register(gitRepoTextBox.onTextChanged(() => {
|
||||||
|
gitRepoTextBox.updateProperty('title', this.localClonePathTextBox!.value!);
|
||||||
|
this.updateWorkspaceInputbox(this.localClonePathTextBox!.value!, path.basename(gitRepoTextBox!.value!, '.git'));
|
||||||
|
}));
|
||||||
|
|
||||||
this.gitRepoTextBoxComponent = {
|
this.gitRepoTextBoxComponent = {
|
||||||
title: constants.GitRepoUrlTitle,
|
title: constants.GitRepoUrlTitle,
|
||||||
component: view.modelBuilder.inputBox().withProperties<azdata.InputBoxProperties>({
|
component: gitRepoTextBox
|
||||||
ariaLabel: constants.GitRepoUrlTitle,
|
|
||||||
placeHolder: constants.GitRepoUrlPlaceholder,
|
|
||||||
required: true,
|
|
||||||
width: constants.DefaultInputWidth
|
|
||||||
}).component()
|
|
||||||
};
|
};
|
||||||
|
|
||||||
this.localClonePathTextBox = view.modelBuilder.inputBox().withProperties<azdata.InputBoxProperties>({
|
this.localClonePathTextBox = view.modelBuilder.inputBox().withProperties<azdata.InputBoxProperties>({
|
||||||
@@ -215,6 +236,11 @@ export class OpenExistingDialog extends DialogBase {
|
|||||||
width: constants.DefaultInputWidth
|
width: constants.DefaultInputWidth
|
||||||
}).component();
|
}).component();
|
||||||
|
|
||||||
|
this.register(this.localClonePathTextBox.onTextChanged(() => {
|
||||||
|
this.localClonePathTextBox!.updateProperty('title', this.localClonePathTextBox!.value!);
|
||||||
|
this.updateWorkspaceInputbox(this.localClonePathTextBox!.value!, path.basename(gitRepoTextBox!.value!, '.git'));
|
||||||
|
}));
|
||||||
|
|
||||||
const localClonePathBrowseFolderButton = view.modelBuilder.button().withProperties<azdata.ButtonProperties>({
|
const localClonePathBrowseFolderButton = view.modelBuilder.button().withProperties<azdata.ButtonProperties>({
|
||||||
ariaLabel: constants.BrowseButtonText,
|
ariaLabel: constants.BrowseButtonText,
|
||||||
iconPath: IconPathHelper.folder,
|
iconPath: IconPathHelper.folder,
|
||||||
@@ -235,6 +261,8 @@ export class OpenExistingDialog extends DialogBase {
|
|||||||
|
|
||||||
const selectedFolder = folderUris[0].fsPath;
|
const selectedFolder = folderUris[0].fsPath;
|
||||||
this.localClonePathTextBox!.value = selectedFolder;
|
this.localClonePathTextBox!.value = selectedFolder;
|
||||||
|
this.localClonePathTextBox!.updateProperty('title', this.localClonePathTextBox!.value);
|
||||||
|
this.updateWorkspaceInputbox(path.dirname(this.localClonePathTextBox!.value!), path.basename((<azdata.InputBoxComponent>this.gitRepoTextBoxComponent?.component)!.value!, '.git'));
|
||||||
}));
|
}));
|
||||||
|
|
||||||
this.localClonePathComponent = {
|
this.localClonePathComponent = {
|
||||||
@@ -278,19 +306,21 @@ export class OpenExistingDialog extends DialogBase {
|
|||||||
this.register(this.targetTypeRadioCardGroup.onSelectionChanged(({ cardId }) => {
|
this.register(this.targetTypeRadioCardGroup.onSelectionChanged(({ cardId }) => {
|
||||||
if (cardId === constants.Project) {
|
if (cardId === constants.Project) {
|
||||||
this.filePathTextBox!.placeHolder = constants.ProjectFilePlaceholder;
|
this.filePathTextBox!.placeHolder = constants.ProjectFilePlaceholder;
|
||||||
// hide these two radio buttons for now since git clone is just for workspaces
|
|
||||||
this.localRadioButton?.updateCssStyles({ 'display': 'none' });
|
|
||||||
this.remoteGitRepoRadioButton?.updateCssStyles({ 'display': 'none' });
|
|
||||||
this.formBuilder?.removeFormItem(<azdata.FormComponent>this.gitRepoTextBoxComponent);
|
|
||||||
this.formBuilder?.removeFormItem(<azdata.FormComponent>this.localClonePathComponent);
|
|
||||||
|
|
||||||
this.formBuilder?.addFormItem(this.filePathAndButtonComponent!);
|
if (this.remoteGitRepoRadioButton!.checked) {
|
||||||
|
this.formBuilder?.removeFormItem(<azdata.FormComponent>this.filePathAndButtonComponent);
|
||||||
|
this.formBuilder?.insertFormItem(<azdata.FormComponent>this.gitRepoTextBoxComponent, 2);
|
||||||
|
this.formBuilder?.insertFormItem(<azdata.FormComponent>this.localClonePathComponent, 3);
|
||||||
|
} else {
|
||||||
|
this.formBuilder?.removeFormItem(<azdata.FormComponent>this.gitRepoTextBoxComponent);
|
||||||
|
this.formBuilder?.removeFormItem(<azdata.FormComponent>this.localClonePathComponent);
|
||||||
|
this.formBuilder?.addFormItem(this.filePathAndButtonComponent!);
|
||||||
|
}
|
||||||
|
|
||||||
this.formBuilder?.addFormItem(this.workspaceDescriptionFormComponent!);
|
this.formBuilder?.addFormItem(this.workspaceDescriptionFormComponent!);
|
||||||
this.formBuilder?.addFormItem(this.workspaceInputFormComponent!);
|
this.formBuilder?.addFormItem(this.workspaceInputFormComponent!);
|
||||||
} else if (cardId === constants.Workspace) {
|
} else if (cardId === constants.Workspace) {
|
||||||
this.filePathTextBox!.placeHolder = constants.WorkspacePlaceholder;
|
this.filePathTextBox!.placeHolder = constants.WorkspacePlaceholder;
|
||||||
this.localRadioButton?.updateCssStyles({ 'display': 'block' });
|
|
||||||
this.remoteGitRepoRadioButton?.updateCssStyles({ 'display': 'block' });
|
|
||||||
|
|
||||||
this.formBuilder?.removeFormItem(this.workspaceDescriptionFormComponent!);
|
this.formBuilder?.removeFormItem(this.workspaceDescriptionFormComponent!);
|
||||||
this.formBuilder?.removeFormItem(this.workspaceInputFormComponent!);
|
this.formBuilder?.removeFormItem(this.workspaceInputFormComponent!);
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import * as azdata from 'azdata';
|
|||||||
import * as vscode from 'vscode';
|
import * as vscode from 'vscode';
|
||||||
import * as dataworkspace from 'dataworkspace';
|
import * as dataworkspace from 'dataworkspace';
|
||||||
import * as path from 'path';
|
import * as path from 'path';
|
||||||
|
import * as git from '../../../git/src/api/git';
|
||||||
import * as constants from '../common/constants';
|
import * as constants from '../common/constants';
|
||||||
import * as glob from 'fast-glob';
|
import * as glob from 'fast-glob';
|
||||||
import { IWorkspaceService } from '../common/interfaces';
|
import { IWorkspaceService } from '../common/interfaces';
|
||||||
@@ -193,7 +194,7 @@ export class WorkspaceService implements IWorkspaceService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (const folder of workspaceFolders) {
|
for (const folder of workspaceFolders) {
|
||||||
const results = await this.getAllProjectsInWorkspaceFolder(folder);
|
const results = await this.getAllProjectsInFolder(folder.uri);
|
||||||
|
|
||||||
let containsNotAddedProject = false;
|
let containsNotAddedProject = false;
|
||||||
for (const projFile of results) {
|
for (const projFile of results) {
|
||||||
@@ -218,12 +219,12 @@ export class WorkspaceService implements IWorkspaceService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async getAllProjectsInWorkspaceFolder(folder: vscode.WorkspaceFolder): Promise<string[]> {
|
async getAllProjectsInFolder(folder: vscode.Uri): Promise<string[]> {
|
||||||
// get the unique supported project extensions
|
// get the unique supported project extensions
|
||||||
const supportedProjectExtensions = [...new Set((await this.getAllProjectTypes()).map(p => { return p.projectFileExtension; }))];
|
const supportedProjectExtensions = [...new Set((await this.getAllProjectTypes()).map(p => { return p.projectFileExtension; }))];
|
||||||
|
|
||||||
// path needs to use forward slashes for glob to work
|
// path needs to use forward slashes for glob to work
|
||||||
const escapedPath = glob.escapePath(folder.uri.fsPath.replace(/\\/g, '/'));
|
const escapedPath = glob.escapePath(folder.fsPath.replace(/\\/g, '/'));
|
||||||
|
|
||||||
// can filter for multiple file extensions using folder/**/*.{sqlproj,csproj} format, but this notation doesn't work if there's only one extension
|
// can filter for multiple file extensions using folder/**/*.{sqlproj,csproj} format, but this notation doesn't work if there's only one extension
|
||||||
// so the filter needs to be in the format folder/**/*.sqlproj if there's only one supported projectextension
|
// so the filter needs to be in the format folder/**/*.sqlproj if there's only one supported projectextension
|
||||||
@@ -271,6 +272,31 @@ export class WorkspaceService implements IWorkspaceService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async gitCloneProject(url: string, localClonePath: string, workspaceFile: vscode.Uri): Promise<void> {
|
||||||
|
const gitApi: git.API = (<git.GitExtension>vscode.extensions.getExtension('vscode.git')!.exports).getAPI(1);
|
||||||
|
const opts = {
|
||||||
|
location: vscode.ProgressLocation.Notification,
|
||||||
|
title: constants.gitCloneMessage(url),
|
||||||
|
cancellable: true
|
||||||
|
};
|
||||||
|
|
||||||
|
try {
|
||||||
|
// show git output channel
|
||||||
|
vscode.commands.executeCommand('git.showOutput');
|
||||||
|
const repositoryPath = await vscode.window.withProgress(
|
||||||
|
opts,
|
||||||
|
(progress, token) => gitApi.clone(url!, { parentPath: localClonePath!, progress, recursive: true }, token)
|
||||||
|
);
|
||||||
|
|
||||||
|
// get all the project files in the cloned repo and add them to workspace
|
||||||
|
const repoProjects = (await this.getAllProjectsInFolder(vscode.Uri.file(repositoryPath))).map(p => { return vscode.Uri.file(p); });
|
||||||
|
this.addProjectsToWorkspace(repoProjects, workspaceFile);
|
||||||
|
} catch (e) {
|
||||||
|
vscode.window.showErrorMessage(constants.gitCloneError);
|
||||||
|
console.error(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Ensure the project provider extension for the specified project is loaded
|
* Ensure the project provider extension for the specified project is loaded
|
||||||
* @param projectType The file extension of the project, if not specified, all project provider extensions will be loaded.
|
* @param projectType The file extension of the project, if not specified, all project provider extensions will be loaded.
|
||||||
|
|||||||
@@ -428,7 +428,7 @@ suite('WorkspaceService Tests', function (): void {
|
|||||||
icon: ''
|
icon: ''
|
||||||
}]);
|
}]);
|
||||||
const infoMessageStub = sinon.stub(vscode.window, 'showInformationMessage').resolves(<any>constants.DoNotShowAgain);
|
const infoMessageStub = sinon.stub(vscode.window, 'showInformationMessage').resolves(<any>constants.DoNotShowAgain);
|
||||||
const getProjectsInwWorkspaceFolderStub = sinon.stub(service, 'getAllProjectsInWorkspaceFolder').resolves([vscode.Uri.file('abc.sqlproj').fsPath, vscode.Uri.file('folder1/abc1.sqlproj').fsPath]);
|
const getProjectsInwWorkspaceFolderStub = sinon.stub(service, 'getAllProjectsInFolder').resolves([vscode.Uri.file('abc.sqlproj').fsPath, vscode.Uri.file('folder1/abc1.sqlproj').fsPath]);
|
||||||
|
|
||||||
await service.checkForProjectsNotAddedToWorkspace();
|
await service.checkForProjectsNotAddedToWorkspace();
|
||||||
should(infoMessageStub.notCalled).be.true('Should not have found projects not added to workspace');
|
should(infoMessageStub.notCalled).be.true('Should not have found projects not added to workspace');
|
||||||
|
|||||||
@@ -5,8 +5,8 @@
|
|||||||
|
|
||||||
import { Model } from '../model';
|
import { Model } from '../model';
|
||||||
import { Repository as BaseRepository, Resource } from '../repository';
|
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 { 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 } from 'vscode';
|
import { Event, SourceControlInputBox, Uri, SourceControl, Disposable, commands, CancellationToken } from 'vscode'; // {{SQL CARBON EDIT}} add CancellationToken
|
||||||
import { mapEvent } from '../util';
|
import { mapEvent } from '../util';
|
||||||
import { toGitUri } from '../uri';
|
import { toGitUri } from '../uri';
|
||||||
import { pickRemoteSource, PickRemoteSourceOptions } from '../remoteSource';
|
import { pickRemoteSource, PickRemoteSourceOptions } from '../remoteSource';
|
||||||
@@ -253,6 +253,11 @@ export class ApiImpl implements API {
|
|||||||
return this._model.repositories.map(r => new ApiRepository(r));
|
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 {
|
toGitUri(uri: Uri, ref: string): Uri {
|
||||||
return toGitUri(uri, ref);
|
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.
|
* 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 { ProviderResult } from 'vscode';
|
||||||
|
|
||||||
export interface Git {
|
export interface Git {
|
||||||
@@ -251,6 +251,14 @@ export interface API {
|
|||||||
readonly onDidOpenRepository: Event<Repository>;
|
readonly onDidOpenRepository: Event<Repository>;
|
||||||
readonly onDidCloseRepository: 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;
|
toGitUri(uri: Uri, ref: string): Uri;
|
||||||
getRepository(uri: Uri): Repository | null;
|
getRepository(uri: Uri): Repository | null;
|
||||||
init(root: Uri): Promise<Repository | null>;
|
init(root: Uri): Promise<Repository | null>;
|
||||||
@@ -316,3 +324,10 @@ export const enum GitErrorCodes {
|
|||||||
NoPathFound = 'NoPathFound',
|
NoPathFound = 'NoPathFound',
|
||||||
UnknownPath = 'UnknownPath',
|
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 iconv from 'iconv-lite-umd';
|
||||||
import * as filetype from 'file-type';
|
import * as filetype from 'file-type';
|
||||||
import { assign, groupBy, IDisposable, toDisposable, dispose, mkdirp, readBytes, detectUnicodeEncoding, Encoding, onceEvent, splitInChunks, Limiter } from './util';
|
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 { 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 * as byline from 'byline';
|
||||||
import { StringDecoder } from 'string_decoder';
|
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';
|
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 parentPath: string;
|
||||||
readonly progress: Progress<{ increment: number }>;
|
readonly progress: Progress<{ increment: number }>;
|
||||||
readonly recursive?: boolean;
|
readonly recursive?: boolean;
|
||||||
}
|
}*/
|
||||||
|
|
||||||
export class Git {
|
export class Git {
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user