Skip to content

Conversation

mstv
Copy link
Member

@mstv mstv commented Jan 14, 2023

Fixes #5782
Inspired by @spdr870's PoC

Proposed changes

  • Render graph with diagonal lines
  • Straighten multi-lane crossings by turning into diagonals
  • Unfold one-lane shifts to diagonals
  • Join multi-lane crossings
  • Both options are active by default - but only as "Experimental" settings.

Screenshots

Before / After

image image image image

image image

Test methodology

  • used for long time in private builds
  • adapted existing test cases
  • several new test cases

Merge strategy

Please do not squash merge this PR!


✒️ I contribute this code under The Developer Certificate of Origin.

@mstv mstv self-assigned this Jan 14, 2023
@mstv mstv marked this pull request as draft January 14, 2023 00:14
@RussKie
Copy link
Member

RussKie commented Jan 14, 2023 via email

@mstv
Copy link
Member Author

mstv commented Jan 14, 2023

This a draft PoC. I wanted to know whether it is worth the effort to smooth the kinks or whether I rather should not bother you with this again.

image

@gerhardol
Copy link
Member

+1 from me
Have been using this occasionally too.

@RussKie
Copy link
Member

RussKie commented Jan 14, 2023

I wanted to know whether it is worth the effort to smooth the kinks or whether I rather should not bother you with this again.

We all have likes and dislikes :) And if others like this way better - we'll have it, especially since there's an option to turn it off.

@mstv mstv force-pushed the feature/less_curves branch from 5e9eee6 to c801303 Compare February 9, 2023 00:24
@mstv
Copy link
Member Author

mstv commented Feb 9, 2023

Any progress?

yes, @xnousnow

@mstv mstv changed the title PoC: Render graph lines with less curves Render graph lines with less curves Feb 19, 2023
@mstv mstv marked this pull request as ready for review February 19, 2023 01:05
mstv added a commit to mstv/gitextensions that referenced this pull request Feb 19, 2023
mstv added a commit to mstv/gitextensions that referenced this pull request Feb 19, 2023
mstv added a commit to mstv/gitextensions that referenced this pull request Feb 19, 2023
@mstv mstv force-pushed the feature/less_curves branch from 79d8f72 to 021e445 Compare February 19, 2023 01:05
mstv added a commit to mstv/gitextensions that referenced this pull request Feb 20, 2023
@mstv mstv force-pushed the feature/less_curves branch from 021e445 to 71f0363 Compare February 20, 2023 20:43
mstv added a commit to mstv/gitextensions that referenced this pull request Feb 20, 2023
- do not shift direct connection of nodes in neighbor lanes
- remove leftover comment
mstv added a commit to mstv/gitextensions that referenced this pull request Mar 3, 2023
mstv added a commit to mstv/gitextensions that referenced this pull request Mar 6, 2023
mstv added a commit to mstv/gitextensions that referenced this pull request Mar 6, 2023
mstv added a commit to mstv/gitextensions that referenced this pull request Mar 6, 2023
mstv added a commit to mstv/gitextensions that referenced this pull request Mar 6, 2023
@RussKie
Copy link
Member

RussKie commented Mar 11, 2023

Before / After

image image image image

Are these reflecting the latest state?

@RussKie RussKie added the 📭 needs: author feedback More info/confirmation awaited from OP; issues typically get closed after 30 days of inactivity label Mar 11, 2023
@mstv
Copy link
Member Author

mstv commented Mar 11, 2023

Are these reflecting the latest state?

Yes, they are. The drawing of the graph is ready for review.
(In a follow-up, I am going to turn multi-lane crossings into "diagonals": 13776d6. This is done in the same lower layer as #10778. I.e. it is an independent change.)

Open points (not affecting the graph):

  • Avoid often instantiation of SegmentDrawer perhaps as in a44f5a8? Code smell "static instance" though.
  • AppSettings.ReduceGraphCurves to be added to a settings page?

@ghost ghost removed the 📭 needs: author feedback More info/confirmation awaited from OP; issues typically get closed after 30 days of inactivity label Mar 11, 2023
@mstv mstv force-pushed the feature/less_curves branch from 71f0363 to 3c71896 Compare March 11, 2023 12:54
gerhardol pushed a commit to gerhardol/gitextensions that referenced this pull request Mar 12, 2023
Copy link
Member

@RussKie RussKie left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:shipit:

@RussKie
Copy link
Member

RussKie commented Feb 16, 2024

We probably should move all graph related settings on their own dedicated page but in a separate PR :)

mstv added a commit to mstv/gitextensions that referenced this pull request Feb 18, 2024
mstv added a commit to mstv/gitextensions that referenced this pull request Feb 18, 2024
by turning into diagonals
and unfold one-lane shifts to diagonals
mstv added a commit to mstv/gitextensions that referenced this pull request Feb 18, 2024
@mstv mstv force-pushed the feature/less_curves branch from b938e20 to ebf97ac Compare February 18, 2024 11:30
mstv added a commit to mstv/gitextensions that referenced this pull request Feb 18, 2024
mstv added a commit to mstv/gitextensions that referenced this pull request Feb 18, 2024
by turning into diagonals
and unfold one-lane shifts to diagonals
mstv added a commit to mstv/gitextensions that referenced this pull request Feb 18, 2024
@mstv mstv force-pushed the feature/less_curves branch from ebf97ac to f6a5f4b Compare February 18, 2024 11:33
mstv added a commit to mstv/gitextensions that referenced this pull request Feb 18, 2024
mstv added a commit to mstv/gitextensions that referenced this pull request Feb 18, 2024
by turning into diagonals
and unfold one-lane shifts to diagonals
mstv added a commit to mstv/gitextensions that referenced this pull request Feb 18, 2024
@mstv mstv force-pushed the feature/less_curves branch from f6a5f4b to 7a7c62f Compare February 18, 2024 11:48
@mstv mstv force-pushed the feature/less_curves branch from 7a7c62f to 778b6fd Compare February 18, 2024 12:02
@mstv mstv merged commit 778b6fd into gitextensions:master Feb 18, 2024
@mstv mstv deleted the feature/less_curves branch February 18, 2024 12:03
@pmiossec
Copy link
Member

pmiossec commented Feb 18, 2024

@mstv Can the verify.txt files be renamed to be shorter?

Because there is for example the file UnitTests\GitUI.Tests\UserControls\RevisionGrid\Graph\RevisionGraphTests.UnfoldOneLaneShiftsToDiagonals_commitSpecs=0-D,1,2,3,4,5,6,B,8,9,7 1-D 2-D 3-E 4-E 5-C 6-C 7-G 8-9 9-A A-B B-C C-F D-R E-F F-R G-H H-R R.verified.txt which is 223 characters long and it will be painful for everyone to handle (and especially the new contributors as I think that cloning will probably fail).

As a consequence, I can't do anything with master due to error:

error: cannot stat 'UnitTests/GitUI.Tests/UserControls/RevisionGrid/Graph/RevisionGraphTests.UnfoldOneLaneShiftsToDiagonals_commitSpecs=0-D,1,2,3,4,5,6,B,8,9,7 1-D 2-D 3-E 4-E 5-C 6-C 7-G 8-9 9-A A-B B-C C-F D-R E-F F-R G-H H-R R.verified.txt': Filename too long

@mstv
Copy link
Member Author

mstv commented Feb 18, 2024

Can the verify.txt files be renamed to be shorter?

I am the wrong addressee. I have not pursued the switch to it (and I am not 100% convinced of it. E.g. comments cannot be added in place).

which is 223 characters long and it will be painful for everyone to handle

Which kind of problems other than MSYS Git issues? I have never noticed any - and I have rebased these commits many times and have checked them out on a few machines. Though in my checkout, the pathname does not exceed 260 characters.
Perhaps git config --global core.longpaths true helps (refer to https://stackoverflow.com/questions/22575662/filename-too-long-in-git-for-windows)

@RussKie
Copy link
Member

RussKie commented Feb 18, 2024

I can the see the point of renaming this test, it is long and can cause some issues.
Verify tests allow customisation of the test names. I'd go with https://github.com/VerifyTests/Verify/blob/main/docs/naming.md#testclassname, e.g. something like:

        [Test]
        [TestCase("0:1,4 1:2 2:R,3 3:R 4:R R", "case1")]
        [TestCase("0:1,R 1:2,R 2:4,3 3:R 4:5,8 5:6 6:7,R 7:R,R 8:9 9:R R", "case2")]
        [TestCase("0:D,1,2,3,4,5,6,B,8,9,7 1:D 2:D 3:E 4:E 5:C 6:C 7:G 8:9 9:A A:B B:C C:F D:R E:F F:R G:H H:R R", "case3")]
        [TestCase("0:4 1:3,2 2:6 3:8,B 4:5 5:A,6 6:7 7:8 8:C,R 9:A A:B,R B:R C:R R", "case4")]
        public async Task UnfoldOneLaneShiftsToDiagonals(string commitSpecs, string testNameSuffix)
        {
            AppSettings.StraightenGraphDiagonals.Value = true;

            RevisionGraph revisionGraph = CreateGraphTopDown(commitSpecs);

            await VerifyGraphLayoutAsync(revisionGraph, $"{MethodBase.GetCurrentMethod().Name}_{testNameSuffix}");
        }

        private static async Task VerifyGraphLayoutAsync(RevisionGraph revisionGraph, string testNameSuffix)
        {
            string actualGraph = AsciiGraphFor(revisionGraph).Join("\n");
            await Verify(actualGraph)
                .UseMethodName(testNameSuffix);
        }

@RussKie
Copy link
Member

RussKie commented Feb 18, 2024

E.g. comments cannot be added in place

I'm not quite sure I follow, could you please elaborate?

@mstv
Copy link
Member Author

mstv commented Feb 19, 2024

E.g. comments cannot be added in place

I'm not quite sure I follow, could you please elaborate?

Comments like the following would benefit from having the ASCII graph in the code - but not in a dedicated file.

        // Do not move the right lane of row 2.
        [TestCase("0:1,5 1:2   2:R,3 3:R,4 4:R   5:R R")]
        // Do not move the right lanes of row 6.
        [TestCase("0:1,R 1:2,R 2:4,3 3:R   4:5,R 5:6   6:7   7:8,R 8:9 9:R R")]
        // Do not move the right lanes of row 4.
        [TestCase("0:1,R 1:2,R 2:4,3 3:R 4:5,8 5:6,R 6:7,R 7:R,R 8:9 9:R R")]
        // Do not move segment 4:8 at row 6 & 5.
        [TestCase("0:5,1,2,3,4 1:5 2:5 3:6 4:8 5:R 6:7 7:8,B 8:9 9:R,A A:R   B:R     R")]
        // Do not move segment 7:B at row 9.
        [TestCase("0:5,1,2,3,4 1:5 2:5 3:6 4:8 5:R 6:7 7:8,B 8:9 9:R,A A:R,C B:R C:R R")]

Though since I do not expect many further changes to the graph rendering, this does not matter very much.

@mstv
Copy link
Member Author

mstv commented Feb 20, 2024

While adapting #11594, a file was created which exceeded the 260 characters limit.
git config --global core.longpaths true indeed made git clean work again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Readability revision graph
4 participants