Skip to content

Commit b05daaf

Browse files
committed
release stdlib, release_diff will generate diff.md
1 parent f771b53 commit b05daaf

File tree

2 files changed

+28
-3
lines changed

2 files changed

+28
-3
lines changed

packages.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,7 @@ releases = [
149149
"v1.11.9 b2f397a990f0aa88129104d460174339531ee808",
150150
"v1.12.0 eb519fb78ed769c8862577713fd80be882d09457",
151151
"v1.12.1 ee9d1e696a41c68c3e359b824a33795af1d56e86",
152+
"v1.12.2 32c2c1eed5492ab4d7aaa78b74e050fb5d62b3fa",
152153
]
153154

154155
[[packages]]

port/linux/release_diff.py

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import subprocess
12
import os
23
import git
34
import sys
@@ -14,25 +15,48 @@
1415
print("No commit hash specified")
1516
commit_diff = "f8b529a956da57d8623247bea594e65469cac1c5"
1617

18+
tag = commit_diff # 替换为您要使用的标签
19+
output_file = "diff.md" # 替换为您要写入的文件名
20+
21+
f = open(output_file, "w")
22+
1723
# checkout to the commit_diff
1824
repo.git.checkout(commit_diff)
1925
pkgReleases_diff = PackageReleaseList(PACKAGE_RELEASE_PATH)
2026

2127
# checkout master
2228
repo.git.checkout("master")
2329

30+
f.write(f"# Diff from PikaPython {commit_diff}\n")
31+
32+
f.write(f"## package diff\n")
33+
f.write("|package|state|version|\n")
34+
f.write("|---|---|---|\n")
35+
2436
# find new released package and package version
2537
for pkg in pkgReleases.packages:
2638
# find pkg in pkgReleases_diff
2739
pkg_diff = pkgReleases_diff.findPackage(pkg.name)
2840
if None == pkg_diff:
2941
# print("New package: " + pkg.name + pkg.latestVersion().version)
30-
print(f"|{pkg.name}| Create | {pkg.latestVersion().version}|")
42+
out_str = f"|{pkg.name}| Create | {pkg.latestVersion().version}|"
43+
print(out_str)
44+
f.write(out_str + '\n')
3145
continue
3246

3347
pkg_diff = pkgReleases_diff.findPackage(pkg.name)
3448
if pkg_diff.latestVersion().version != pkg.latestVersion().version:
35-
print(
36-
f"|{pkg.name}| Update | {pkg_diff.latestVersion().version} --> {pkg.latestVersion().version}|")
49+
out_str = f"|{pkg.name}| Update | {pkg_diff.latestVersion().version} --> {pkg.latestVersion().version}|"
50+
print(out_str)
51+
f.write(out_str + '\n')
52+
53+
# 构建 git log 命令并调用 subprocess 执行
54+
git_log_cmd = f"git log {tag}..HEAD --pretty=format:%s"
55+
result = subprocess.run(git_log_cmd, stdout=subprocess.PIPE, shell=True)
3756

57+
# 从结果中获取输出并将其写入文件
58+
output_str = result.stdout.decode("utf-8").replace('\n', '\n\n')
59+
f.write('## git diff\n')
60+
f.write(output_str)
61+
f.close()
3862
exit()

0 commit comments

Comments
 (0)