Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
total-contributions: Fix bug that replaced a repo's whole history with nothing.
Greg Pricec4cc27cd205b
diff --git a/tools/total-contributions b/tools/total-contributionsindex d7627f08c47..ff3f8f3df52 100755--- a/tools/total-contributions+++ b/tools/total-contributions@@ -27,9 +27,9 @@ def add_log(committer_dict: Dict[str, int], input: List[str]) -> None:committer_dict[committer_name] += commit_count-def retrieve_log(repo: str, lower_version: str, upper_version: str) -> List[str]:+def retrieve_log(repo: str, revisions: str) -> List[str]:return subprocess.check_output(- ["git", "shortlog", "-s", lower_version + ".." + upper_version],+ ["git", "shortlog", "-s", revisions],cwd=find_path(repo),text=True,).splitlines()@@ -47,15 +47,21 @@ def process_repo(lower_version: str,upper_version: str,) -> None:+ if not lower_version:+ revisions = upper_version+ revisions_display = f"(start)..{upper_version[0:12]}"+ else:+ revisions = f"{lower_version}..{upper_version}"+ revisions_display = f"{lower_version[0:12]}..{upper_version[0:12]}"commit_count = len(subprocess.check_output(- ["git", "log", "--pretty=oneline", f"{lower_version}..{upper_version}"],+ ["git", "log", "--pretty=oneline", revisions],cwd=find_path(repo_short),text=True,).splitlines())- repo_log = retrieve_log(repo_short, lower_version, upper_version)- print(f"{commit_count} commits from {repo_full}: {lower_version[0:12]}..{upper_version[0:12]}")+ repo_log = retrieve_log(repo_short, revisions)+ print(f"{commit_count} commits from {repo_full}: {revisions_display}")add_log(out_dict, repo_log)