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

Commit 458f3bd

Browse files
authored
Merge branch 'master' into patch-1
2 parents 7a4c3c9 + d308872 commit 458f3bd

File tree

125 files changed

+3179
-687
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

125 files changed

+3179
-687
lines changed

GitHubVS.sln

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -221,8 +221,8 @@ Global
221221
{E4ED0537-D1D9-44B6-9212-3096D7C3F7A1}.Release|Any CPU.Build.0 = Release|Any CPU
222222
{E4ED0537-D1D9-44B6-9212-3096D7C3F7A1}.ReleaseWithoutVsix|Any CPU.ActiveCfg = Release|Any CPU
223223
{E4ED0537-D1D9-44B6-9212-3096D7C3F7A1}.ReleaseWithoutVsix|Any CPU.Build.0 = Release|Any CPU
224-
{08DD4305-7787-4823-A53F-4D0F725A07F3}.Debug|Any CPU.ActiveCfg = Release|Any CPU
225-
{08DD4305-7787-4823-A53F-4D0F725A07F3}.Debug|Any CPU.Build.0 = Release|Any CPU
224+
{08DD4305-7787-4823-A53F-4D0F725A07F3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
225+
{08DD4305-7787-4823-A53F-4D0F725A07F3}.Debug|Any CPU.Build.0 = Debug|Any CPU
226226
{08DD4305-7787-4823-A53F-4D0F725A07F3}.DebugCodeAnalysis|Any CPU.ActiveCfg = Release|Any CPU
227227
{08DD4305-7787-4823-A53F-4D0F725A07F3}.DebugCodeAnalysis|Any CPU.Build.0 = Release|Any CPU
228228
{08DD4305-7787-4823-A53F-4D0F725A07F3}.DebugWithoutVsix|Any CPU.ActiveCfg = Release|Any CPU
@@ -468,4 +468,7 @@ Global
468468
{14FDEE91-7301-4247-846C-049647BF8E99} = {C2D88962-BD6B-4F11-B914-535B38377962}
469469
{09313E65-7ADB-48C1-AD3A-572020C5BDCB} = {C2D88962-BD6B-4F11-B914-535B38377962}
470470
EndGlobalSection
471+
GlobalSection(ExtensibilityGlobals) = postSolution
472+
SolutionGuid = {556014CF-5B35-4CE5-B3EF-6AB0007001AC}
473+
EndGlobalSection
471474
EndGlobal

appveyor.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
version: '2.5.1.{build}'
1+
version: '2.5.2.{build}'
22
skip_tags: true
33
install:
44
- ps: |

script

src/GitHub.App/Api/ApiClient.cs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,17 @@ public IObservable<Repository> CreateRepository(NewRepository repository, string
4848
return (isUser ? client.Create(repository) : client.Create(login, repository));
4949
}
5050

51+
public IObservable<Repository> ForkRepository(string owner, string name, NewRepositoryFork repository)
52+
{
53+
Guard.ArgumentNotEmptyString(owner, nameof(owner));
54+
Guard.ArgumentNotEmptyString(name, nameof(name));
55+
Guard.ArgumentNotNull(repository, nameof(repository));
56+
57+
var client = gitHubClient.Repository.Forks;
58+
59+
return client.Create(owner, name, repository);
60+
}
61+
5162
public IObservable<PullRequestReview> PostPullRequestReview(
5263
string owner,
5364
string name,
@@ -104,6 +115,11 @@ public IObservable<Gist> CreateGist(NewGist newGist)
104115
return gitHubClient.Gist.Create(newGist);
105116
}
106117

118+
public IObservable<Repository> GetForks(string owner, string name)
119+
{
120+
return gitHubClient.Repository.Forks.GetAll(owner, name);
121+
}
122+
107123
public IObservable<User> GetUser()
108124
{
109125
return gitHubClient.User.Current();
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
using System;
2+
using System.Windows.Input;
3+
using System.Linq.Expressions;
4+
using GitHub.Models;
5+
using GitHub.Services;
6+
using GitHub.Extensions;
7+
8+
namespace GitHub.Commands
9+
{
10+
/// <summary>
11+
/// A proxy <see cref="ICommand"/> that increments a usage counter after executing the command.
12+
/// </summary>
13+
public class UsageTrackingCommand : ICommand
14+
{
15+
readonly ICommand command;
16+
readonly Lazy<IUsageTracker> usageTracker;
17+
readonly Expression<Func<UsageModel.MeasuresModel, int>> counter;
18+
19+
/// <summary>
20+
/// The usage tracker and counter to increment after the target command is executed.
21+
/// </summary>
22+
/// <param name="usageTracker">The usage tracker.</param>
23+
/// <param name="counter">The counter to increment.</param>
24+
/// <param name="command">The target command.</param>
25+
public UsageTrackingCommand(
26+
Lazy<IUsageTracker> usageTracker, Expression<Func<UsageModel.MeasuresModel, int>> counter,
27+
ICommand command)
28+
{
29+
this.command = command;
30+
this.usageTracker = usageTracker;
31+
this.counter = counter;
32+
}
33+
34+
public event EventHandler CanExecuteChanged
35+
{
36+
add { command.CanExecuteChanged += value; }
37+
remove { command.CanExecuteChanged -= value; }
38+
}
39+
40+
public bool CanExecute(object parameter)
41+
{
42+
return command.CanExecute(parameter);
43+
}
44+
45+
public void Execute(object parameter)
46+
{
47+
command.Execute(parameter);
48+
usageTracker.Value.IncrementCounter(counter).Forget();
49+
}
50+
}
51+
}

src/GitHub.App/GitHub.App.csproj

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,19 +205,29 @@
205205
<Reference Include="WindowsBase" />
206206
</ItemGroup>
207207
<ItemGroup>
208+
<Compile Include="Commands\UsageTrackingCommand.cs" />
208209
<Compile Include="Factories\ViewViewModelFactory.cs" />
209210
<Compile Include="Factories\ModelServiceFactory.cs" />
210211
<Compile Include="Models\IssueCommentModel.cs" />
211212
<Compile Include="Models\PullRequestReviewCommentModel.cs" />
212213
<Compile Include="Models\PullRequestDetailArgument.cs" />
214+
<Compile Include="SampleData\ForkRepositoryExecuteViewModelDesigner.cs" />
215+
<Compile Include="SampleData\ForkRepositorySelectViewModelDesigner.cs" />
213216
<Compile Include="Models\PullRequestReviewModel.cs" />
217+
<Compile Include="SampleData\GitServiceDesigner.cs" />
218+
<Compile Include="SampleData\ForkRepositorySwitchViewModelDesigner.cs" />
214219
<Compile Include="SampleData\PullRequestFilesViewModelDesigner.cs" />
215220
<Compile Include="SampleData\PullRequestReviewAuthoringViewModelDesigner.cs" />
216221
<Compile Include="SampleData\PullRequestReviewFileCommentViewModelDesigner.cs" />
217222
<Compile Include="SampleData\PullRequestReviewViewModelDesigner.cs" />
218223
<Compile Include="SampleData\PullRequestUserReviewsViewModelDesigner.cs" />
219224
<Compile Include="Services\EnterpriseCapabilitiesService.cs" />
220225
<Compile Include="Services\GlobalConnection.cs" />
226+
<Compile Include="Services\RepositoryForkService.cs" />
227+
<Compile Include="ViewModels\Dialog\ForkRepositoryExecuteViewModel.cs" />
228+
<Compile Include="ViewModels\Dialog\ForkRepositorySwitchViewModel.cs" />
229+
<Compile Include="ViewModels\Dialog\ForkRepositoryViewModel.cs" />
230+
<Compile Include="ViewModels\Dialog\ForkRepositorySelectViewModel.cs" />
221231
<Compile Include="Services\PullRequestEditorService.cs" />
222232
<Compile Include="Services\TeamExplorerContext.cs" />
223233
<Compile Include="Services\OAuthCallbackListener.cs" />
@@ -393,8 +403,9 @@
393403
</ItemGroup>
394404
<ItemGroup>
395405
<EmbeddedResource Include="Resources.resx">
396-
<Generator>ResXFileCodeGenerator</Generator>
406+
<Generator>PublicResXFileCodeGenerator</Generator>
397407
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
408+
<SubType>Designer</SubType>
398409
</EmbeddedResource>
399410
</ItemGroup>
400411
<ItemGroup>

src/GitHub.App/Models/Account.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ public Account(Octokit.Account account, IObservable<BitmapSource> bitmapSource)
8080

8181
public long PrivateReposInPlan { get; private set; }
8282

83-
public string AvatarUrl { get; private set; }
83+
public string AvatarUrl { get; set; }
8484

8585
public BitmapSource Avatar
8686
{

0 commit comments

Comments
 (0)