Patch #42762
closedImprove Git/Mercurial revision graph on the repository page
Description
There are several issues with the revision graph on the repository page:
1. When multiple branches point to the same set of commits, the revision graph canvas unnecessarily expands in width.

2. If branch "A" points to an older commit and branch "B" points to a newer commit, the newer section of the revision graph shifts to the right.

3. Orphan commits on the page (for example, when the head was on a previous page) are always shown in the first column.

4. The curves connecting commits on different branches make it hard to identify which commits are connected, especially when several commits exist between the connected ones on the branches (#10954).

This patch series resolves these issues by modifying commit indexing and the curves on the graph:
- Heads are no longer indexed if the referenced commit has already been visited, addressing issue 1.

- Indexing always starts with the latest commit on the page, followed by the heads present on the page, and finally the orphan commits on the page, fixing issues 2 and 3.

- The new curves connect from the left or right side to commits that already have vertical connections, and from the top or bottom to the last or first commit on a branch, respectively.

Parent commit for patch series - 41d1057 from GitHub mirror.
Files
Updated by Leonid Murin 19 days ago
Rebased the patch series to the current master.
Parent commit for patch series - af3a49b59de64f5e249cf2a636ebe981c3922029 from GitHub mirror.
Updated by Go MAEDA 13 days ago
- File 0001-Fix-revision-graph-canvas-width-calculation-on-repos.patch 0001-Fix-revision-graph-canvas-width-calculation-on-repos.patch added
- File 0002-Change-the-way-commits-are-indexed-for-revision-grap.patch 0002-Change-the-way-commits-are-indexed-for-revision-grap.patch added
- File 0003-Change-the-shape-of-curves-connecting-commits-across.patch 0003-Change-the-shape-of-curves-connecting-commits-across.patch added
I split the single patch file (v2_01_revision_graph.patch) into three patches.
Updated by Go MAEDA 12 days ago
- File git_repository.tar.gz git_repository.tar.gz added
- File revision-graph-current@2x.png revision-graph-current@2x.png added
- File revision-graph-with-patch@2x.png revision-graph-with-patch@2x.png added
Thank you for improving the repository browser.
After applying the patch, I noticed that the revision graph differs significantly from the current behavior. Do you know why this happens?
I tested this using the attached Git repository.
Current behavior:
With the patch applied:
Updated by Leonid Murin 12 days ago
I see the same structure as the one "with patch" in Redmine on the current master branch (c2cab7da79eb2b1836d71d828c1bb31ce842fcd4).

The git log command also shows the same structure.
> git log master-20120212 --graph --format=format:'%h %s' * b1650ea Edit new_file.txt by a long author * 83ca5fd Add a filename with a leading and trailing whitespace * ed5bb78 Add a filename with spaces in its name * 4f26664 Added a file with a really long path. * deff712 Exercising all the file actions * 32ae898 Resolved conflicts from feature merge |\ | * 7e61ac7 Added a great new feature to this feature branch | * fba357b Added a new file that will only appear in test_branch | * 713f494 Updated README to reflect that this is a git repository, not mercurial * | 4a07fe3 Making progress in the master branch |/ * 61b685f 2 files modified. * 2f9c009 Changed user variable to watcher * 4a79347 Removed one file * 3621194 Modified one file * 899a15d Added 2 files and modified one. * 7234cb2 Initial import. The repository contains 3 files.
According to your screenshot, commits b1650eac, 83ca5fd5, and 4a07fe31 are merge commits. But in the attached repository, each has only one parent.
Maybe you had outdated or incorrect data in the database, and when you began testing the patches, it was updated with actual data from Git.
Note: I am testing this on Ubuntu 22.04 and had to remove the ._* files and rename branches containing Ü to get the repository working.