Обновить git_analyzer.py
This commit is contained in:
@@ -28,7 +28,6 @@ IGNORE_DIRS = {".git", "__pycache__", "node_modules", ".venv", "venv", "dist", "
|
||||
|
||||
|
||||
def safe_text(value, default=""):
|
||||
"""Безопасно превращает None/числа/странные значения в строку."""
|
||||
if value is None:
|
||||
return default
|
||||
return str(value)
|
||||
@@ -39,9 +38,6 @@ def safe_strip(value, default=""):
|
||||
|
||||
|
||||
def _subprocess_no_window_kwargs():
|
||||
"""Настройки для Windows, чтобы git не открывал отдельные cmd-окна.
|
||||
На Linux/macOS возвращается пустой словарь.
|
||||
"""
|
||||
if os.name != "nt":
|
||||
return {}
|
||||
|
||||
@@ -96,14 +92,10 @@ def run_git_allow_fail(args, cwd=None):
|
||||
|
||||
|
||||
def normalize_link(link):
|
||||
"""Приводит ссылку к git-репозиторию.
|
||||
Можно случайно вставить GitHub release/tree/blob — программа сама обрежет до репы.
|
||||
"""
|
||||
link = safe_strip(link)
|
||||
if not link:
|
||||
raise RuntimeError("Пустая ссылка на репозиторий")
|
||||
|
||||
# Убираем лишний пробел/перенос и хвосты страниц GitHub, которые не являются git repo
|
||||
if "github.com/" in link:
|
||||
before = link
|
||||
proto = ""
|
||||
@@ -112,7 +104,6 @@ def normalize_link(link):
|
||||
proto, rest = rest.split("://", 1)
|
||||
proto += "://"
|
||||
parts = rest.split("/")
|
||||
# github.com / owner / repo / ...
|
||||
if len(parts) >= 3 and parts[0].lower() == "github.com":
|
||||
repo = parts[2]
|
||||
if repo.endswith(".git"):
|
||||
@@ -360,10 +351,8 @@ def get_visible_branches_at_commit(repo_dir, selected_commit):
|
||||
visible.append(branch_ref)
|
||||
continue
|
||||
first_unique_ts = branch_first_unique_timestamp(repo_dir, branch_ref, default_ref)
|
||||
# Если у ветки есть собственные коммиты, она появляется только начиная с первого такого коммита.
|
||||
if first_unique_ts is not None and first_unique_ts <= selected_ts:
|
||||
visible.append(branch_ref)
|
||||
# Если уникальных коммитов нет, показываем только если в этой ветке уже есть коммит на выбранный момент.
|
||||
visible.append(branch_ref)
|
||||
elif first_unique_ts is None and latest_branch_commit_at_time(repo_dir, branch_ref, selected_ts):
|
||||
visible.append(branch_ref)
|
||||
return visible
|
||||
|
||||
Reference in New Issue
Block a user