Merge branch 'master' into build-cross-check

This commit is contained in:
Stanley Goldman 2018-10-02 12:54:02 -04:00
Родитель 0d8c7c78ac c6d7304db7
Коммит 1ddfe074fe
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 7728F3B9BD13C8C3
177 изменённых файлов: 766 добавлений и 612 удалений

Просмотреть файл

@ -1,8 +1,8 @@
<Project>
<PropertyGroup>
<Product>GitHub Extension for Visual Studio</Product>
<Version>2.5.6.0</Version>
<Version>2.5.7.0</Version>
<Copyright>Copyright © GitHub, Inc. 2014-2018</Copyright>
<LangVersion>7.3</LangVersion>
<LangVersion>7.3</LangVersion>
</PropertyGroup>
</Project>

Просмотреть файл

@ -1,5 +1,5 @@
os: Visual Studio 2017
version: '2.5.6.{build}'
version: '2.5.7.{build}'
skip_tags: true
install:
- ps: |

Просмотреть файл

@ -1,19 +0,0 @@
# Cloning a repository to Visual Studio
After you provide your GitHub or GitHub Enterprise credentials to GitHub for Visual Studio, the extension automatically detects the personal and organization repositories you have access to on your account.
1. Open **Team Explorer** by clicking on its tab next to *Solution Explorer*, or via the *View* menu.
2. Click the **Manage Connections** toolbar button.
![Location of the manage connections toolbar button in Team Explorer](images/manage-connections.png)
3. Next to the account you want to clone from, click **Clone**.
![Clone button in the GitHub section of Team Explorer](images/clone-link.png)
4. In the list of repositories, click the repository you'd like to clone.
![List of GitHub repositories that can be cloned inside a dialog](images/clone-dialog.png)
5. If desired, change the local path where the repository will be cloned into, or leave the default as-is. Click **Clone**.
6. In Team Explorer, under the list of repositories, locate the repository and double-click to open the project in Visual Studio.

Просмотреть файл

@ -1,23 +0,0 @@
# Creating gists
GitHub for Visual Studio enables easy creation of gists directly from the Visual Studio Editor.
1. [Sign in](../getting-started/authenticating-to-github.md) to GitHub.
2. Open a file in the Visual Studio text editor.
3. Select the section of text that you want to create a gist from.
4. Right click and select **Create a GitHub Gist** from the **GitHub** submenu.
![Location of Create A GitHub Gist in the GitHub submenu](images/create-gist-menu.png)
5. In the **Create a GitHub Gist** dialog, check that the filename is correct and optionally add a description.
![GitHub Gist creation dialog window](images/create-gist-dialog.png)
6. If you want the gist to be private, check the **Private Gist** checkbox.
7. Click **Create**.
8. Once the gist is created it will be opened in your browser.

Двоичные данные
docs/contributing/images/add-comment.png

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 35 KiB

Двоичные данные
docs/contributing/images/clone-dialog.png

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 26 KiB

Двоичные данные
docs/contributing/images/github-pane-toolbar.png

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 4.1 KiB

Двоичные данные
docs/contributing/images/pull-request-list.png

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 29 KiB

Просмотреть файл

@ -1,15 +0,0 @@
# Viewing the pull requests for a repository
GitHub for Visual Studio exposes the pull requests for the current repository and lets you create new pull requests and review pull requests from other contributors.
1. [Sign in](../getting-started/authenticating-to-github.md) to GitHub.
2. Open a solution in a GitHub repository.
3. Open **Team Explorer** and click the **Pull Requests** button to open the **GitHub** pane.
![Pull Requests button in the Team Explorer pane](images/pull-requests-button2.png)
4. The open pull requests will be displayed.
![Pull requests in the GitHub pane](images/pull-request-list.png)
5. Change the Open/Closed filter by clicking the **Open** link and selecting the filter you want to use from the dropdown.
6. Filter pull requests by Assignee by clicking the **Assignee** link and selecting the assignee you want to view from the dropdown.
7. Filter pull requests by Author by clicking the **Author** link and selecting the author you want to view from the dropdown.
8. Click on a pull request title to [view the pull request details and review the pull request](review-a-pull-request-in-visual-studio.md)
9. Click on the **Create New** link to [create a pull request from the current branch](sending-a-pull-request.md)

Просмотреть файл

@ -0,0 +1,39 @@
# Cloning a repository to Visual Studio
After you provide your GitHub or GitHub Enterprise credentials to GitHub for Visual Studio, the extension automatically detects the personal, collaborator and organization repositories you have access to on your account.
## Opening the clone dialog
### From **Team Explorer**
Open **Team Explorer** by clicking on its tab next to *Solution Explorer*, or via the *View* menu.
Click the **Manage Connections** toolbar button.
![Location of the manage connections toolbar button in Team Explorer](images/manage-connections.png)
Next to the account you want to clone from, click **Clone**.
![Clone button in the GitHub section of Team Explorer](images/clone-link.png)
### From the **Start Page**
Using Visual Studio 2017, click the `GitHub` button on the `Start Page` to open the clone dialog.
### From the **File** menu
Go to `File > Open > Open From GitHub...`
## Clone repositories
1. In the list of repositories, scroll until you find the repository you'd like to clone. You can also filter the repository results by using the *Filter* text box.
![List of GitHub repositories that can be cloned inside a dialog](images/clone-dialog.png)
In addition to using the list of personal, collaborator and organization repositories, you can use the URL tab to clone a public repository by its URL or using the repository owner and name.
![List of GitHub repositories that can be cloned inside a dialog](images/clone-url-dialog.png)
2. If desired, change the local path that the repository will be cloned into, or leave the default as-is.
3. Once a repository is selected and the path is set, Click **Clone**.
4. In Team Explorer, under the list of solutions, double-click on a solution to open it in Visual Studio.

Просмотреть файл

@ -0,0 +1,26 @@
# Creating gists
With GitHub for Visual Studio, you can easily create gists directly from the editor.
1. [Sign in](../getting-started/authenticating-to-github.md) to GitHub.
2. Open a file in the Visual Studio text editor.
3. Select the section of text that you want to create a gist from.
4. Right click and select **Create a GitHub Gist** from the **GitHub** submenu to create the gist on GitHub.
![Location of Create a GitHub Gist in the GitHub submenu](images/create-github-gist-menu.png)
5. To create the gist on GitHub Enterprise select **Create an Enterprise Gist** option from the submenu.
![Location of Create a Enterprise Gist in the GitHub submenu](images/create-enterprise-gist-menu.png)
6. In the **Create a GitHub Gist** dialog, check that the filename is correct and optionally add a description.
![GitHub Gist creation dialog window](images/create-gist-dialog.png)
7. If you want the gist to be private, check the **Private Gist** checkbox.
8. Click **Create**.
9. Once the gist is created it will be opened in your browser.

Двоичные данные
docs/using/images/add-review-comment.png Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 306 KiB

Двоичные данные
docs/using/images/add-review.png Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 7.8 KiB

Просмотреть файл

До

Ширина:  |  Высота:  |  Размер: 14 KiB

После

Ширина:  |  Высота:  |  Размер: 14 KiB

Двоичные данные
docs/using/images/clone-dialog.png Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 210 KiB

Просмотреть файл

До

Ширина:  |  Высота:  |  Размер: 14 KiB

После

Ширина:  |  Высота:  |  Размер: 14 KiB

Двоичные данные
docs/using/images/clone-url-dialog.png Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 125 KiB

Двоичные данные
docs/using/images/continue-your-review.png Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 22 KiB

Просмотреть файл

До

Ширина:  |  Высота:  |  Размер: 28 KiB

После

Ширина:  |  Высота:  |  Размер: 28 KiB

Двоичные данные
docs/using/images/create-enterprise-gist-menu.png Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 357 KiB

Просмотреть файл

До

Ширина:  |  Высота:  |  Размер: 20 KiB

После

Ширина:  |  Высота:  |  Размер: 20 KiB

Просмотреть файл

До

Ширина:  |  Высота:  |  Размер: 45 KiB

После

Ширина:  |  Высота:  |  Размер: 45 KiB

Двоичные данные
docs/using/images/create-github-gist-menu.png Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 352 KiB

Просмотреть файл

До

Ширина:  |  Высота:  |  Размер: 14 KiB

После

Ширина:  |  Высота:  |  Размер: 14 KiB

Двоичные данные
docs/using/images/delete-comment.png Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 57 KiB

Двоичные данные
docs/using/images/edit-comment.png Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 30 KiB

Двоичные данные
docs/using/images/github-pane-toolbar.png Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 45 KiB

Просмотреть файл

До

Ширина:  |  Высота:  |  Размер: 124 KiB

После

Ширина:  |  Высота:  |  Размер: 124 KiB

Просмотреть файл

До

Ширина:  |  Высота:  |  Размер: 16 KiB

После

Ширина:  |  Высота:  |  Размер: 16 KiB

Просмотреть файл

До

Ширина:  |  Высота:  |  Размер: 12 KiB

После

Ширина:  |  Высота:  |  Размер: 12 KiB

Просмотреть файл

До

Ширина:  |  Высота:  |  Размер: 20 KiB

После

Ширина:  |  Высота:  |  Размер: 20 KiB

Двоичные данные
docs/using/images/pending-review-comment.png Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 37 KiB

Просмотреть файл

До

Ширина:  |  Высота:  |  Размер: 14 KiB

После

Ширина:  |  Высота:  |  Размер: 14 KiB

Двоичные данные
docs/using/images/pr-detail-view-checkout-branch.png Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 104 KiB

Двоичные данные
docs/using/images/pr-detail-view.png Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 227 KiB

Просмотреть файл

До

Ширина:  |  Высота:  |  Размер: 20 KiB

После

Ширина:  |  Высота:  |  Размер: 20 KiB

Просмотреть файл

До

Ширина:  |  Высота:  |  Размер: 57 KiB

После

Ширина:  |  Высота:  |  Размер: 57 KiB

Просмотреть файл

До

Ширина:  |  Высота:  |  Размер: 188 KiB

После

Ширина:  |  Высота:  |  Размер: 188 KiB

Просмотреть файл

До

Ширина:  |  Высота:  |  Размер: 14 KiB

После

Ширина:  |  Высота:  |  Размер: 14 KiB

Просмотреть файл

До

Ширина:  |  Высота:  |  Размер: 9.2 KiB

После

Ширина:  |  Высота:  |  Размер: 9.2 KiB

Двоичные данные
docs/using/images/pull-request-assignable-user.png Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 141 KiB

Двоичные данные
docs/using/images/pull-request-list-filter.png Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 99 KiB

Двоичные данные
docs/using/images/pull-request-list-view.png Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 124 KiB

Просмотреть файл

До

Ширина:  |  Высота:  |  Размер: 40 KiB

После

Ширина:  |  Высота:  |  Размер: 40 KiB

Просмотреть файл

До

Ширина:  |  Высота:  |  Размер: 16 KiB

После

Ширина:  |  Высота:  |  Размер: 16 KiB

Двоичные данные
docs/using/images/single-comment.png Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 34 KiB

Двоичные данные
docs/using/images/submit-review-options.png Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 14 KiB

Двоичные данные
docs/using/images/submit-review.png Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 37 KiB

Просмотреть файл

До

Ширина:  |  Высота:  |  Размер: 15 KiB

После

Ширина:  |  Высота:  |  Размер: 15 KiB

Просмотреть файл

До

Ширина:  |  Высота:  |  Размер: 17 KiB

После

Ширина:  |  Высота:  |  Размер: 17 KiB

Просмотреть файл

Просмотреть файл

@ -12,15 +12,21 @@ GitHub for Visual Studio provides facilities for reviewing a pull request direct
## Viewing a pull request
The Pull Request Details view shows the current state of the pull request, including information about who created the pull request, the source and target branch, and the files changed.
The Pull Request Details view shows the current state of the pull request, including:
- information about who created the pull request
- the source and target branch
- a description of the pull request
- reviewers and the status of their review
- checks (if checks have been enabled for the repository)
- the files changed
![The details of a single pull request in the GitHub pane](images/pr-details.png)
![The details of a single pull request in the GitHub pane](images/pr-detail-view.png)
## Checking out a pull request
To check out the pull request branch, click the **Checkout [branch]** link where [branch] is the name of the branch that will be checked out.
![Location of the checkout link in the GitHub pull request details page](images/pr-details-checkout-link.png)
![Location of the checkout link in the GitHub pull request details page](images/pr-detail-view-checkout-branch.png)
If the pull request is from a fork then a remote will be added to the forked repository and the branch checked out locally. This remote will automatically be cleaned up when the local branch is deleted.
@ -46,6 +52,45 @@ You can add comments to a pull request directly from Visual Studio. When a file
![Hover over margin to see add comment icon](images/hover-to-add-comment.png)
Then click the icon on the desired line and leave a comment.
![Add a comment](images/add-comment.png)
![Add a comment](images/add-review-comment.png)
Existing comments left by you or other reviewers will also show up in this margin. Click the icon to open an inline conversation view from which you can review and reply to comments:
To just comment on this one line, select **Add a single comment**. This will add the comment immediately.
To start a review of the Pull Request and all its changes, select **Start a review**. This will add this comment as pending, and the comment will be submitted once the review is complete.
#### Viewing comments
Existing comments left by you or other reviewers will also show up in this margin. Click the icon to open an inline conversation view from which you can review and reply to comments.
Single comments appear like this when viewed inline.
![Single comment](images/single-comment.png)
Review comments appear the same as single comments except for a Pending badge is added to the comment.
![Single comment](images/pending-review-comment.png)
#### Modifying Comments
Single and review comments can either be edited or deleted.
To edit a comment, press the pencil symbol to edit the comment and then select **Update comment** once finished.
![Edit comment](images/edit-comment.png)
To delete a comment, press the x symbol. A confirmation box to delete the comment will appear.
![Delete comment](images/delete-comment.png)
#### Submitting a review
From the pull request details view you can go to the review summary and submit a review.
If you have pending review comments you'll see the option **Continue your review**:
![Continue review](images/continue-your-review.png)
Otherwise you'll see an option to **Add your review**:
![Add review](images/add-review.png)
When you are redirected to the review summary view, leave a review summary and select **Submit review**.
![Submit review](images/submit-review.png)
The options available are to **Approve**, **Comment only** or **Request changes**.
![Submit review options](images/submit-review-options.png)

Просмотреть файл

@ -0,0 +1,16 @@
# Viewing the pull requests for a repository
GitHub for Visual Studio exposes the pull requests for the current repository and lets you create new pull requests and review pull requests from other contributors.
1. [Sign in](../getting-started/authenticating-to-github.md) to GitHub.
2. Open a solution in a GitHub repository.
3. Open **Team Explorer** and click the **Pull Requests** button to open the **GitHub** pane.
![Pull Requests button in the Team Explorer pane](images/pull-requests-button2.png)
4. The open pull requests will be displayed.
![Pull requests in the GitHub pane](images/pull-request-list-view.png)
5. Change the pull requests listed by clicking the **Open** link and selecting the filter you want to use from the dropdown with the options *Open/Closed/All*.
![Pull requests status dropdown filter](images/pull-request-list-filter.png)
6. Filter pull requests by author by clicking the person icon and selecting the user you want to view from the dropdown. You can also search for users from the dropdown.
![Pull requests assignable user dropdown filter](images/pull-request-assignable-user.png)
7. Double-click anywhere in the pull request item to [view the pull request details and review the pull request](reviewing-a-pull-request-in-visual-studio.md)
8. Click on the **Create New** link to [create a pull request from the current branch](creating-a-pull-request.md)

Просмотреть файл

@ -1,16 +1,13 @@
using System;
using System.Collections.ObjectModel;
using System.Collections.ObjectModel;
using System.Diagnostics.CodeAnalysis;
using System.Reactive;
using GitHub.InlineReviews.ViewModels;
using GitHub.Models;
using GitHub.ViewModels;
using ReactiveUI;
namespace GitHub.InlineReviews.SampleData
namespace GitHub.SampleData
{
[SuppressMessage("Microsoft.Performance", "CA1812:AvoidUninstantiatedInternalClasses")]
class CommentThreadViewModelDesigner : ICommentThreadViewModel
public class CommentThreadViewModelDesigner : ICommentThreadViewModel
{
public ObservableCollection<ICommentViewModel> Comments { get; }
= new ObservableCollection<ICommentViewModel>();

Просмотреть файл

@ -1,14 +1,13 @@
using System;
using System.Reactive;
using System.Diagnostics.CodeAnalysis;
using GitHub.InlineReviews.ViewModels;
using ReactiveUI;
using System.Reactive;
using GitHub.ViewModels;
using ReactiveUI;
namespace GitHub.InlineReviews.SampleData
namespace GitHub.SampleData
{
[SuppressMessage("Microsoft.Performance", "CA1812:AvoidUninstantiatedInternalClasses")]
class CommentViewModelDesigner : ReactiveObject, ICommentViewModel
public class CommentViewModelDesigner : ReactiveObject, ICommentViewModel
{
public CommentViewModelDesigner()
{

Просмотреть файл

@ -16,7 +16,7 @@ namespace GitHub.SampleData.Dialog.Clone
}
public string Path { get; set; }
public string PathError { get; set; }
public string PathWarning { get; set; }
public int SelectedTabIndex { get; set; }
public string Title => null;
public IObservable<object> Done => null;

Просмотреть файл

@ -2,7 +2,7 @@
using System.Globalization;
using System.Windows.Forms;
namespace GitHub.InlineReviews.Services
namespace GitHub.Services
{
[Export(typeof(ICommentService))]
[PartCreationPolicy(CreationPolicy.NonShared)]

Просмотреть файл

@ -29,9 +29,13 @@ namespace GitHub.Services
this.showDialog = showDialog;
}
public async Task<CloneDialogResult> ShowCloneDialog(IConnection connection)
public async Task<CloneDialogResult> ShowCloneDialog(IConnection connection, string url = null)
{
var viewModel = factory.CreateViewModel<IRepositoryCloneViewModel>();
if (url != null)
{
viewModel.UrlTab.Url = url;
}
if (connection != null)
{

Просмотреть файл

@ -34,6 +34,7 @@ namespace GitHub.Services
readonly IOperatingSystem operatingSystem;
readonly string defaultClonePath;
readonly IVSGitServices vsGitServices;
readonly ITeamExplorerServices teamExplorerServices;
readonly IGraphQLClientFactory graphqlFactory;
readonly IUsageTracker usageTracker;
ICompiledQuery<ViewerRepositoriesModel> readViewerRepositories;
@ -42,11 +43,13 @@ namespace GitHub.Services
public RepositoryCloneService(
IOperatingSystem operatingSystem,
IVSGitServices vsGitServices,
ITeamExplorerServices teamExplorerServices,
IGraphQLClientFactory graphqlFactory,
IUsageTracker usageTracker)
{
this.operatingSystem = operatingSystem;
this.vsGitServices = vsGitServices;
this.teamExplorerServices = teamExplorerServices;
this.graphqlFactory = graphqlFactory;
this.usageTracker = usageTracker;
@ -103,6 +106,54 @@ namespace GitHub.Services
return result;
}
/// <inheritdoc/>
public async Task CloneOrOpenRepository(
CloneDialogResult cloneDialogResult,
object progress = null)
{
Guard.ArgumentNotNull(cloneDialogResult, nameof(cloneDialogResult));
var repositoryPath = cloneDialogResult.Path;
var url = cloneDialogResult.Url;
if (DestinationFileExists(repositoryPath))
{
throw new InvalidOperationException("Can't clone or open a repository because a file exists at: " + repositoryPath);
}
var repositoryUrl = url.ToRepositoryUrl();
var isDotCom = HostAddress.IsGitHubDotComUri(repositoryUrl);
if (DestinationDirectoryExists(repositoryPath))
{
teamExplorerServices.OpenRepository(repositoryPath);
if (isDotCom)
{
await usageTracker.IncrementCounter(x => x.NumberOfGitHubOpens);
}
else
{
await usageTracker.IncrementCounter(x => x.NumberOfEnterpriseOpens);
}
}
else
{
var cloneUrl = repositoryUrl.ToString();
await CloneRepository(cloneUrl, repositoryPath, progress).ConfigureAwait(true);
if (isDotCom)
{
await usageTracker.IncrementCounter(x => x.NumberOfGitHubClones);
}
else
{
await usageTracker.IncrementCounter(x => x.NumberOfEnterpriseClones);
}
}
teamExplorerServices.ShowHomePage();
}
/// <inheritdoc/>
public async Task CloneRepository(
string cloneUrl,
@ -121,19 +172,12 @@ namespace GitHub.Services
try
{
await vsGitServices.Clone(cloneUrl, repositoryPath, true, progress);
await usageTracker.IncrementCounter(x => x.NumberOfClones);
var repositoryUrl = new UriString(cloneUrl).ToRepositoryUrl();
var isDotCom = HostAddress.IsGitHubDotComUri(repositoryUrl);
if (isDotCom)
if (repositoryPath.StartsWith(DefaultClonePath, StringComparison.OrdinalIgnoreCase))
{
await usageTracker.IncrementCounter(x => x.NumberOfGitHubClones);
}
else
{
// If it isn't a GitHub URL, assume it's an Enterprise URL
await usageTracker.IncrementCounter(x => x.NumberOfEnterpriseClones);
// Count the number of times users clone into the Default Repository Location
await usageTracker.IncrementCounter(x => x.NumberOfClonesToDefaultClonePath);
}
}
catch (Exception ex)
@ -144,7 +188,10 @@ namespace GitHub.Services
}
/// <inheritdoc/>
public bool DestinationExists(string path) => Directory.Exists(path) || File.Exists(path);
public bool DestinationDirectoryExists(string path) => operatingSystem.Directory.DirectoryExists(path);
/// <inheritdoc/>
public bool DestinationFileExists(string path) => operatingSystem.File.Exists(path);
string GetLocalClonePathFromGitProvider(string fallbackPath)
{

Просмотреть файл

@ -25,7 +25,7 @@ namespace GitHub.Services
CannotDropFolder,
CannotDropFolderUnauthorizedAccess,
ClipboardFailed,
ClonedFailed,
CloneOrOpenFailed,
CloneFailedNotLoggedIn,
CommitCreateFailed,
CommitRevertFailed,
@ -123,7 +123,7 @@ namespace GitHub.Services
},
{ ErrorType.ClipboardFailed, Map(Defaults("Failed to copy text to the clipboard.")) },
{
ErrorType.ClonedFailed, Map(Defaults("Failed to clone the repository '{0}'", "Email support@github.com if you continue to have problems."),
ErrorType.CloneOrOpenFailed, Map(Defaults("Failed to clone or open the repository '{0}'", "Email support@github.com if you continue to have problems."),
new[]
{
new Translation(@"fatal: bad config file line (\d+) in (.+)", "Failed to clone the repository '{0}'", @"The config file '$2' is corrupted at line $1. You may need to open the file and try to fix any errors."),

Просмотреть файл

@ -3,11 +3,10 @@ using System.Linq;
using System.Reactive;
using System.Reactive.Linq;
using System.Threading.Tasks;
using System.Windows;
using GitHub.Extensions;
using GitHub.InlineReviews.Services;
using GitHub.Logging;
using GitHub.Models;
using GitHub.Services;
using GitHub.ViewModels;
using ReactiveUI;
using Serilog;

Просмотреть файл

@ -1,10 +1,10 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.Composition;
using System.Globalization;
using System.Linq;
using System.Reactive.Linq;
using System.Threading.Tasks;
using GitHub.App;
using GitHub.Extensions;
using GitHub.Logging;
using GitHub.Models;
@ -23,12 +23,13 @@ namespace GitHub.ViewModels.Dialog.Clone
readonly IOperatingSystem os;
readonly IConnectionManager connectionManager;
readonly IRepositoryCloneService service;
readonly IGitService gitService;
readonly IUsageService usageService;
readonly IUsageTracker usageTracker;
readonly IReadOnlyList<IRepositoryCloneTabViewModel> tabs;
string path;
IRepositoryModel previousRepository;
ObservableAsPropertyHelper<string> pathError;
ObservableAsPropertyHelper<string> pathWarning;
int selectedTabIndex;
[ImportingConstructor]
@ -36,6 +37,7 @@ namespace GitHub.ViewModels.Dialog.Clone
IOperatingSystem os,
IConnectionManager connectionManager,
IRepositoryCloneService service,
IGitService gitService,
IUsageService usageService,
IUsageTracker usageTracker,
IRepositorySelectViewModel gitHubTab,
@ -45,6 +47,7 @@ namespace GitHub.ViewModels.Dialog.Clone
this.os = os;
this.connectionManager = connectionManager;
this.service = service;
this.gitService = gitService;
this.usageService = usageService;
this.usageTracker = usageTracker;
@ -59,22 +62,27 @@ namespace GitHub.ViewModels.Dialog.Clone
Path = service.DefaultClonePath;
repository.Subscribe(x => UpdatePath(x));
pathError = Observable.CombineLatest(
pathWarning = Observable.CombineLatest(
repository,
this.WhenAnyValue(x => x.Path),
ValidatePath)
.ToProperty(this, x => x.PathError);
ValidatePathWarning)
.ToProperty(this, x => x.PathWarning);
var canClone = Observable.CombineLatest(
repository,
this.WhenAnyValue(x => x.PathError),
(repo, error) => (repo, error))
.Select(x => x.repo != null && x.error == null);
repository, this.WhenAnyValue(x => x.Path),
(repo, path) => repo != null && !service.DestinationFileExists(path) && !service.DestinationDirectoryExists(path));
var canOpen = Observable.CombineLatest(
repository, this.WhenAnyValue(x => x.Path),
(repo, path) => repo != null && !service.DestinationFileExists(path) && service.DestinationDirectoryExists(path));
Browse = ReactiveCommand.Create().OnExecuteCompleted(_ => BrowseForDirectory());
Clone = ReactiveCommand.CreateAsyncObservable(
canClone,
_ => repository.Select(x => new CloneDialogResult(Path, x)));
_ => repository.Select(x => new CloneDialogResult(Path, x?.CloneUrl)));
Open = ReactiveCommand.CreateAsyncObservable(
canOpen,
_ => repository.Select(x => new CloneDialogResult(Path, x?.CloneUrl)));
}
public IRepositorySelectViewModel GitHubTab { get; }
@ -87,7 +95,7 @@ namespace GitHub.ViewModels.Dialog.Clone
set => this.RaiseAndSetIfChanged(ref path, value);
}
public string PathError => pathError.Value;
public string PathWarning => pathWarning.Value;
public int SelectedTabIndex
{
@ -95,14 +103,16 @@ namespace GitHub.ViewModels.Dialog.Clone
set => this.RaiseAndSetIfChanged(ref selectedTabIndex, value);
}
public string Title => Resources.CloneTitle;
public string Title => Resources.OpenFromGitHubTitle;
public IObservable<object> Done => Clone;
public IObservable<object> Done => Observable.Merge(Clone, Open);
public ReactiveCommand<object> Browse { get; }
public ReactiveCommand<CloneDialogResult> Clone { get; }
public ReactiveCommand<CloneDialogResult> Open { get; }
public async Task InitializeAsync(IConnection connection)
{
var connections = await connectionManager.GetLoadedConnections().ConfigureAwait(false);
@ -228,13 +238,39 @@ namespace GitHub.ViewModels.Dialog.Clone
}
}
string ValidatePath(IRepositoryModel repository, string path)
string ValidatePathWarning(IRepositoryModel repositoryModel, string path)
{
if (repository != null)
if (repositoryModel != null)
{
return service.DestinationExists(path) ?
Resources.DestinationAlreadyExists :
null;
if (service.DestinationFileExists(path))
{
return Resources.DestinationAlreadyExists;
}
if (service.DestinationDirectoryExists(path))
{
using (var repository = gitService.GetRepository(path))
{
if (repository == null)
{
return Resources.CantFindARepositoryAtLocalPath;
}
var localUrl = gitService.GetRemoteUri(repository)?.ToRepositoryUrl();
if (localUrl == null)
{
return Resources.LocalRepositoryDoesntHaveARemoteOrigin;
}
var targetUrl = repositoryModel.CloneUrl?.ToRepositoryUrl();
if (localUrl != targetUrl)
{
return string.Format(CultureInfo.CurrentCulture, Resources.LocalRepositoryHasARemoteOf, localUrl);
}
return Resources.YouHaveAlreadyClonedToThisLocation;
}
}
}
return null;

Просмотреть файл

@ -1,4 +1,4 @@
namespace GitHub.InlineReviews.Services
namespace GitHub.Services
{
/// <summary>
/// This service allows for functionality to be injected into the chain of different peek Comment ViewModel types.

Просмотреть файл

@ -34,13 +34,36 @@ namespace GitHub.Services
object progress = null);
/// <summary>
/// Checks whether the specified destination path already exists.
/// Clones the specified repository into the specified directory or opens it if the directory already exists.
/// </summary>
/// <param name="cloneDialogResult">The URL and path of the repository to clone or open.</param>
/// <param name="progress">
/// An object through which to report progress. This must be of type
/// System.IProgress&lt;Microsoft.VisualStudio.Shell.ServiceProgressData&gt;, but
/// as that type is only available in VS2017+ it is typed as <see cref="object"/> here.
/// </param>
/// <returns></returns>
Task CloneOrOpenRepository(
CloneDialogResult cloneDialogResult,
object progress = null);
/// <summary>
/// Checks whether the specified destination directory already exists.
/// </summary>
/// <param name="path">The destination path.</param>
/// <returns>
/// true if a file or directory is already present at <paramref name="path"/>; otherwise false.
/// true if a directory is already present at <paramref name="path"/>; otherwise false.
/// </returns>
bool DestinationExists(string path);
bool DestinationDirectoryExists(string path);
/// <summary>
/// Checks whether the specified destination file already exists.
/// </summary>
/// <param name="path">The destination file.</param>
/// <returns>
/// true if a file is already present at <paramref name="path"/>; otherwise false.
/// </returns>
bool DestinationFileExists(string path);
Task<ViewerRepositoriesModel> ReadViewerRepositories(HostAddress address);
}

Просмотреть файл

@ -5,7 +5,7 @@ using ReactiveUI;
namespace GitHub.ViewModels.Dialog.Clone
{
/// <summary>
/// ViewModel for the the Clone Repository dialog
/// ViewModel for the Clone Repository dialog
/// </summary>
public interface IRepositoryCloneViewModel : IDialogContentViewModel, IConnectionInitializedViewModel
{
@ -30,9 +30,9 @@ namespace GitHub.ViewModels.Dialog.Clone
string Path { get; set; }
/// <summary>
/// Gets an error message that explains why <see cref="Path"/> is not valid.
/// Gets a warning message that explains why <see cref="Path"/> is suspect.
/// </summary>
string PathError { get; }
string PathWarning { get; }
/// <summary>
/// Gets the index of the selected tab.

Просмотреть файл

@ -1,11 +1,8 @@
using System;
using System.Collections.ObjectModel;
using System.Collections.ObjectModel;
using System.Reactive;
using GitHub.Models;
using GitHub.ViewModels;
using ReactiveUI;
namespace GitHub.InlineReviews.ViewModels
namespace GitHub.ViewModels
{
/// <summary>
/// A comment thread.

Просмотреть файл

@ -1,10 +1,8 @@
using System;
using System.Reactive;
using GitHub.Models;
using GitHub.ViewModels;
using ReactiveUI;
namespace GitHub.InlineReviews.ViewModels
namespace GitHub.ViewModels
{
public enum CommentEditState
{

Просмотреть файл

@ -1,4 +1,5 @@
using System;
using GitHub.Primitives;
namespace GitHub.Models
{
@ -12,10 +13,10 @@ namespace GitHub.Models
/// </summary>
/// <param name="path">The path to clone the repository to.</param>
/// <param name="repository">The selected repository.</param>
public CloneDialogResult(string path, IRepositoryModel repository)
public CloneDialogResult(string path, UriString cloneUrl)
{
Path = path;
Repository = repository;
Url = cloneUrl;
}
/// <summary>
@ -24,8 +25,8 @@ namespace GitHub.Models
public string Path { get; }
/// <summary>
/// Gets the repository selected by the user.
/// Gets the url selected by the user.
/// </summary>
public IRepositoryModel Repository { get; }
public UriString Url { get; }
}
}

Просмотреть файл

@ -91,6 +91,9 @@ namespace GitHub.Models
public int NumberOfCloneViewUrlTab { get; set; }
public int NumberOfGitHubClones { get; set; }
public int NumberOfEnterpriseClones { get; set; }
public int NumberOfGitHubOpens { get; set; }
public int NumberOfEnterpriseOpens { get; set; }
public int NumberOfClonesToDefaultClonePath { get; set; }
}
}
}

Просмотреть файл

@ -16,11 +16,14 @@ namespace GitHub.Services
/// The connection to use. If null, the first connection will be used, or the user promted
/// to log in if there are no connections.
/// </param>
/// <param name="url">
/// The URL to prepopulate URL field with or null.
/// </param>
/// <returns>
/// A task that returns an instance of <see cref="CloneDialogResult"/> on success,
/// or null if the dialog was cancelled.
/// </returns>
Task<CloneDialogResult> ShowCloneDialog(IConnection connection);
Task<CloneDialogResult> ShowCloneDialog(IConnection connection, string url = null);
/// <summary>
/// Shows the re-clone dialog.

Просмотреть файл

@ -5,7 +5,9 @@ namespace GitHub.Services
public interface ITeamExplorerServices : INotificationService
{
void ShowConnectPage();
void ShowHomePage();
void ShowPublishSection();
void ClearNotifications();
void OpenRepository(string repositoryPath);
}
}

Просмотреть файл

@ -84,8 +84,6 @@
<Compile Include="Margins\InlineCommentMargin.cs" />
<Compile Include="Margins\InlineCommentMarginVisible.cs" />
<Compile Include="Margins\InlineCommentMarginEnabled.cs" />
<Compile Include="Services\CommentService.cs" />
<Compile Include="Services\ICommentService.cs" />
<Compile Include="PullRequestStatusBarPackage.cs" />
<Compile Include="InlineReviewsPackage.cs" />
<Compile Include="Models\InlineCommentThreadModel.cs" />
@ -102,7 +100,6 @@
<Compile Include="Peek\InlineCommentPeekResultPresentation.cs" />
<Compile Include="Peek\InlineCommentPeekResultPresenter.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="SampleData\CommentThreadViewModelDesigner.cs" />
<Compile Include="Services\IInlineCommentPeekService.cs" />
<Compile Include="Services\IPullRequestSessionService.cs" />
<Compile Include="Services\InlineCommentPeekService.cs" />
@ -111,9 +108,6 @@
<Compile Include="Margins\InlineCommentMarginProvider.cs" />
<Compile Include="Services\PullRequestSessionService.cs" />
<Compile Include="ViewModels\PullRequestFileMarginViewModel.cs" />
<Compile Include="ViewModels\CommentViewModel.cs" />
<Compile Include="ViewModels\ICommentThreadViewModel.cs" />
<Compile Include="ViewModels\CommentThreadViewModel.cs" />
<Compile Include="ViewModels\InlineCommentPeekViewModel.cs" />
<Compile Include="ViewModels\IPullRequestReviewCommentViewModel.cs" />
<Compile Include="ViewModels\NewInlineCommentThreadViewModel.cs" />
@ -128,7 +122,6 @@
<Compile Include="Views\InlineCommentPeekView.xaml.cs">
<DependentUpon>InlineCommentPeekView.xaml</DependentUpon>
</Compile>
<Compile Include="SampleData\CommentViewModelDesigner.cs" />
<Compile Include="Services\DiffService.cs" />
<Compile Include="Services\IDiffService.cs" />
<Compile Include="Tags\AddInlineCommentTag.cs" />
@ -144,13 +137,6 @@
<Compile Include="Tags\InlineCommentTagger.cs" />
<Compile Include="Tags\InlineCommentTaggerProvider.cs" />
<Compile Include="ViewModels\InlineCommentThreadViewModel.cs" />
<Compile Include="ViewModels\ICommentViewModel.cs" />
<Compile Include="Views\CommentThreadView.xaml.cs">
<DependentUpon>CommentThreadView.xaml</DependentUpon>
</Compile>
<Compile Include="Views\CommentView.xaml.cs">
<DependentUpon>CommentView.xaml</DependentUpon>
</Compile>
<Compile Include="Views\PullRequestStatusView.xaml.cs">
<DependentUpon>PullRequestStatusView.xaml</DependentUpon>
</Compile>
@ -460,14 +446,6 @@
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="Views\CommentThreadView.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="Views\CommentView.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="Views\PullRequestStatusView.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
@ -481,7 +459,9 @@
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>
<ItemGroup />
<ItemGroup>
<Folder Include="SampleData\" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="$(VSToolsPath)\VSSDK\Microsoft.VsSDK.targets" Condition="'$(VSToolsPath)' != '' And '$(NCrunch)' != '1'" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">

Просмотреть файл

@ -1,5 +1,6 @@
using System;
using System.Reactive;
using GitHub.ViewModels;
using ReactiveUI;
namespace GitHub.InlineReviews.ViewModels

Просмотреть файл

@ -16,6 +16,7 @@ using GitHub.Logging;
using GitHub.Models;
using GitHub.Primitives;
using GitHub.Services;
using GitHub.ViewModels;
using Microsoft.VisualStudio.Language.Intellisense;
using Microsoft.VisualStudio.Text;
using ReactiveUI;

Просмотреть файл

@ -1,40 +0,0 @@
<UserControl x:Class="GitHub.InlineReviews.Views.CommentThreadView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:GitHub.InlineReviews.Views"
xmlns:sample="clr-namespace:GitHub.InlineReviews.SampleData"
mc:Ignorable="d" d:DesignHeight="300" d:DesignWidth="300">
<d:DesignProperties.DataContext>
<x:Array Type="{x:Type sample:CommentThreadViewModelDesigner}">
<sample:CommentThreadViewModelDesigner>
<!-- <sample:CommentThreadViewModelDesigner.Comments>
<sample:CommentViewModelDesigner>
<sample:CommentViewModelDesigner.Body>
I assume this doesn't do anything if our message isn't showing?
</sample:CommentViewModelDesigner.Body>
</sample:CommentViewModelDesigner>
<sample:CommentViewModelDesigner>
<sample:CommentViewModelDesigner.Body>
Nope, does nothing! Also checked the logs.
</sample:CommentViewModelDesigner.Body>
</sample:CommentViewModelDesigner>
<sample:CommentViewModelDesigner EditState="Placeholder">
<sample:CommentViewModelDesigner.Body>
Reply...
</sample:CommentViewModelDesigner.Body>
</sample:CommentViewModelDesigner>
</sample:CommentThreadViewModelDesigner.Comments> -->
</sample:CommentThreadViewModelDesigner>
</x:Array>
</d:DesignProperties.DataContext>
<ItemsControl ItemsSource="{Binding Comments}">
<ItemsControl.ItemTemplate>
<DataTemplate>
<local:CommentView Margin="0 4"/>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</UserControl>

Просмотреть файл

@ -105,7 +105,7 @@
VerticalScrollBarVisibility="Auto"
Background="{DynamicResource GitHubPeekViewBackground}">
<Grid>
<local:CommentThreadView x:Name="threadView" DataContext="{Binding Thread}"/>
<ghfvs:CommentThreadView x:Name="threadView" DataContext="{Binding Thread}"/>
</Grid>
</ScrollViewer>
</DockPanel>

47
src/GitHub.Resources/Resources.Designer.cs сгенерированный
Просмотреть файл

@ -249,6 +249,15 @@ namespace GitHub {
}
}
/// <summary>
/// Looks up a localized string similar to There is already a directory at this location, but it doesn&apos;t contain a repository..
/// </summary>
public static string CantFindARepositoryAtLocalPath {
get {
return ResourceManager.GetString("CantFindARepositoryAtLocalPath", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Changes ({0}).
/// </summary>
@ -505,7 +514,7 @@ namespace GitHub {
}
/// <summary>
/// Looks up a localized string similar to The destination already exists..
/// Looks up a localized string similar to A file exists at the destination path..
/// </summary>
public static string DestinationAlreadyExists {
get {
@ -873,6 +882,24 @@ namespace GitHub {
}
}
/// <summary>
/// Looks up a localized string similar to A repository already exists at this location, but it doesn&apos;t have a remote named &quot;origin&quot;..
/// </summary>
public static string LocalRepositoryDoesntHaveARemoteOrigin {
get {
return ResourceManager.GetString("LocalRepositoryDoesntHaveARemoteOrigin", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to A repository already exists at this location, but it has a remote of {0}..
/// </summary>
public static string LocalRepositoryHasARemoteOf {
get {
return ResourceManager.GetString("LocalRepositoryHasARemoteOf", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Make sure to use your password and not a Personal Access token to sign in..
/// </summary>
@ -1188,6 +1215,15 @@ namespace GitHub {
}
}
/// <summary>
/// Looks up a localized string similar to Open from GitHub.
/// </summary>
public static string OpenFromGitHubTitle {
get {
return ResourceManager.GetString("OpenFromGitHubTitle", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Open in Browser.
/// </summary>
@ -2144,6 +2180,15 @@ namespace GitHub {
}
}
/// <summary>
/// Looks up a localized string similar to You have already cloned to this location. Click &apos;Open&apos; to open the local repository..
/// </summary>
public static string YouHaveAlreadyClonedToThisLocation {
get {
return ResourceManager.GetString("YouHaveAlreadyClonedToThisLocation", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to You must commit and push your changes to add a comment here..
/// </summary>

Просмотреть файл

@ -123,6 +123,9 @@
<data name="CloneTitle" xml:space="preserve">
<value>Clone a Repository</value>
</data>
<data name="OpenFromGitHubTitle" xml:space="preserve">
<value>Open from GitHub</value>
</data>
<data name="CouldNotConnectToGitHub" xml:space="preserve">
<value>Could not connect to github.com</value>
</data>
@ -328,7 +331,7 @@ https://git-scm.com/download/win</value>
<value>Cancel Review</value>
</data>
<data name="DestinationAlreadyExists" xml:space="preserve">
<value>The destination already exists.</value>
<value>A file exists at the destination path.</value>
</data>
<data name="LogoutRequired" xml:space="preserve">
<value>Logout Required</value>
@ -821,4 +824,16 @@ https://git-scm.com/download/win</value>
<data name="NoResolveSameOwnerMessage" xml:space="preserve">
<value>Couldn't find target URL in current repository. Try again after doing a fetch.</value>
</data>
<data name="CantFindARepositoryAtLocalPath" xml:space="preserve">
<value>There is already a directory at this location, but it doesn't contain a repository.</value>
</data>
<data name="LocalRepositoryDoesntHaveARemoteOrigin" xml:space="preserve">
<value>A repository already exists at this location, but it doesn't have a remote named "origin".</value>
</data>
<data name="LocalRepositoryHasARemoteOf" xml:space="preserve">
<value>A repository already exists at this location, but it has a remote of {0}.</value>
</data>
<data name="YouHaveAlreadyClonedToThisLocation" xml:space="preserve">
<value>You have already cloned to this location. Click 'Open' to open the local repository.</value>
</data>
</root>

Просмотреть файл

@ -123,6 +123,9 @@
<data name="CloneTitle" xml:space="preserve">
<value>克隆一个 版本库</value>
</data>
<data name="OpenFromGitHubTitle" xml:space="preserve">
<value>Open from GitHub</value>
</data>
<data name="CouldNotConnectToGitHub" xml:space="preserve">
<value>无法连接到github.com</value>
</data>
@ -327,10 +330,10 @@
<value>取消评审</value>
</data>
<data name="DestinationAlreadyExists" xml:space="preserve">
<value>The destination already exists.</value>
<value>A file exists at the destination path.</value>
</data>
<data name="LogoutRequired" xml:space="preserve">
<value>Logout Required</value>
<value>需要注销</value>
</data>
<data name="day" xml:space="preserve">
<value>{0:N0} 天前</value>
@ -345,7 +348,7 @@
<value>{0:N0} 小时前</value>
</data>
<data name="JustNow" xml:space="preserve">
<value>just now</value>
<value>就现在</value>
</data>
<data name="minute" xml:space="preserve">
<value>{0:N0} 分钟前</value>
@ -820,4 +823,16 @@
<data name="NoResolveSameOwnerMessage" xml:space="preserve">
<value>无法在当前存储库中找到目标URL。在进行提取后再试一次。</value>
</data>
<data name="CantFindARepositoryAtLocalPath" xml:space="preserve">
<value>There is already a directory at this location, but it doesn't contain a repository.</value>
</data>
<data name="LocalRepositoryDoesntHaveARemoteOrigin" xml:space="preserve">
<value>A repository already exists at this location, but it doesn't have a remote named "origin".</value>
</data>
<data name="LocalRepositoryHasARemoteOf" xml:space="preserve">
<value>A repository already exists at this location, but it has a remote of {0}.</value>
</data>
<data name="YouHaveAlreadyClonedToThisLocation" xml:space="preserve">
<value>You have already cloned to this location. Click 'Open' to open the local repository.</value>
</data>
</root>

Просмотреть файл

@ -70,11 +70,12 @@ namespace GitHub.StartPage
if (request == null)
return null;
var uri = request.Repository.CloneUrl.ToRepositoryUrl();
var uri = request.Url.ToRepositoryUrl();
var repositoryName = request.Url.RepositoryName;
return new CodeContainer(
localProperties: new CodeContainerLocalProperties(request.Path, CodeContainerType.Folder,
new CodeContainerSourceControlProperties(request.Repository.Name, request.Path, new Guid(Guids.GitSccProviderId))),
remote: new RemoteCodeContainer(request.Repository.Name,
new CodeContainerSourceControlProperties(repositoryName, request.Path, new Guid(Guids.GitSccProviderId))),
remote: new RemoteCodeContainer(repositoryName,
new Guid(Guids.CodeContainerProviderId),
uri,
new Uri(uri.ToString().TrimSuffix(".git")),
@ -133,7 +134,7 @@ namespace GitHub.StartPage
if (basePath != null)
{
var path = Path.Combine(basePath, repository.Name);
result = new CloneDialogResult(path, repository);
result = new CloneDialogResult(path, repository.CloneUrl);
}
}
@ -141,17 +142,13 @@ namespace GitHub.StartPage
{
try
{
await cloneService.CloneRepository(
result.Repository.CloneUrl,
result.Path,
progress);
await cloneService.CloneOrOpenRepository(result, progress);
usageTracker.IncrementCounter(x => x.NumberOfStartPageClones).Forget();
}
catch
{
var teServices = gitHubServiceProvider.TryGetService<ITeamExplorerServices>();
teServices.ShowError($"Failed to clone the repository '{result.Repository.Name}'");
teServices.ShowError($"Failed to clone the repository '{result.Url.RepositoryName}'");
result = null;
}
}

Просмотреть файл

@ -151,16 +151,14 @@ namespace GitHub.VisualStudio.TeamExplorer.Connect
{
ServiceProvider.GitServiceProvider = TEServiceProvider;
var cloneService = ServiceProvider.GetService<IRepositoryCloneService>();
await cloneService.CloneRepository(
result.Repository.CloneUrl,
result.Path);
await cloneService.CloneOrOpenRepository(result);
usageTracker.IncrementCounter(x => x.NumberOfGitHubConnectSectionClones).Forget();
}
catch (Exception e)
{
var teServices = ServiceProvider.TryGetService<ITeamExplorerServices>();
teServices.ShowError(e.GetUserFriendlyErrorMessage(ErrorType.ClonedFailed, result.Repository.Name));
teServices.ShowError(e.GetUserFriendlyErrorMessage(ErrorType.CloneOrOpenFailed, result.Url.RepositoryName));
}
}
}

Просмотреть файл

@ -52,6 +52,10 @@
</PropertyGroup>
<Import Project="$(SolutionDir)\src\common\signing.props" />
<ItemGroup>
<Reference Include="EnvDTE, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<HintPath>..\..\packages\EnvDTE.8.0.2\lib\net10\EnvDTE.dll</HintPath>
<EmbedInteropTypes>False</EmbedInteropTypes>
</Reference>
<Reference Include="LibGit2Sharp, Version=0.23.1.0, Culture=neutral, PublicKeyToken=7cbde695407f0333, processorArchitecture=MSIL">
<HintPath>..\..\packages\LibGit2Sharp.0.23.1\lib\net40\LibGit2Sharp.dll</HintPath>
<Private>True</Private>
@ -131,6 +135,10 @@
<HintPath>..\..\packages\Stateless.2.5.56.0\lib\portable-net40+sl50+win+wp80+MonoAndroid10+xamarinios10+MonoTouch10\Stateless.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="stdole, Version=7.0.3300.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<HintPath>..\..\packages\stdole.7.0.3302\lib\net10\stdole.dll</HintPath>
<EmbedInteropTypes>True</EmbedInteropTypes>
</Reference>
<Reference Include="System" />
<Reference Include="System.ComponentModel.Composition" />
<Reference Include="System.Core" />

Просмотреть файл

@ -2,10 +2,9 @@ using System;
using System.ComponentModel.Composition;
using System.Diagnostics.CodeAnalysis;
using System.Windows.Input;
using GitHub.Extensions;
using EnvDTE;
using GitHub.VisualStudio.TeamExplorer.Sync;
using Microsoft.TeamFoundation.Controls;
using Microsoft.VisualStudio.Shell;
namespace GitHub.Services
{
@ -29,12 +28,28 @@ namespace GitHub.Services
this.serviceProvider = serviceProvider;
}
public void OpenRepository(string repositoryPath)
{
#if TEAMEXPLORER14
var vsServices = serviceProvider.GetService<IVSServices>();
vsServices.TryOpenRepository(repositoryPath);
#else
OpenFolder(repositoryPath);
#endif
}
public void ShowConnectPage()
{
var te = serviceProvider.TryGetService<ITeamExplorer>();
te.NavigateToPage(new Guid(TeamExplorerPageIds.Connect), null);
}
public void ShowHomePage()
{
var te = serviceProvider.TryGetService<ITeamExplorer>();
te.NavigateToPage(new Guid(TeamExplorerPageIds.Home), null);
}
public void ShowPublishSection()
{
var te = serviceProvider.TryGetService<ITeamExplorer>();
@ -89,5 +104,11 @@ namespace GitHub.Services
manager = serviceProvider.GetService<ITeamExplorer, ITeamExplorerNotificationManager>();
return manager?.IsNotificationVisible(guid) ?? false;
}
void OpenFolder(string repositoryPath)
{
var dte = serviceProvider.TryGetService<DTE>();
dte?.ExecuteCommand("File.OpenFolder", repositoryPath);
}
}
}

Просмотреть файл

@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="EnvDTE" version="8.0.2" targetFramework="net461" />
<package id="LibGit2Sharp" version="0.23.1" targetFramework="net461" />
<package id="LibGit2Sharp.NativeBinaries" version="1.0.164" targetFramework="net461" />
<package id="Microsoft.VisualStudio.ComponentModelHost" version="14.0.25424" targetFramework="net461" />
@ -18,4 +19,5 @@
<package id="Serilog" version="2.5.0" targetFramework="net461" />
<package id="SerilogAnalyzer" version="0.12.0.0" targetFramework="net461" />
<package id="Stateless" version="2.5.56.0" targetFramework="net461" />
<package id="stdole" version="7.0.3302" targetFramework="net461" />
</packages>

Просмотреть файл

@ -52,6 +52,10 @@
</PropertyGroup>
<Import Project="$(SolutionDir)\src\common\signing.props" />
<ItemGroup>
<Reference Include="EnvDTE, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<HintPath>..\..\packages\EnvDTE.8.0.2\lib\net10\EnvDTE.dll</HintPath>
<EmbedInteropTypes>False</EmbedInteropTypes>
</Reference>
<Reference Include="LibGit2Sharp, Version=0.23.1.0, Culture=neutral, PublicKeyToken=7cbde695407f0333, processorArchitecture=MSIL">
<HintPath>..\..\packages\LibGit2Sharp.0.23.1\lib\net40\LibGit2Sharp.dll</HintPath>
<Private>True</Private>
@ -150,6 +154,10 @@
<HintPath>..\..\packages\Stateless.2.5.56.0\lib\portable-net40+sl50+win+wp80+MonoAndroid10+xamarinios10+MonoTouch10\Stateless.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="stdole, Version=7.0.3300.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<HintPath>..\..\packages\stdole.7.0.3302\lib\net10\stdole.dll</HintPath>
<EmbedInteropTypes>True</EmbedInteropTypes>
</Reference>
<Reference Include="System" />
<Reference Include="System.ComponentModel.Composition" />
<Reference Include="System.Core" />

Просмотреть файл

@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="EnvDTE" version="8.0.2" targetFramework="net461" />
<package id="LibGit2Sharp" version="0.23.1" targetFramework="net461" />
<package id="LibGit2Sharp.NativeBinaries" version="1.0.164" targetFramework="net461" />
<package id="Microsoft.VisualStudio.CoreUtility" version="15.4.27004" targetFramework="net461" />
@ -24,4 +25,5 @@
<package id="Serilog" version="2.5.0" targetFramework="net461" />
<package id="SerilogAnalyzer" version="0.12.0.0" targetFramework="net461" />
<package id="Stateless" version="2.5.56.0" targetFramework="net461" />
<package id="stdole" version="7.0.3302" targetFramework="net461" />
</packages>

11
src/GitHub.UI/TestAutomation/AutomationIDs.Designer.cs сгенерированный
Просмотреть файл

@ -19,7 +19,7 @@ namespace GitHub.UI.TestAutomation {
// class via a tool like ResGen or Visual Studio.
// To add or remove a member, edit your .ResX file then rerun ResGen
// with the /str option, or rebuild your VS project.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "15.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
public class AutomationIDs {
@ -717,6 +717,15 @@ namespace GitHub.UI.TestAutomation {
}
}
/// <summary>
/// Looks up a localized string similar to OpenRepositoryButton.
/// </summary>
public static string OpenRepositoryButton {
get {
return ResourceManager.GetString("OpenRepositoryButton", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to PowerfulCollaborationTextBlock.
/// </summary>

Просмотреть файл

@ -516,4 +516,7 @@
<data name="TwoFactorAuthenticationInputStackPanel" xml:space="preserve">
<value>TwoFactorAuthenticationInputStackPanel</value>
</data>
<data name="OpenRepositoryButton" xml:space="preserve">
<value>OpenRepositoryButton</value>
</data>
</root>

Просмотреть файл

@ -7,6 +7,7 @@
<Import Project="$(SolutionDir)\src\common\signing.props" />
<ItemGroup>
<Reference Include="System.ComponentModel.Composition" />
<Reference Include="System.Xaml" />
<Reference Include="PresentationCore" />
<Reference Include="PresentationFramework" />
@ -15,12 +16,17 @@
<ItemGroup>
<ProjectReference Include="..\..\submodules\reactiveui\ReactiveUI.Events\ReactiveUI.Events_Net45.csproj" />
<ProjectReference Include="..\GitHub.Exports.Reactive\GitHub.Exports.Reactive.csproj" />
<ProjectReference Include="..\GitHub.UI\GitHub.UI.csproj" />
<ProjectReference Include="..\GitHub.App\GitHub.App.csproj" />
<ProjectReference Include="..\GitHub.UI.Reactive\GitHub.UI.Reactive.csproj" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="EnvDTE" Version="8.0.1" />
<PackageReference Include="Markdig.Signed" version="0.13.0" />
<PackageReference Include="Markdig.Wpf.Signed" version="0.2.1" />
<PackageReference Include="Microsoft.VisualStudio.SDK.EmbedInteropTypes" Version="15.0.17" />
<PackageReference Include="Microsoft.VisualStudio.ImageCatalog" version="14.3.25407" />
<PackageReference Include="Microsoft.VisualStudio.Shell.Interop.14.0.DesignTime" version="14.3.25407" />
<PackageReference Include="Rx-XAML" version="2.2.5-custom" />
</ItemGroup>
</Project>

Просмотреть файл

@ -3,3 +3,6 @@
[assembly: XmlnsDefinition("https://github.com/github/VisualStudio", "GitHub.VisualStudio.UI")]
[assembly: XmlnsDefinition("https://github.com/github/VisualStudio", "GitHub.VisualStudio.UI.Controls")]
[assembly: XmlnsDefinition("https://github.com/github/VisualStudio", "GitHub.VisualStudio.UI.Views")]
[assembly: XmlnsDefinition("https://github.com/github/VisualStudio", "GitHub.VisualStudio.Views")]
[assembly: XmlnsDefinition("https://github.com/github/VisualStudio", "GitHub.VisualStudio.Views.Dialog")]
[assembly: XmlnsDefinition("https://github.com/github/VisualStudio", "GitHub.VisualStudio.Views.GitHubPane")]

Просмотреть файл

@ -0,0 +1,40 @@
<UserControl x:Class="GitHub.VisualStudio.Views.CommentThreadView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:GitHub.VisualStudio.Views"
xmlns:ghfvs="https://github.com/github/VisualStudio"
mc:Ignorable="d" d:DesignHeight="300" d:DesignWidth="300">
<d:DesignProperties.DataContext>
<x:Array Type="{x:Type ghfvs:CommentThreadViewModelDesigner}">
<ghfvs:CommentThreadViewModelDesigner>
<!-- <ghfvs:CommentThreadViewModelDesigner.Comments>
<ghfvs:CommentViewModelDesigner>
<ghfvs:CommentViewModelDesigner.Body>
I assume this doesn't do anything if our message isn't showing?
</ghfvs:CommentViewModelDesigner.Body>
</ghfvs:CommentViewModelDesigner>
<ghfvs:CommentViewModelDesigner>
<ghfvs:CommentViewModelDesigner.Body>
Nope, does nothing! Also checked the logs.
</ghfvs:CommentViewModelDesigner.Body>
</ghfvs:CommentViewModelDesigner>
<ghfvs:CommentViewModelDesigner EditState="Placeholder">
<ghfvs:CommentViewModelDesigner.Body>
Reply...
</ghfvs:CommentViewModelDesigner.Body>
</ghfvs:CommentViewModelDesigner>
</ghfvs:CommentThreadViewModelDesigner.Comments> -->
</ghfvs:CommentThreadViewModelDesigner>
</x:Array>
</d:DesignProperties.DataContext>
<ItemsControl ItemsSource="{Binding Comments}">
<ItemsControl.ItemTemplate>
<DataTemplate>
<local:CommentView Margin="0 4"/>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</UserControl>

Просмотреть файл

@ -2,7 +2,7 @@
using System.Windows.Controls;
using GitHub.VisualStudio.UI.Helpers;
namespace GitHub.InlineReviews.Views
namespace GitHub.VisualStudio.Views
{
public partial class CommentThreadView : UserControl
{

Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше