Skip to content
This repository was archived by the owner on Mar 6, 2024. It is now read-only.

Commit b50f838

Browse files
committed
feat: add commit info
1 parent 7d90241 commit b50f838

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

bin/package.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,9 @@ def package(os_name):
2424
with open('./src/main/resources/gitinfo', 'w+', encoding='utf-8') as fw:
2525
branch = os.popen('git symbolic-ref --short -q HEAD').read().replace('\n', '')
2626
last_commit = os.popen('git rev-parse --short HEAD').read().replace('\n', '')
27-
fw.write("%s:%s" % (branch, last_commit))
27+
date = os.popen('git log --pretty=format:"%%ct" %s -1' % last_commit).read().replace('\n', '')
28+
info = os.popen('git log --pretty=format:"%%s" %s -1' % last_commit).read().replace('\n', '')
29+
fw.write("%s:%s:%s:%s" % (branch, last_commit, date, info))
2830

2931
package('win')
3032
package('mac')

src/main/java/org/code4everything/wetool/controller/MainController.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,7 @@ private void registerActions() {
229229
registerAction("检查更新-checkforupdate", actionEvent -> checkUpdate());
230230
registerAction("隐藏-hide", actionEvent -> FxUtils.hideStage());
231231
registerAction("插件仓库-pluginrepository", actionEvent -> FxUtils.openLink(TipConsts.REPO_LINK));
232+
registerAction("关于-about", event -> about());
232233

233234
// 注册模式匹配动作
234235
registerAction("hutool *", hutoolCmdHandler);
@@ -627,11 +628,15 @@ public void about() {
627628
String gitInfo = StrUtil.trim(ResourceUtil.readUtf8Str("gitinfo"));
628629
String aboutApp = TipConsts.ABOUT_APP;
629630
if (StrUtil.isNotEmpty(gitInfo) && !StrUtil.startWith(gitInfo, "master")) {
630-
List<String> infos = StrUtil.splitTrim(gitInfo, ":");
631+
List<String> infos = StrUtil.splitTrim(gitInfo, ":", 4);
631632
aboutApp += "\r\n开发版分支:" + infos.get(0);
632633
if (infos.size() > 1) {
633634
aboutApp += ",提交:" + infos.get(1);
634635
}
636+
if (infos.size() > 3) {
637+
aboutApp += "\r\n提交信息:" + infos.get(3);
638+
aboutApp += "\r\n\r\n提交日期:" + DateUtil.formatDateTime(DateUtil.date(Long.parseLong(infos.get(2)) * 1000));
639+
}
635640
aboutApp += "\r\n";
636641
}
637642
FxDialogs.showInformation(TitleConsts.ABOUT_APP, aboutApp);

0 commit comments

Comments
 (0)