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

Commit 996aac3

Browse files
committed
Display commit count.
1 parent 6165f30 commit 996aac3

File tree

6 files changed

+24
-1
lines changed

6 files changed

+24
-1
lines changed

src/GitHub.App/SampleData/Documents/PullRequestPageViewModelDesigner.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ Depends on #1993
9090
public string SourceBranchDisplayName { get; set; } = "feature/save-drafts";
9191
public string TargetBranchDisplayName { get; set; } = "master";
9292
public IActorViewModel Author { get; set; } = new ActorViewModelDesigner("grokys");
93+
public int CommitCount { get; set; } = 2;
9394
public string Body { get; set; }
9495
public int Number { get; set; } = 1994;
9596
public ILocalRepositoryModel LocalRepository { get; }

src/GitHub.App/ViewModels/Documents/PullRequestPageViewModel.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,9 @@ public PullRequestPageViewModel(
5353
/// <inheritdoc/>
5454
public IActorViewModel CurrentUser { get; private set; }
5555

56+
/// <inheritdoc/>
57+
public int CommitCount { get; private set; }
58+
5659
/// <inheritdoc/>
5760
public IReadOnlyList<IViewModel> Timeline => timeline;
5861

@@ -68,6 +71,7 @@ public async Task InitializeAsync(
6871
{
6972
await base.InitializeAsync(repository, localRepository, model).ConfigureAwait(true);
7073

74+
CommitCount = 0;
7175
currentUserModel = currentUser;
7276
CurrentUser = new ActorViewModel(currentUser);
7377
timeline = new ReactiveList<IViewModel>();
@@ -86,6 +90,7 @@ public async Task InitializeAsync(
8690
{
8791
case CommitModel commit:
8892
commits.Add(new CommitSummaryViewModel(commit));
93+
++CommitCount;
8994
break;
9095
case CommentModel comment:
9196
await AddComment(comment).ConfigureAwait(true);

src/GitHub.Exports.Reactive/ViewModels/Documents/IPullRequestPageViewModel.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,11 @@ namespace GitHub.ViewModels.Documents
1111
/// </summary>
1212
public interface IPullRequestPageViewModel : IPullRequestViewModelBase
1313
{
14+
/// <summary>
15+
/// Gets the number of commits in the pull request.
16+
/// </summary>
17+
int CommitCount { get; }
18+
1419
/// <summary>
1520
/// Gets the pull request's timeline.
1621
/// </summary>

src/GitHub.Resources/Resources.Designer.cs

Lines changed: 9 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/GitHub.Resources/Resources.resx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -860,4 +860,7 @@ https://git-scm.com/download/win</value>
860860
<data name="ReopenPullRequest" xml:space="preserve">
861861
<value>Reopen pull request</value>
862862
</data>
863+
<data name="CommitCountFormat" xml:space="preserve">
864+
<value>{0} commits</value>
865+
</data>
863866
</root>

src/GitHub.VisualStudio.UI/Views/Documents/PullRequestPageView.xaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@
5656
</InlineUIContainer>
5757
<TextBlock FontWeight="Bold" Text="{Binding Author.Login, Mode=OneWay}"/>
5858
wants to merge
59-
<TextBlock FontWeight="Black" Text="{Binding Commits.Count, Mode=OneWay, StringFormat={}{0} commits}"/>
59+
<TextBlock FontWeight="Bold" Text="{Binding CommitCount, Mode=OneWay, StringFormat={x:Static ghfvs:Resources.CommitCountFormat}}"/>
6060
into
6161
<InlineUIContainer BaselineAlignment="Bottom">
6262
<Border CornerRadius="2" Padding="5 0" Background="{DynamicResource GitHubBranchNameBackgroundBrush}">

0 commit comments

Comments
 (0)