Skip to content

优化检查更新日志的方式#4743

Merged
Glavo merged 1 commit intoHMCL-dev:mainfrom
Glavo:changelog
Nov 2, 2025
Merged

优化检查更新日志的方式#4743
Glavo merged 1 commit intoHMCL-dev:mainfrom
Glavo:changelog

Conversation

@Glavo
Copy link
Member

@Glavo Glavo commented Nov 1, 2025

现在我们只能提供一个 nowchange 和一个 nowpreview 标签,但如果我们想让稳定版 3.7.x 和 3.6.x 更新到不同目标的话,那么我们就无法为 3.6.x 指定最新更新日志。

本 PR 调整了 HMCL 检查更新日志的方式。现在 HMCL 不再依赖 nowchangenowpreview 标签来检查更新日志,而是直接查询目标版本的日志条目。

Copilot AI review requested due to automatic review settings November 1, 2025 13:48
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR refactors the changelog parsing logic in the UpgradeDialog to use HTML data attributes instead of regex pattern matching for version extraction. The changes simplify version identification by relying on structured data-version attributes in the HTML changelog.

  • Removed regex-based version extraction using CHANGELOG_TITLE_PATTERN
  • Replaced manual changelog traversal and version parsing with direct HTML attribute selection
  • Simplified the changelog version comparison logic

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

changelogVersion = extractVersionNumber(node);
if (changelogVersion == null || changelogVersion.compareTo(currentVersion) <= 0) {
String changelogVersion = node.attr("data-version");
if (StringUtils.isBlank(changelogVersion) || currentVersion.compareTo(changelogVersion) >= 0) {
Copy link

Copilot AI Nov 1, 2025

Choose a reason for hiding this comment

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

Type mismatch in compareTo call. currentVersion is a VersionNumber object but changelogVersion is a String. The compareTo method expects a VersionNumber parameter. This will cause a compilation error. Convert changelogVersion to a VersionNumber using VersionNumber.asVersion(changelogVersion) before comparison.

Suggested change
if (StringUtils.isBlank(changelogVersion) || currentVersion.compareTo(changelogVersion) >= 0) {
if (StringUtils.isBlank(changelogVersion) || currentVersion.compareTo(VersionNumber.asVersion(changelogVersion)) >= 0) {

Copilot uses AI. Check for mistakes.
@Glavo Glavo merged commit 49b0a99 into HMCL-dev:main Nov 2, 2025
8 checks passed
@Glavo Glavo deleted the changelog branch November 2, 2025 12:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants