-
Notifications
You must be signed in to change notification settings - Fork 238
Where available, use the commit time rather than commit id, for sort #3562
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Where available, use the commit time rather than commit id, for sort #3562
Conversation
65d46c6 to
87ab540
Compare
There was a problem hiding this comment.
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+)-?(.*):?(.*)$)" ); |
There was a problem hiding this comment.
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 ); |
There was a problem hiding this comment.
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 ) ); |
There was a problem hiding this comment.
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.)
87ab540 to
e6f645c
Compare
e6f645c to
438a867
Compare
| double rRangeStop, | ||
| double& rValue ); | ||
|
|
||
| inline QString GetDisplayVersion ( QString str ) { return str.contains ( ':' ) ? str.mid ( 0, str.lastIndexOf ( ':' ) ) : str; } |
There was a problem hiding this comment.
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 ) |
There was a problem hiding this comment.
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.
|
Ack the review request, but I'm away this week, so won't be able to examine until next week. |
|
https://semver.org/#spec-item-10
...I think.... |
|
I might have more time for reviewing before Christmas. |


Short description of changes
As discussed elsewhere, I'd like the
--showallserverssort to use the commit time rather than commit id, where it's available. This means changing theAPP_VERSIONto add the git timestamp to the end and then splitting that off for display purposes. The defineDISPLAYthus 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