Update app.py
Browse files
app.py
CHANGED
@@ -1,10 +1,10 @@
|
|
1 |
from huggingface_hub import HfApi
|
2 |
|
3 |
-
#
|
4 |
repo_id = "soiz1/s4s-editor"
|
5 |
-
repo_type = "space"
|
6 |
|
7 |
-
#
|
8 |
exclude = {
|
9 |
"d597f12958d455343f3e615926b940275157dd6a",
|
10 |
"6bcb42f9f3a292e3ee572372ca4dd19054e51b3f"
|
@@ -12,31 +12,34 @@ exclude = {
|
|
12 |
|
13 |
api = HfApi()
|
14 |
|
15 |
-
#
|
16 |
commits = api.list_repo_commits(repo_id=repo_id, repo_type=repo_type)
|
17 |
|
18 |
-
#
|
19 |
files = set()
|
|
|
20 |
for commit in commits:
|
21 |
-
|
22 |
-
if
|
23 |
continue
|
|
|
|
|
24 |
diff = api.get_commit_diff(
|
25 |
repo_id=repo_id,
|
26 |
repo_type=repo_type,
|
27 |
-
revision=
|
28 |
)
|
29 |
-
|
|
|
30 |
for line in diff.splitlines():
|
31 |
if line.startswith("diff --git"):
|
32 |
parts = line.split()
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
print("修正されたファイル一覧(重複除外、指定コミットは除く):")
|
41 |
for f in sorted(files):
|
42 |
print(f)
|
|
|
1 |
from huggingface_hub import HfApi
|
2 |
|
3 |
+
# 対象のスペース
|
4 |
repo_id = "soiz1/s4s-editor"
|
5 |
+
repo_type = "space"
|
6 |
|
7 |
+
# 除外する最初のコミットID
|
8 |
exclude = {
|
9 |
"d597f12958d455343f3e615926b940275157dd6a",
|
10 |
"6bcb42f9f3a292e3ee572372ca4dd19054e51b3f"
|
|
|
12 |
|
13 |
api = HfApi()
|
14 |
|
15 |
+
# コミット履歴を取得
|
16 |
commits = api.list_repo_commits(repo_id=repo_id, repo_type=repo_type)
|
17 |
|
18 |
+
# ファイル一覧(重複除外)
|
19 |
files = set()
|
20 |
+
|
21 |
for commit in commits:
|
22 |
+
commit_id = commit.commit_id
|
23 |
+
if commit_id in exclude:
|
24 |
continue
|
25 |
+
|
26 |
+
# 差分を取得
|
27 |
diff = api.get_commit_diff(
|
28 |
repo_id=repo_id,
|
29 |
repo_type=repo_type,
|
30 |
+
revision=commit_id
|
31 |
)
|
32 |
+
|
33 |
+
# 差分からファイルを抽出
|
34 |
for line in diff.splitlines():
|
35 |
if line.startswith("diff --git"):
|
36 |
parts = line.split()
|
37 |
+
if len(parts) >= 4:
|
38 |
+
a = parts[2][2:] # a/xxx
|
39 |
+
b = parts[3][2:] # b/xxx
|
40 |
+
files.add(a if a == b else a)
|
41 |
+
|
42 |
+
# 結果を表示
|
43 |
+
print("修正されたファイル一覧(除外コミット以外):")
|
|
|
44 |
for f in sorted(files):
|
45 |
print(f)
|