-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Straighten revision graph in more cases #10778
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Straighten revision graph in more cases #10778
Conversation
@o-kloster @mstv Merge this and #10637 ? |
These two PRs are orthogonal and work well together. These changes look promising. There are edge cases though - as most of the time... The yellow area is unused space without benefit for the curves of the pink segments. |
I've found a few cases where the PR does not behave as desired. I'll be back with fixes. |
Apart from cases like the following, many parts of the graph clearly look better. 4.0.2 / This PR above The violet segment should be kept straight. There are no nodes in it.
This is not a strict rule IMO. I think a few additional lanes should be accepted. |
Looking at this specific sample, I wonder if we could do this? |
Is is possible to avoid the "bump" on the second lane? It'd allow avoiding all subsequent "bumps"... |
👍 Yes, this would be a valid graph. Though only, because the reason for the "bump" is the node in the left lane. But The following (not occurring) graph would be definitely unclear: Since crossings and junctions cannot clearly be distinguished, your first suggestion is problematic. Anyway, both proposals affect an even lower layer ("lane creation / selection") than this PR ("lane shifting") or #10637 ("segment drawing"). |
Could you file your sign off in a separate PR, please, @o-kloster? |
Fixed in latest update. The rule against increasing the width has been relaxed somewhat.
While I agree, I'm not sure how to formulate this precisely and fear the logic might become complex. It could quickly turn into an optimization problem of width against straightness. As for the need to keep the width in check at all, you can see an example if you run the first version of this PR on |
Done in #10791 |
This example is from a private company repo. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unfinished review
/// If this row is the parent row of <paramref name="segment"/>, returns the segment leading | ||
/// to this row's first parent (if any). Otherwise, returns <paramref name="segment"/>. | ||
/// </summary> | ||
public RevisionGraphSegment FirstParentOrSelf(RevisionGraphSegment segment) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess it should rather be SelfOrFirstParent
in order to keep the segment straight as far as possible.
Only if it ends, take the first parent as continuation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The first parent should only be chosen for the first child. If coming from another child, the segment should not be continued.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess it should rather be
SelfOrFirstParent
in order to keep the segment straight as far as possible. Only if it ends, take the first parent as continuation.
Are you arguing for just a name change, or for a functionality change? SelfOrFirstParent
and FirstParentOrSelf
are essentially the same, since the segment cannot both continue and have a parent in this row. But I opted for the latter since it returns self also in the case where the segment ends and has no parent segment.
The first parent should only be chosen for the first child.
I considered this. But how do you define the 'first' child segment? By order in the Segments
list? By lane order in the row above (is this the same?)? By distance to the row of the child revision? In each case, I think I can find an example where this would lead to less straightening than desired.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
SelfOrFirstParent
andFirstParentOrSelf
are essentially the same, since the segment cannot both continue and have a parent in this row. But I opted for the latter since it returns self also in the case where the segment ends and has no parent segment.
👍 Thank you for the explanation. I agree.
(From just reading if (segment.Parent != Revision)
, I do not get the meaning without looking into the docs of all these properties. Let's think about inversion and comments later when we have an agreed implementation.)
I was just dropping guesses how to avoid the yellow segment being bent one lane to the right unnecessarily early (resulting in the free lane under the mouse cursor).
The cyan branch is branched from and back to the yellow branch - at least as I read the graph.
The cyan branch should not "attract" the yellow branch (although it would save one bend for the cyan branch without adding one to the yellow branch).
I considered this. But how do you define the 'first' child segment? By order in the Segments list? By lane order in the row above?
👍
The yellow branch is the "first", the cyan one is the "second" and should not be continued with the ancestor.
(is this the same?)
I guess yes. Though this is not guaranteed. It depends on the sorting algorithm. I am experimenting with an (immature) alternative in my private build.
Using GetLaneIndexForSegment()
will be safe and shouldn't be too expensive.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, the above seems to be not caused by this PR. The yellow and the cyan segments share the same lane since they have the same parent.
Since StraightenLanes
operates on single segments, it cannot be detected / avoided not easily.
So I am dropping this part of the request.
This comment was marked as outdated.
This comment was marked as outdated.
Could you show more of the graph? I don't see how to reproduce this. The two leftmost segments (yellow and blue) should have gotten the same lane, since neither connects to the revision of the first row, right? |
This comment was marked as resolved.
This comment was marked as resolved.
- if any affected row becomes wider than the row immediately before the affected rows - if an already straight segment gets bent, or a segment shifting across lanes ends up shifting across more lanes than before
Before: Not more that the width of the row immediately above the changed rows Now: Not more than the max existing width nearby (up to lookahead distance above or below)
37ba8d8
to
ba94923
Compare
In theory yes. But that's not the point. This is just caused by that I prefer a clearer graph where all branches fan out at their parent: 73e6a83
I found it in the GE repo, too, at Current | This PR |
So where are we with this? |
Let's take #10842 first (perhaps after v4.1). Then Open:
|
#10842 has been merged. It calls |
This pull request has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 14 days. It will be closed if no further activity occurs. |
Fixes #5782
Improves on #9050
Proposed changes
Screenshots
Before
After
Test methodology
Test environment(s)
Merge strategy
I agree that the maintainer squash merge this PR (if the commit message is clear).
✒️ I contribute this code under The Developer Certificate of Origin.