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