Skip to content
This repository was archived by the owner on Jun 21, 2023. It is now read-only.

Use modern clone dialog when re-cloning a repository #2202

Merged
merged 4 commits into from
Jan 29, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 0 additions & 25 deletions src/GitHub.App/SampleData/RepositoryRecloneViewModelDesigner.cs

This file was deleted.

9 changes: 0 additions & 9 deletions src/GitHub.App/Services/DialogService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -69,15 +69,6 @@ public async Task<CloneDialogResult> ShowCloneDialog(IConnection connection, str
}
}

public async Task<string> ShowReCloneDialog(RepositoryModel repository)
{
Guard.ArgumentNotNull(repository, nameof(repository));

var viewModel = factory.CreateViewModel<IRepositoryRecloneViewModel>();
viewModel.SelectedRepository = repository;
return (string)await showDialog.ShowWithFirstConnection(viewModel);
}

public async Task ShowCreateGist(IConnection connection)
{
var viewModel = factory.CreateViewModel<IGistCreationViewModel>();
Expand Down
162 changes: 0 additions & 162 deletions src/GitHub.App/ViewModels/Dialog/RepositoryRecloneViewModel.cs

This file was deleted.

This file was deleted.

14 changes: 0 additions & 14 deletions src/GitHub.Exports/Services/IDialogService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,20 +25,6 @@ public interface IDialogService
/// </returns>
Task<CloneDialogResult> ShowCloneDialog(IConnection connection, string url = null);

/// <summary>
/// Shows the re-clone dialog.
/// </summary>
/// <param name="repository">The repository to clone.</param>
/// <returns>
/// A task that returns the base path for the clone on success, or null if the dialog was
/// cancelled.
/// </returns>
/// <remarks>
/// The re-clone dialog is shown from the VS2017+ start page when the user wants to check
/// out a repository that was previously checked out on another machine.
/// </remarks>
Task<string> ShowReCloneDialog(RepositoryModel repository);

/// <summary>
/// Shows the Create Gist dialog.
/// </summary>
Expand Down
24 changes: 4 additions & 20 deletions src/GitHub.StartPage/StartPagePackage.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using System;
using System.IO;
using System.Runtime.InteropServices;
using System.Threading;
using System.Threading.Tasks;
Expand Down Expand Up @@ -90,39 +89,24 @@ static async Task<CloneDialogResult> ShowCloneDialog(
var dialogService = gitHubServiceProvider.GetService<IDialogService>();
var cloneService = gitHubServiceProvider.GetService<IRepositoryCloneService>();
var usageTracker = gitHubServiceProvider.GetService<IUsageTracker>();
CloneDialogResult result = null;

if (repository == null)
{
result = await dialogService.ShowCloneDialog(null);
}
else
{
var basePath = await dialogService.ShowReCloneDialog(repository);

if (basePath != null)
{
var path = Path.Combine(basePath, repository.Name);
result = new CloneDialogResult(path, repository.CloneUrl);
}
}

if (result != null)
var cloneUrl = repository?.CloneUrl;
if (await dialogService.ShowCloneDialog(null, cloneUrl) is CloneDialogResult result)
{
try
{
await cloneService.CloneOrOpenRepository(result, progress, cancellationToken);
usageTracker.IncrementCounter(x => x.NumberOfStartPageClones).Forget();
return result;
}
catch
{
var teServices = gitHubServiceProvider.TryGetService<ITeamExplorerServices>();
teServices.ShowError($"Failed to clone the repository '{result.Url.RepositoryName}'");
result = null;
}
}

return result;
return null;
}
}
}
Loading