mirror of
https://git.alemi.dev/gitshell.git
synced 2024-11-22 07:24:51 +01:00
fix: merge branch 'dev' into dev
This commit is contained in:
commit
32fdd99840
2 changed files with 32 additions and 1 deletions
3
help
3
help
|
@ -6,7 +6,7 @@ echo " $ new <name> create new repository"
|
|||
echo " $ mirror <url> [name] mirror remote repository"
|
||||
echo " $ upstream <repo> <url> set repository to push to a given remote"
|
||||
echo " $ downstream <repo> <url> set repository to fetch from a given remote"
|
||||
echo " $ sync push and pull all mirrored repositories"
|
||||
echo " $ fetch-mirrors push and pull all mirrored repositories"
|
||||
echo " $ tree <repo> show file tree of repo at HEAD"
|
||||
echo " $ log <repo> show commit log of repo"
|
||||
echo " $ head <repo> <name> change default branch of repository"
|
||||
|
@ -15,5 +15,6 @@ echo " $ owner <repo> [owner] set or unset owner for repository"
|
|||
echo " $ group <repo> [group] set or unset group for repository"
|
||||
echo " $ page <repo> [page] set or unset homepage for repository"
|
||||
echo " $ pic <repo> [href] set or unset picture url for repository"
|
||||
echo " $ update-time force update idle times for all repos"
|
||||
echo " $ show <repo> make repository public"
|
||||
echo " $ hide <repo> hide public repository"
|
||||
|
|
30
update-time
Executable file
30
update-time
Executable file
|
@ -0,0 +1,30 @@
|
|||
#!/usr/bin/env python3
|
||||
|
||||
import os
|
||||
import subprocess
|
||||
from pathlib import Path
|
||||
|
||||
GIT_ROOT = Path(os.environ.get("GIT_ROOT_DIR") or "/srv/git/")
|
||||
|
||||
def update_time(repo: Path) -> str:
|
||||
cmd = ["git", "for-each-ref", "--sort=-authordate", "--count=1", "--format='%(authordate:iso8601)'" ]
|
||||
proc = subprocess.run(cmd, cwd=repo, stdout=subprocess.PIPE)
|
||||
time = proc.stdout.decode().strip()
|
||||
with open(repo / "info" / "web" / "last-modified", "w") as f:
|
||||
f.write(time)
|
||||
return time
|
||||
|
||||
def run_on_all_repos(root: Path):
|
||||
for element in os.listdir(root):
|
||||
full_path = root / element
|
||||
if element.startswith("."):
|
||||
pass # ignore hidden files
|
||||
elif element.endswith(".git"):
|
||||
time = update_time(full_path)
|
||||
print(f"last update for '{element.replace('.git','')}': {time}")
|
||||
elif os.path.isdir(root / element):
|
||||
run_on_all_repos(root / element)
|
||||
|
||||
if __name__ == "__main__":
|
||||
run_on_all_repos(GIT_ROOT)
|
||||
|
Loading…
Reference in a new issue