Project

General

Profile

Actions

Patch #42762

closed

Improve Git/Mercurial revision graph on the repository page

Added by Leonid Murin 8 months ago. Updated 2 days ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
SCM
Target version:
Start date:
Due date:
% Done:

0%

Estimated time:

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

clipboard-202505221356-bjpqh.png (5.36 KB) clipboard-202505221356-bjpqh.png Leonid Murin, 2025-05-22 12:56
clipboard-202505221357-fbenr.png (14.2 KB) clipboard-202505221357-fbenr.png Leonid Murin, 2025-05-22 12:57
clipboard-202505221358-3ap5o.png (126 KB) clipboard-202505221358-3ap5o.png Leonid Murin, 2025-05-22 12:58
clipboard-202505221358-tb4dl.png (58.2 KB) clipboard-202505221358-tb4dl.png Leonid Murin, 2025-05-22 12:58
clipboard-202505221359-e75ot.png (45.3 KB) clipboard-202505221359-e75ot.png Leonid Murin, 2025-05-22 12:59
clipboard-202505221402-dsraj.png (4.65 KB) clipboard-202505221402-dsraj.png Leonid Murin, 2025-05-22 13:02
clipboard-202505221403-votpv.png (11.3 KB) clipboard-202505221403-votpv.png Leonid Murin, 2025-05-22 13:03
clipboard-202505221403-btebg.png (127 KB) clipboard-202505221403-btebg.png Leonid Murin, 2025-05-22 13:03
clipboard-202505221403-qnn56.png (38.9 KB) clipboard-202505221403-qnn56.png Leonid Murin, 2025-05-22 13:03
v1_01_fix_revision_graph.patch (7.88 KB) v1_01_fix_revision_graph.patch Leonid Murin, 2025-05-22 13:06
v2_01_revision_graph.patch (7.88 KB) v2_01_revision_graph.patch Leonid Murin, 2025-12-19 13:25
0001-Fix-revision-graph-canvas-width-calculation-on-repos.patch (1.09 KB) 0001-Fix-revision-graph-canvas-width-calculation-on-repos.patch Go MAEDA, 2025-12-25 11:12
0002-Change-the-way-commits-are-indexed-for-revision-grap.patch (1.69 KB) 0002-Change-the-way-commits-are-indexed-for-revision-grap.patch Go MAEDA, 2025-12-25 11:13
0003-Change-the-shape-of-curves-connecting-commits-across.patch (4.96 KB) 0003-Change-the-shape-of-curves-connecting-commits-across.patch Go MAEDA, 2025-12-25 11:13
git_repository.tar.gz (24.5 KB) git_repository.tar.gz Go MAEDA, 2025-12-26 02:36
revision-graph-current@2x.png (435 KB) revision-graph-current@2x.png Go MAEDA, 2025-12-26 02:36
revision-graph-with-patch@2x.png (427 KB) revision-graph-with-patch@2x.png Go MAEDA, 2025-12-26 02:36
clipboard-202512261142-gf0ph.png (186 KB) clipboard-202512261142-gf0ph.png Leonid Murin, 2025-12-26 09:42
Actions #1

Updated by Leonid Murin 19 days ago

Rebased the patch series to the current master.

Parent commit for patch series - af3a49b59de64f5e249cf2a636ebe981c3922029 from GitHub mirror.

Actions #2

Updated by Go MAEDA 14 days ago

  • Target version set to Candidate for next major release
Actions #4

Updated by Go MAEDA 12 days ago

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:

Actions #5

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.

Actions #6

Updated by Go MAEDA 9 days ago

Leonid Murin wrote in #note-5:

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.

Sorry, you are right, maybe my test environment had some problems. Now I got the same result as your screenshot in #note-5.

Actions #7

Updated by Go MAEDA 9 days ago

  • Target version changed from Candidate for next major release to 7.0.0

Setting the target version to 7.0.0.

Actions #8

Updated by Go MAEDA 2 days ago

  • Status changed from New to Closed
  • Assignee set to Go MAEDA

Committed the patches in r24256, r24257, and r24258.

Thank you for your contribution.

Actions

Also available in: Atom PDF