mirror of
https://github.com/sourcegit-scm/sourcegit
synced 2025-05-22 20:54:59 +00:00
code_review: PR #386
* rename `FirstParentFilterToggled` to `EnableFirstParentInHistories` * remove `FirstParentFilterEnabled` from repo settings - it should not been saved * move toggle button from repository toolbar to histories switcher * tooltip translations * new icon for `Icons.FirstParentFilter` * extends commit graph to support `--first-parent` option
This commit is contained in:
parent
acf0a486d7
commit
323dc2e87f
9 changed files with 56 additions and 59 deletions
|
@ -128,7 +128,7 @@ namespace SourceGit.Models
|
|||
_penCount = colors.Count;
|
||||
}
|
||||
|
||||
public static CommitGraph Parse(List<Commit> commits)
|
||||
public static CommitGraph Parse(List<Commit> commits, bool firstParentOnlyEnabled)
|
||||
{
|
||||
double UNIT_WIDTH = 12;
|
||||
double HALF_WIDTH = 6;
|
||||
|
@ -215,34 +215,37 @@ namespace SourceGit.Models
|
|||
temp.Dots.Add(new Dot() { Center = position, Color = 0 });
|
||||
}
|
||||
|
||||
// Deal with parents
|
||||
for (int j = 1; j < commit.Parents.Count; j++)
|
||||
// Deal with other parents (the first parent has been processed)
|
||||
if (!firstParentOnlyEnabled)
|
||||
{
|
||||
var parent = commit.Parents[j];
|
||||
if (mapUnsolved.TryGetValue(parent, out var value))
|
||||
for (int j = 1; j < commit.Parents.Count; j++)
|
||||
{
|
||||
// Try to change the merge state of linked graph
|
||||
var l = value;
|
||||
if (isMerged)
|
||||
l.IsMerged = true;
|
||||
var parent = commit.Parents[j];
|
||||
if (mapUnsolved.TryGetValue(parent, out var value))
|
||||
{
|
||||
// Try to change the merge state of linked graph
|
||||
var l = value;
|
||||
if (isMerged)
|
||||
l.IsMerged = true;
|
||||
|
||||
var link = new Link();
|
||||
link.Start = position;
|
||||
link.End = new Point(l.LastX, offsetY + HALF_HEIGHT);
|
||||
link.Control = new Point(link.End.X, link.Start.Y);
|
||||
link.Color = l.Path.Color;
|
||||
var link = new Link();
|
||||
link.Start = position;
|
||||
link.End = new Point(l.LastX, offsetY + HALF_HEIGHT);
|
||||
link.Control = new Point(link.End.X, link.Start.Y);
|
||||
link.Color = l.Path.Color;
|
||||
|
||||
temp.Links.Add(link);
|
||||
}
|
||||
else
|
||||
{
|
||||
offsetX += UNIT_WIDTH;
|
||||
temp.Links.Add(link);
|
||||
}
|
||||
else
|
||||
{
|
||||
offsetX += UNIT_WIDTH;
|
||||
|
||||
// Create new curve for parent commit that not includes before
|
||||
var l = new PathHelper(commit.Parents[j], isMerged, colorIdx, position, new Point(offsetX, position.Y + HALF_HEIGHT));
|
||||
unsolved.Add(l);
|
||||
temp.Paths.Add(l.Path);
|
||||
colorIdx = (colorIdx + 1) % _penCount;
|
||||
// Create new curve for parent commit that not includes before
|
||||
var l = new PathHelper(parent, isMerged, colorIdx, position, new Point(offsetX, position.Y + HALF_HEIGHT));
|
||||
unsolved.Add(l);
|
||||
temp.Paths.Add(l.Path);
|
||||
colorIdx = (colorIdx + 1) % _penCount;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue