gomi / app.py
soiz1's picture
Update app.py
c97eb56 verified
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)