This repository was archived by the owner on Jun 21, 2023. It is now read-only.
Unified Clone / Open from GitHub UI#1919
Merged
Conversation
Use clone from URL as the UI for GitHub.OpenFromUrl.
Now we have a proper UI, re-enable the `File / Open / Open from GitHub...` button.
Add method for cloning or opening a repository.
Add method to open a repository and view it on Team Explorer Home.
Use VSServices.TryOpenRepository on Visual Studio 2015 where solution folders aren't available. This creates a temporary solution to make Team Explorer change its active repository.
When a directory already exists we can open the repository, so only show a path error when a file exists at the target path.
IVSServices is only used in Visual Studio 2015 so retrieve it on demand.
Be flexible about the type of Url that CloneDialogResult can return.
Convert ToRepositoryUrl inside this method.
This command is now only responsible for opening the clone and calling CloneOrOpenRepository.
Contributor
|
This LGTM @jcansdale ✨ |
This reverts commit b2f0679.
jcansdale
commented
Sep 24, 2018
| await CloneRepository(cloneUrl, repositoryPath, progress); | ||
| } | ||
|
|
||
| teamExplorerServices.OpenRepository(repositoryPath); |
Collaborator
Author
There was a problem hiding this comment.
We don't need to do this when cloning (it happens as part of the clone). But we should still switch to Team Explorer - Home.
It appears that CloneRepository is also called when a new repository is created. Only increment the new counters during CloneOrOpenRepository.
Increment new NumberOfGitHubClones and NumberOfEnterpriseClones counters in CloneOrOpenRepository but not CloneRepository.
Expect to fail on this commit.
Increment NumberOfGitHubOpens and NumberOfEnterpriseOpens counters when CloneOrOpenRepository is called.
jcansdale
commented
Sep 25, 2018
| { | ||
| await vsGitServices.Clone(cloneUrl, repositoryPath, true, progress); | ||
|
|
||
| await usageTracker.IncrementCounter(x => x.NumberOfClones); |
Collaborator
Author
There was a problem hiding this comment.
This method is being called by CreateRepository here:
Change to "A file exists at the destination path."
430fb34 to
9f8757a
Compare
Check the following conditions: - Local repository exists at path - Local repository has an 'origin' remote - Local repository's URL matches selected repository
There was an issue with PathError appearing at the top. When the error appeared, the repository list would move down causing a different repository to be selected. This would clause flickering between two repositories. This commit consolidates PathError into PathWarning (which appears above the path which is being validated). This avoids the flicker and puts the warning next to the text box which it applies to. The logic to block clone or open when there is a file in the way has been moved to the commands' `canExecute` observable.
Collaborator
Author
"You have already cloned to this location. Click 'Open' to open the local repository."
Collaborator
Author
Collaborator
Author
Add Open_Is_Enabled_When_Path_DirectoryExists test Fix/update some other tests
Contributor
StanleyGoldman
left a comment
There was a problem hiding this comment.
Should the user message here change?
| { | ||
| var teServices = ServiceProvider.TryGetService<ITeamExplorerServices>(); | ||
| teServices.ShowError(e.GetUserFriendlyErrorMessage(ErrorType.ClonedFailed, result.Repository.Name)); | ||
| teServices.ShowError(e.GetUserFriendlyErrorMessage(ErrorType.ClonedFailed, result.Url.RepositoryName)); |
Contributor
There was a problem hiding this comment.
Should the user message here change?
Collaborator
Author
There was a problem hiding this comment.
You're right. Commit incoming. 🚀
PathWarning_Is_Set_For_Existing_Clone_At_Destination PathWarning_Is_Set_For_Repository_With_No_Origin PathWarning_Is_Set_For_Directory_With_No_Repository PathWarning_Is_Set_For_Existing_Repository_At_Destination_With_Different_Remote
Changed ClonedFailed to CloneOrOpenFailed.
StanleyGoldman
approved these changes
Sep 27, 2018
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.









What this PR does
Add File / Open / Open from GitHub...buttonGitHub.OpenFromUrlcommandTODO
What this PR doesn't do
The
GitHub.OpenFromUrlcommand will no longer attempt to navigate the the file and line number from a target Url. This was done to trim the scope of this PR to simply cloning/opening a repository.The next step will be to incorporate functionality from the
Open from clipboardcommand. This will be more complex to test and will be done as a separate PR.At the moment these two commands can be combined manually:
Add File / Open / Open from GitHub...GitHub > Open from clipboardHow to test
Here is an example workflow
Copy a GitHub URL

Select

File > Open > Open from GitHub...URL is copied into username/repository field and path is populated with a default location

Click

Openif local repository already exists or update path andCloneto create a new repositoryRepository folder is loaded into

Solution ExplorerandTeam Explorer - HomeappearsSelect from list of solutions