Loading fabric_tpa/gitolite.py +25 −1 Original line number Diff line number Diff line Loading @@ -454,6 +454,19 @@ def list_gitolite_repos_str(content: str): yield m.group(1) def _repo_age( repository: str, gitolite_host: str = "cupani.torproject.org", gitolite_remote_repos_dir: str = "/srv/git.torproject.org/repositories/", ): con = Connection(gitolite_host) if not repository.endswith(".git"): repository += ".git" cmd = "sudo -u git git -C %s log --pretty=format:%%at -1" % (gitolite_remote_repos_dir + "/" + repository) logging.info("inspecting repository %s age with: %s", repository, cmd) return int(con.run(cmd, hide=True).stdout) @task def count_repos_categories( con: Connection, Loading @@ -469,6 +482,17 @@ def count_repos_categories( ) total = 0 for category, projects in category_map.items(): if category == "Other": idle = active = 0 for project in projects: age = _repo_age(project) if age >= 2 * 365 * 24 * 60 * 60: # 2 years, in seconds idle += 1 else: active += 1 print("%d %s (idle)" % (idle, category)) print("%d %s (active)" % (active, category)) else: print("%d %s" % (len(projects), category)) total += len(projects) print("%d total" % total) Loading Loading
fabric_tpa/gitolite.py +25 −1 Original line number Diff line number Diff line Loading @@ -454,6 +454,19 @@ def list_gitolite_repos_str(content: str): yield m.group(1) def _repo_age( repository: str, gitolite_host: str = "cupani.torproject.org", gitolite_remote_repos_dir: str = "/srv/git.torproject.org/repositories/", ): con = Connection(gitolite_host) if not repository.endswith(".git"): repository += ".git" cmd = "sudo -u git git -C %s log --pretty=format:%%at -1" % (gitolite_remote_repos_dir + "/" + repository) logging.info("inspecting repository %s age with: %s", repository, cmd) return int(con.run(cmd, hide=True).stdout) @task def count_repos_categories( con: Connection, Loading @@ -469,6 +482,17 @@ def count_repos_categories( ) total = 0 for category, projects in category_map.items(): if category == "Other": idle = active = 0 for project in projects: age = _repo_age(project) if age >= 2 * 365 * 24 * 60 * 60: # 2 years, in seconds idle += 1 else: active += 1 print("%d %s (idle)" % (idle, category)) print("%d %s (active)" % (active, category)) else: print("%d %s" % (len(projects), category)) total += len(projects) print("%d total" % total) Loading