mirror of
https://github.com/sourcegit-scm/sourcegit
synced 2025-05-20 19:55:00 +00:00
feature: add an indicator that shows those commits the current branch ahead/behind its upstream
This commit is contained in:
parent
9de2853003
commit
f0649c95b5
12 changed files with 180 additions and 194 deletions
|
@ -784,8 +784,20 @@ namespace SourceGit.ViewModels
|
|||
limits += "--branches --remotes --tags";
|
||||
}
|
||||
|
||||
var commits = new Commands.QueryCommits(FullPath, limits).Result();
|
||||
var graph = Models.CommitGraph.Parse(commits);
|
||||
var canPushCommits = new HashSet<string>();
|
||||
var canPullCommits = new HashSet<string>();
|
||||
var currentBranch = Branches.Find(x => x.IsCurrent);
|
||||
if (currentBranch != null)
|
||||
{
|
||||
foreach (var sha in currentBranch.TrackStatus.Ahead)
|
||||
canPushCommits.Add(sha);
|
||||
|
||||
foreach (var sha in currentBranch.TrackStatus.Behind)
|
||||
canPullCommits.Add(sha);
|
||||
}
|
||||
|
||||
var commits = new Commands.QueryCommits(_fullpath, limits).Result();
|
||||
var graph = Models.CommitGraph.Parse(commits, canPushCommits, canPullCommits);
|
||||
|
||||
Dispatcher.UIThread.Invoke(() =>
|
||||
{
|
||||
|
@ -1244,7 +1256,7 @@ namespace SourceGit.ViewModels
|
|||
var fastForward = new MenuItem();
|
||||
fastForward.Header = new Views.NameHighlightedTextBlock("BranchCM.FastForward", upstream);
|
||||
fastForward.Icon = App.CreateMenuIcon("Icons.FastForward");
|
||||
fastForward.IsEnabled = !string.IsNullOrEmpty(branch.UpstreamTrackStatus) && branch.UpstreamTrackStatus.IndexOf('↑') < 0;
|
||||
fastForward.IsEnabled = branch.TrackStatus.Ahead.Count == 0;
|
||||
fastForward.Click += (_, e) =>
|
||||
{
|
||||
if (PopupHost.CanCreatePopup())
|
||||
|
@ -1295,7 +1307,7 @@ namespace SourceGit.ViewModels
|
|||
var fastForward = new MenuItem();
|
||||
fastForward.Header = new Views.NameHighlightedTextBlock("BranchCM.FastForward", upstream.FriendlyName);
|
||||
fastForward.Icon = App.CreateMenuIcon("Icons.FastForward");
|
||||
fastForward.IsEnabled = !string.IsNullOrEmpty(branch.UpstreamTrackStatus) && branch.UpstreamTrackStatus.IndexOf('↑') < 0;
|
||||
fastForward.IsEnabled = branch.TrackStatus.Ahead.Count == 0;
|
||||
fastForward.Click += (_, e) =>
|
||||
{
|
||||
if (PopupHost.CanCreatePopup())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue