feature: add an indicator that shows those commits the current branch ahead/behind its upstream

This commit is contained in:
leo 2024-07-19 09:29:16 +08:00
parent 9de2853003
commit f0649c95b5
No known key found for this signature in database
12 changed files with 180 additions and 194 deletions

View file

@ -128,7 +128,7 @@ namespace SourceGit.Models
_penCount = colors.Count;
}
public static CommitGraph Parse(List<Commit> commits)
public static CommitGraph Parse(List<Commit> commits, HashSet<string> canPushCommits, HashSet<string> canPullCommits)
{
double UNIT_WIDTH = 12;
double HALF_WIDTH = 6;
@ -148,6 +148,9 @@ namespace SourceGit.Models
var isMerged = commit.IsMerged;
var oldCount = unsolved.Count;
commit.CanPushToUpstream = canPushCommits.Remove(commit.SHA);
commit.CanPullFromUpstream = !commit.CanPushToUpstream && canPullCommits.Remove(commit.SHA);
// Update current y offset
offsetY += UNIT_HEIGHT;