Skip to content

Conversation

@mbien
Copy link
Member

@mbien mbien commented Jan 9, 2026

To get a git log for a file, history entries can't be simply sorted by date. Common actions like rebase may change commit order, commits could also have the same commit date and still be valid etc.

This change adds a position field to the fetched history entries which is now used in the UI comparator instead of dates.

Comparisons between local and git history items still use timestamps.

first commit has the modifications, second is for cleanup in related files.

reproducer:

  1. init git repo with 3 commits: INIT, B and A
    • (changes of A and B should not be in conflict so that commit order can be easily changed)
  2. rebase the last two commits and swap B with A
  3. git log should show INIT, A, B, the NB file history tab will show INIT, B, A which is not the correct log order
    • note: the git ->show history action does always show the correct order, this is about the history mutiview tab

This is a minimal attempt to resolve this issue. UI-wise we should probably do more and swap the revision and date columns (and probably don't allow to sort by date at all).

draft since i have to test this better and I might add a cleanup commit, feedback still welcome

@mbien mbien added this to the NB29 milestone Jan 9, 2026
@mbien mbien added git [ci] enable versioning job ci:dev-build [ci] produce a dev-build zip artifact (7 days expiration, see link on workflow summary page) Code cleanup Label for cleanup done on the Netbeans IDE labels Jan 9, 2026
@mbien mbien force-pushed the git-file-history-order branch from 6de5430 to 55dc033 Compare January 11, 2026 07:04
@mbien mbien marked this pull request as ready for review January 11, 2026 07:06
@ebarboni ebarboni self-requested a review January 16, 2026 12:55
Copy link
Contributor

@ebarboni ebarboni left a comment

Choose a reason for hiding this comment

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

LGTM, git log and UI are in the same order

@mbien
Copy link
Member Author

mbien commented Jan 16, 2026

this is currently breaking the date column ordering of subversion repos. Will need another pass.

@mbien mbien marked this pull request as draft January 16, 2026 16:41
@mbien mbien force-pushed the git-file-history-order branch from 55dc033 to a92363b Compare January 20, 2026 10:01
@mbien
Copy link
Member Author

mbien commented Jan 20, 2026

that was just a rebase with no other changes. will add a fix for SVN/HG later. Is fairly trivial.

mbien added 2 commits January 20, 2026 11:49
To get a git log for a file, history entries can't be simply sorted by
date. Common actions like rebase may change commit order, commits could
also have the same commit date and still be valid etc.

This change adds a position field to the fetched history entries which
is now used in the UI comparator instead of dates.

Comparisons between local and git history items still use timestamps.

Update SVN/HG history provider to return file history without order
randomization (trivial HashMap -> LinkedHashMap change).
javac fixes, dead code removal, language updates and other minor
improvements.
@mbien mbien force-pushed the git-file-history-order branch from a92363b to 08991c5 Compare January 20, 2026 10:57
@mbien
Copy link
Member Author

mbien commented Jan 20, 2026

change was squashed into the first commit: diff: https://github.com/apache/netbeans/compare/a92363b67dbb43de5e3edb7bd78f101a5739cae5..08991c59f4f88c8ffeb70f5ed78a45408f04575c

msg:

Update SVN/HG history provider to return file history without order randomization (trivial HashMap -> LinkedHashMap change).

@mbien mbien marked this pull request as ready for review January 20, 2026 10:59
@mbien
Copy link
Member Author

mbien commented Jan 20, 2026

all green, manually tested file history for a SVN and HG project and it worked

thanks for the review! -> merging for NB 29

@mbien mbien merged commit 2b7d64f into apache:master Jan 20, 2026
59 of 60 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci:dev-build [ci] produce a dev-build zip artifact (7 days expiration, see link on workflow summary page) Code cleanup Label for cleanup done on the Netbeans IDE git [ci] enable versioning job

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants