Skip to content

Conversation

@pljones
Copy link
Collaborator

@pljones pljones commented Nov 23, 2025

Short description of changes

As discussed elsewhere, I'd like the --showallservers sort to use the commit time rather than commit id, where it's available. This means changing the APP_VERSION to add the git timestamp to the end and then splitting that off for display purposes. The define DISPLAY thus becomes a call to a method that does the trim.

CHANGELOG: Use the commit time rather than commit id for sort

Context: Fixes an issue?

No.

Does this change need documentation? What needs to be documented and how?

When the docs for the sort on Version are written, they'd need to take this into account.

Status of this Pull Request

Tested locally.

What is missing until this pull request can be merged?

Nothing broke -- existing servers sort exactly the same way as before as they have no timestamp.

Checklist

  • I've verified that this Pull Request follows the general code principles
  • I tested my code and it does what I want
  • My code follows the style guide
  • I waited some time after this Pull Request was opened and all GitHub checks completed without errors.
  • I've filled all the content above

@pljones pljones added this to the Release 3.12.0 milestone Nov 23, 2025
@pljones pljones added this to Tracking Nov 23, 2025
@pljones pljones added the feature request Feature request label Nov 23, 2025
@github-project-automation github-project-automation bot moved this to Triage in Tracking Nov 23, 2025
@pljones pljones moved this from Triage to Waiting on Team in Tracking Nov 23, 2025
@pljones pljones requested review from ann0see and softins November 23, 2025 12:08
@pljones pljones force-pushed the feature/sort-commits-by-timestamp branch 2 times, most recently from 65d46c6 to 87ab540 Compare November 23, 2025 12:16
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

APP_VERSION passed around in the protocol messages, to retain the full string.


// Regex for SemVer: major.minor.patch-suffix
QRegularExpression semVerRegex ( R"(^(\d+)\.(\d+)\.(\d+)-?(.*)$)" );
QRegularExpression semVerRegex ( R"(^(\d+)\.(\d+)\.(\d+)-?(.*):?(.*)$)" );
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Capture seconds since epoch if present.

.arg ( patch, 3, 10, QLatin1Char ( '0' ) )
.arg ( x )
.arg ( suffix );
.arg ( tstamp.isEmpty() ? suffix : tstamp );
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Use seconds since epoch, rather than commit id, if present.

if ( pCurListViewItem )
{
pCurListViewItem->setText ( LVC_VERSION, strVersion );
pCurListViewItem->setText ( LVC_VERSION, GetDisplayVersion ( strVersion ) );
Copy link
Collaborator Author

@pljones pljones Nov 23, 2025

Choose a reason for hiding this comment

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

As this method gets passed the protocol version (APP_VERSION), it needs to call GetDisplayVersion to retain existing display behaviour.

(Also note this only gets called once each time the server is seen, not on every refresh.)

@pljones pljones force-pushed the feature/sort-commits-by-timestamp branch from 87ab540 to e6f645c Compare November 23, 2025 14:38
@pljones pljones force-pushed the feature/sort-commits-by-timestamp branch from e6f645c to 438a867 Compare November 23, 2025 14:46
double rRangeStop,
double& rValue );

inline QString GetDisplayVersion ( QString str ) { return str.contains ( ':' ) ? str.mid ( 0, str.lastIndexOf ( ':' ) ) : str; }
Copy link
Collaborator Author

@pljones pljones Nov 23, 2025

Choose a reason for hiding this comment

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

GetDisplayVersion strips the seconds since epoch, where present.

str.mid ( 0, str.lastIndexOf ( ':' ) ) for Qt 5 compatibility.

// version and application name (use version from qt prject file)
#undef VERSION
#define VERSION APP_VERSION
#define VERSION GetDisplayVersion ( APP_VERSION )
Copy link
Collaborator Author

@pljones pljones Nov 23, 2025

Choose a reason for hiding this comment

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

GetDisplayVersion ( APP_VERSION ) used where APP_VERSION is currently referenced by this define, in existing code. APP_VERSION wasn't referenced anywhere directly except here before.

@pljones
Copy link
Collaborator Author

pljones commented Nov 23, 2025

Example from build that displays version but hasn't had this update, where a server is running that has got this update:
image

Example from a build that displays version and has this update, for the same server (compared with the above):
image

@pljones pljones self-assigned this Nov 23, 2025
@softins
Copy link
Member

softins commented Nov 23, 2025

Ack the review request, but I'm away this week, so won't be able to examine until next week.

@pljones
Copy link
Collaborator Author

pljones commented Nov 28, 2025

https://semver.org/#spec-item-10
Actually, reading that:

  1. It reckons we shouldn't take any of it into account
  2. I should have used dot not colon

...I think....

@ann0see
Copy link
Member

ann0see commented Nov 28, 2025

I might have more time for reviewing before Christmas.

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

Labels

feature request Feature request

Projects

Status: Waiting on Team

Development

Successfully merging this pull request may close these issues.

3 participants