Merge branch 'master' into master

This commit is contained in:
Jasmine Greenaway 2017-02-13 10:21:11 -05:00 коммит произвёл GitHub
Родитель a21769df53 3ab0522e34
Коммит dd50e93470
19 изменённых файлов: 142 добавлений и 19 удалений

Двоичные данные
lib/15.0/Microsoft.TeamFoundation.Client.dll

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

Двоичные данные
lib/15.0/Microsoft.TeamFoundation.Common.dll

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

Двоичные данные
lib/15.0/Microsoft.TeamFoundation.Controls.dll

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

Двоичные данные
lib/15.0/Microsoft.TeamFoundation.Git.Client.dll

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

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

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

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

@ -8,6 +8,7 @@ using GitHub.Services;
using GitHub.UI;
using GitHub.ViewModels;
using NullGuard;
using System.Diagnostics;
namespace GitHub.Controllers
{
@ -66,7 +67,14 @@ namespace GitHub.Controllers
switch (data.MainFlow)
{
case UIControllerFlow.PullRequestCreation:
CreateView(connection, data, onViewLoad);
if (data.Data == null && Current?.SelectedFlow == UIControllerFlow.PullRequestCreation)
{
Reload();
}
else
{
CreateView(connection, data, onViewLoad);
}
break;
case UIControllerFlow.PullRequestDetail:

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

@ -35,6 +35,7 @@ namespace GitHub.ViewModels
readonly IRepositoryHost repositoryHost;
readonly IObservable<IRemoteRepositoryModel> githubObs;
readonly CompositeDisposable disposables = new CompositeDisposable();
readonly ILocalRepositoryModel activeLocalRepo;
[ImportingConstructor]
PullRequestCreationViewModel(
@ -42,7 +43,7 @@ namespace GitHub.ViewModels
IPullRequestService service, INotificationService notifications)
: this(connectionRepositoryHostMap?.CurrentRepositoryHost, teservice?.ActiveRepo, service,
notifications)
{}
{}
public PullRequestCreationViewModel(IRepositoryHost repositoryHost, ILocalRepositoryModel activeRepo,
IPullRequestService service, INotificationService notifications)
@ -53,6 +54,7 @@ namespace GitHub.ViewModels
Extensions.Guard.ArgumentNotNull(notifications, nameof(notifications));
this.repositoryHost = repositoryHost;
activeLocalRepo = activeRepo;
var obs = repositoryHost.ApiClient.GetRepository(activeRepo.Owner, activeRepo.Name)
.Select(r => new RemoteRepositoryModel(r))
@ -146,6 +148,8 @@ namespace GitHub.ViewModels
Branches = x.ToList();
Initialized = true;
});
SourceBranch = activeLocalRepo.CurrentBranch;
}
void SetupValidators()

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

@ -90,22 +90,22 @@ namespace GitHub.ViewModels
.Cast<CheckoutCommandState>()
.Select(x => x != null && x.IsEnabled),
DoCheckout);
Checkout.ThrownExceptions.Subscribe(x => OperationError = x.Message);
Checkout.IsExecuting.Subscribe(x => isInCheckout = x);
SubscribeOperationError(Checkout);
Pull = ReactiveCommand.CreateAsyncObservable(
this.WhenAnyValue(x => x.UpdateState)
.Cast<UpdateCommandState>()
.Select(x => x != null && x.PullEnabled),
DoPull);
Pull.ThrownExceptions.Subscribe(x => OperationError = x.Message);
SubscribeOperationError(Pull);
Push = ReactiveCommand.CreateAsyncObservable(
this.WhenAnyValue(x => x.UpdateState)
.Cast<UpdateCommandState>()
.Select(x => x != null && x.PushEnabled),
DoPush);
Push.ThrownExceptions.Subscribe(x => OperationError = x.Message);
SubscribeOperationError(Push);
OpenOnGitHub = ReactiveCommand.Create();
@ -288,6 +288,7 @@ namespace GitHub.ViewModels
IsBusy = true;
OperationError = null;
modelService.GetPullRequest(repository, prNumber)
.TakeLast(1)
.ObserveOn(RxApp.MainThreadScheduler)
@ -418,6 +419,12 @@ namespace GitHub.ViewModels
return pullRequestsService.ExtractDiffFiles(repository, modelService, model, path, file.Sha).ToTask();
}
void SubscribeOperationError(ReactiveCommand<Unit> command)
{
command.ThrownExceptions.Subscribe(x => OperationError = x.Message);
command.IsExecuting.Select(x => x).Subscribe(x => OperationError = null);
}
IEnumerable<IPullRequestFileNode> CreateChangedFilesList(IPullRequestModel pullRequest, TreeChanges changes)
{
return pullRequest.ChangedFiles

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

@ -24,14 +24,14 @@
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DefineConstants>TRACE;DEBUG;TEAMEXPLORER14</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<DefineConstants>TRACE</DefineConstants>
<DefineConstants>TRACE;TEAMEXPLORER14</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>

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

@ -12,6 +12,8 @@ using Microsoft.VisualStudio.Shell.Interop;
using GitHub.TeamFoundation;
using Microsoft.TeamFoundation.Git.Controls.Extensibility;
using Microsoft.VisualStudio.TeamFoundation.Git.Extensibility;
using Microsoft.VisualStudio.Shell;
using System.Threading;
namespace GitHub.Services
{
@ -21,6 +23,7 @@ namespace GitHub.Services
public class VSGitServices : IVSGitServices
{
readonly IGitHubServiceProvider serviceProvider;
readonly IVsStatusbar statusBar;
/// <summary>
/// This MEF export requires specific versions of TeamFoundation. IGitExt is declared here so
@ -34,6 +37,7 @@ namespace GitHub.Services
public VSGitServices(IGitHubServiceProvider serviceProvider)
{
this.serviceProvider = serviceProvider;
this.statusBar = serviceProvider.GetService<IVsStatusbar>();
}
// The Default Repository Path that VS uses is hidden in an internal
@ -57,8 +61,19 @@ namespace GitHub.Services
public void Clone(string cloneUrl, string clonePath, bool recurseSubmodules)
{
#if TEAMEXPLORER14
var gitExt = serviceProvider.GetService<IGitRepositoriesExt>();
gitExt.Clone(cloneUrl, clonePath, recurseSubmodules ? CloneOptions.RecurseSubmodule : CloneOptions.None);
#else
var gitExt = serviceProvider.GetService<IGitActionsExt>();
var progress = new Progress<ServiceProgressData>();
ThreadHelper.JoinableTaskFactory.RunAsync(async () =>
{
progress.ProgressChanged += (s, e) => statusBar.SetText(e.ProgressText);
await gitExt.CloneAsync(cloneUrl, clonePath, recurseSubmodules, default(CancellationToken), progress);
});
#endif
}
IGitRepositoryInfo GetRepoFromVS()

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

@ -69,10 +69,22 @@
<HintPath>..\..\packages\VSSDK.ComponentModelHost.12.0.4\lib\net45\Microsoft.VisualStudio.ComponentModelHost.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="Microsoft.VisualStudio.CoreUtility, Version=15.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\..\packages\Microsoft.VisualStudio.CoreUtility.15.0.26201\lib\net45\Microsoft.VisualStudio.CoreUtility.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Microsoft.VisualStudio.OLE.Interop, Version=7.1.40304.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<HintPath>..\..\packages\Microsoft.VisualStudio.OLE.Interop.7.10.6070\lib\Microsoft.VisualStudio.OLE.Interop.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Microsoft.VisualStudio.Shell.14.0, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\..\packages\Microsoft.VisualStudio.Shell.14.0.14.3.25407\lib\Microsoft.VisualStudio.Shell.14.0.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Microsoft.VisualStudio.Shell.Framework, Version=15.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\..\packages\Microsoft.VisualStudio.Shell.Framework.15.0.26201\lib\net45\Microsoft.VisualStudio.Shell.Framework.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Microsoft.VisualStudio.Shell.Immutable.10.0, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\..\packages\Microsoft.VisualStudio.Shell.Immutable.10.0.10.0.30319\lib\net40\Microsoft.VisualStudio.Shell.Immutable.10.0.dll</HintPath>
<Private>True</Private>
@ -85,6 +97,18 @@
<HintPath>..\..\packages\Microsoft.VisualStudio.Shell.Interop.8.0.8.0.50727\lib\Microsoft.VisualStudio.Shell.Interop.8.0.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Microsoft.VisualStudio.Threading, Version=15.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\..\packages\Microsoft.VisualStudio.Threading.15.0.240\lib\net45\Microsoft.VisualStudio.Threading.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Microsoft.VisualStudio.Utilities, Version=15.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\..\packages\Microsoft.VisualStudio.Utilities.15.0.26201\lib\net45\Microsoft.VisualStudio.Utilities.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Microsoft.VisualStudio.Validation, Version=15.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\..\packages\Microsoft.VisualStudio.Validation.15.0.82\lib\net45\Microsoft.VisualStudio.Validation.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="NullGuard, Version=1.4.6.0, Culture=neutral, PublicKeyToken=1958ac8092168428, processorArchitecture=MSIL">
<HintPath>..\..\packages\NullGuard.Fody.1.4.6\Lib\dotnet\NullGuard.dll</HintPath>
<Private>False</Private>
@ -189,6 +213,7 @@
<Link>Properties\SolutionInfo.cs</Link>
</Compile>
<Compile Include="Properties\AssemblyInfo.cs" />
<None Include="app.config" />
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>

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

@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Microsoft.VisualStudio.Utilities" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-15.0.0.0" newVersion="15.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.VisualStudio.Threading" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-15.0.0.0" newVersion="15.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>

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

@ -3,10 +3,16 @@
<package id="Fody" version="1.29.4" targetFramework="net461" developmentDependency="true" />
<package id="LibGit2Sharp" version="0.22.0" targetFramework="net461" />
<package id="LibGit2Sharp.NativeBinaries" version="1.0.129" targetFramework="net461" />
<package id="Microsoft.VisualStudio.CoreUtility" version="15.0.26201" targetFramework="net461" />
<package id="Microsoft.VisualStudio.OLE.Interop" version="7.10.6070" targetFramework="net461" />
<package id="Microsoft.VisualStudio.Shell.14.0" version="14.3.25407" targetFramework="net461" />
<package id="Microsoft.VisualStudio.Shell.Framework" version="15.0.26201" targetFramework="net461" />
<package id="Microsoft.VisualStudio.Shell.Immutable.10.0" version="10.0.30319" targetFramework="net461" />
<package id="Microsoft.VisualStudio.Shell.Interop" version="7.10.6071" targetFramework="net461" />
<package id="Microsoft.VisualStudio.Shell.Interop.8.0" version="8.0.50727" targetFramework="net461" />
<package id="Microsoft.VisualStudio.Threading" version="15.0.240" targetFramework="net461" />
<package id="Microsoft.VisualStudio.Utilities" version="15.0.26201" targetFramework="net461" />
<package id="Microsoft.VisualStudio.Validation" version="15.0.82" targetFramework="net461" />
<package id="NullGuard.Fody" version="1.4.6" targetFramework="net461" developmentDependency="true" />
<package id="Rx-Core" version="2.2.5-custom" targetFramework="net45" />
<package id="Rx-Interfaces" version="2.2.5-custom" targetFramework="net45" />

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

@ -10,7 +10,7 @@
</NuGetPackageImportStamp>
<TargetFrameworkProfile />
<BuildType Condition="Exists('..\..\script\src\ApiClientConfiguration.cs')">Internal</BuildType>
<ApplicationVersion>2.2.0.7</ApplicationVersion>
<ApplicationVersion>2.2.0.8</ApplicationVersion>
<OutputPath>..\..\build\$(Configuration)\</OutputPath>
<VsixType>v3</VsixType>
<IsProductComponent>true</IsProductComponent>

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

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<PackageManifest Version="2.0.0" xmlns="http://schemas.microsoft.com/developer/vsx-schema/2011" xmlns:d="http://schemas.microsoft.com/developer/vsx-schema-design/2011">
<Metadata>
<Identity Id="c3d3dc68-c977-411f-b3e8-03b0dccf7dfc" Version="2.2.0.7" Language="en-US" Publisher="GitHub, Inc" />
<Identity Id="c3d3dc68-c977-411f-b3e8-03b0dccf7dfc" Version="2.2.0.8" Language="en-US" Publisher="GitHub, Inc" />
<DisplayName>GitHub Extension for Visual Studio</DisplayName>
<Description xml:space="preserve">A Visual Studio Extension that brings the GitHub Flow into Visual Studio.</Description>
<PackageId>GitHub.VisualStudio</PackageId>

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

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<Include>
<?define VersionNumber="2.2.0.7" ?>
<?define VersionNumber="2.2.0.8" ?>
</Include>

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

@ -1,4 +1,5 @@
using System;
using System.IO;
using System.Reactive;
using System.Reactive.Linq;
using System.Threading.Tasks;
@ -273,16 +274,51 @@ namespace UnitTests.GitHub.App.ViewModels
}
[Fact]
public async Task PullRequestFromGhostAccount()
public async Task SetsOperationErrorOnCheckoutFailure()
{
var target = CreateTarget(
currentBranch: "master",
existingPrBranch: "pr/123");
await target.Load(CreatePullRequest());
await Assert.ThrowsAsync<Exception>(() => target.Checkout.ExecuteAsyncTask(null));
Assert.True(target.Checkout.CanExecute(null));
await Assert.ThrowsAsync<FileNotFoundException>(async () => await target.Checkout.ExecuteAsyncTask());
Assert.Equal("Switch threw", target.OperationError);
}
[Fact]
public async Task ClearsOperationErrorOnCheckoutSuccess()
{
var target = CreateTarget(
currentBranch: "master",
existingPrBranch: "pr/123");
await target.Load(CreatePullRequest());
Assert.True(target.Checkout.CanExecute(null));
await Assert.ThrowsAsync<FileNotFoundException>(async () => await target.Checkout.ExecuteAsyncTask());
Assert.Equal("Switch threw", target.OperationError);
await target.Checkout.ExecuteAsync();
Assert.Null(target.OperationError);
}
[Fact]
public async Task ClearsOperationErrorOnCheckoutRefresh()
{
var target = CreateTarget(
currentBranch: "master",
existingPrBranch: "pr/123");
await target.Load(CreatePullRequest());
Assert.True(target.Checkout.CanExecute(null));
await Assert.ThrowsAsync<FileNotFoundException>(async () => await target.Checkout.ExecuteAsyncTask());
Assert.Equal("Switch threw", target.OperationError);
target.Initialize(null);
Assert.Null(target.OperationError);
}
}
public class ThePullCommand
@ -368,7 +404,7 @@ namespace UnitTests.GitHub.App.ViewModels
existingPrBranch: "pr/123");
await target.Load(CreatePullRequest());
await Assert.ThrowsAsync<Exception>(() => target.Pull.ExecuteAsyncTask(null));
await Assert.ThrowsAsync<FileNotFoundException>(() => target.Pull.ExecuteAsyncTask(null));
Assert.Equal("Pull threw", target.OperationError);
}
}
@ -471,7 +507,7 @@ namespace UnitTests.GitHub.App.ViewModels
existingPrBranch: "pr/123");
await target.Load(CreatePullRequest());
await Assert.ThrowsAsync<Exception>(() => target.Push.ExecuteAsyncTask(null));
await Assert.ThrowsAsync<FileNotFoundException>(() => target.Push.ExecuteAsyncTask(null));
Assert.Equal("Push threw", target.OperationError);
}
}
@ -527,7 +563,10 @@ namespace UnitTests.GitHub.App.ViewModels
pullRequestService.IsWorkingDirectoryClean(repository).Returns(Observable.Return(!dirty));
pullRequestService.Pull(repository).Returns(x => Throws("Pull threw"));
pullRequestService.Push(repository).Returns(x => Throws("Push threw"));
pullRequestService.SwitchToBranch(repository, Arg.Any<IPullRequestModel>()).Returns(x => Throws("Switch threw"));
pullRequestService.SwitchToBranch(repository, Arg.Any<IPullRequestModel>())
.Returns(
x => Throws("Switch threw"),
_ => Observable.Return(Unit.Default));
var divergence = Substitute.For<BranchTrackingDetails>();
divergence.AheadBy.Returns(aheadBy);
@ -563,7 +602,7 @@ namespace UnitTests.GitHub.App.ViewModels
static IObservable<Unit> Throws(string message)
{
Func<IObserver<Unit>, Action> f = _ => { throw new Exception(message); };
Func<IObserver<Unit>, Action> f = _ => { throw new FileNotFoundException(message); };
return Observable.Create(f);
}
}

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

@ -3,8 +3,8 @@ using System.Resources;
using System.Runtime.InteropServices;
[assembly: AssemblyProduct("GitHub Extension for Visual Studio")]
[assembly: AssemblyVersion("2.2.0.7")]
[assembly: AssemblyFileVersion("2.2.0.7")]
[assembly: AssemblyVersion("2.2.0.8")]
[assembly: AssemblyFileVersion("2.2.0.8")]
[assembly: ComVisible(false)]
[assembly: AssemblyCompany("GitHub, Inc.")]
[assembly: AssemblyCopyright("Copyright © GitHub, Inc. 2014-2016")]
@ -16,6 +16,6 @@ using System.Runtime.InteropServices;
namespace System
{
internal static class AssemblyVersionInformation {
internal const string Version = "2.2.0.7";
internal const string Version = "2.2.0.8";
}
}