Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions code_review_graph/changes.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ def parse_git_diff_ranges(
errors="replace",
cwd=repo_root,
timeout=_GIT_TIMEOUT,
stdin=subprocess.DEVNULL,
)
if result.returncode != 0:
logger.warning("git diff failed (rc=%d): %s", result.returncode, result.stderr[:200])
Expand Down Expand Up @@ -97,6 +98,7 @@ def parse_svn_diff_ranges(
errors="replace",
cwd=repo_root,
timeout=_GIT_TIMEOUT,
stdin=subprocess.DEVNULL,
)
if result.returncode != 0:
logger.warning("svn diff failed (rc=%d): %s", result.returncode, result.stderr[:200])
Expand Down
10 changes: 10 additions & 0 deletions code_review_graph/incremental.py
Original file line number Diff line number Diff line change
Expand Up @@ -336,6 +336,7 @@ def _git_branch_info(repo_root: Path) -> tuple[str, str]:
text=True,
cwd=str(repo_root),
timeout=_GIT_TIMEOUT,
stdin=subprocess.DEVNULL,
)
if result.returncode == 0:
branch = result.stdout.strip()
Expand All @@ -348,6 +349,7 @@ def _git_branch_info(repo_root: Path) -> tuple[str, str]:
text=True,
cwd=str(repo_root),
timeout=_GIT_TIMEOUT,
stdin=subprocess.DEVNULL,
)
if result.returncode == 0:
sha = result.stdout.strip()
Expand All @@ -365,6 +367,7 @@ def _svn_revision_info(repo_root: Path) -> tuple[str, str]:
["svn", "info", "--non-interactive"],
capture_output=True, text=True, encoding="utf-8", errors="replace",
cwd=str(repo_root), timeout=_GIT_TIMEOUT,
stdin=subprocess.DEVNULL,
)
if result.returncode == 0:
for line in result.stdout.splitlines():
Expand Down Expand Up @@ -427,6 +430,7 @@ def get_changed_files(repo_root: Path, base: str = "HEAD~1") -> list[str]:
text=True,
cwd=str(repo_root),
timeout=_GIT_TIMEOUT,
stdin=subprocess.DEVNULL,
)
if result.returncode != 0:
# Fallback: try diff against empty tree (initial commit)
Expand All @@ -436,6 +440,7 @@ def get_changed_files(repo_root: Path, base: str = "HEAD~1") -> list[str]:
text=True,
cwd=str(repo_root),
timeout=_GIT_TIMEOUT,
stdin=subprocess.DEVNULL,
)
files = [f.strip() for f in result.stdout.splitlines() if f.strip()]
return files
Expand All @@ -456,6 +461,7 @@ def _get_svn_changed_files(repo_root: Path, rev_range: str | None = None) -> lis
["svn", "diff", "--summarize", "--non-interactive", "-r", rev_range],
capture_output=True, text=True, encoding="utf-8", errors="replace",
cwd=str(repo_root), timeout=_GIT_TIMEOUT,
stdin=subprocess.DEVNULL,
)
if result.returncode != 0:
logger.warning("svn diff --summarize failed (rc=%d): %s",
Expand All @@ -472,6 +478,7 @@ def _get_svn_changed_files(repo_root: Path, rev_range: str | None = None) -> lis
["svn", "status", "--non-interactive"],
capture_output=True, text=True, encoding="utf-8", errors="replace",
cwd=str(repo_root), timeout=_GIT_TIMEOUT,
stdin=subprocess.DEVNULL,
)
files = []
for line in result.stdout.splitlines():
Expand Down Expand Up @@ -499,6 +506,7 @@ def get_staged_and_unstaged(repo_root: Path) -> list[str]:
text=True,
cwd=str(repo_root),
timeout=_GIT_TIMEOUT,
stdin=subprocess.DEVNULL,
)
files = []
for line in result.stdout.splitlines():
Expand Down Expand Up @@ -544,6 +552,7 @@ def get_all_tracked_files(
text=True,
cwd=str(repo_root),
timeout=_GIT_TIMEOUT,
stdin=subprocess.DEVNULL,
)
return [f.strip() for f in result.stdout.splitlines() if f.strip()]
except (FileNotFoundError, subprocess.TimeoutExpired):
Expand All @@ -561,6 +570,7 @@ def _get_svn_all_tracked_files(repo_root: Path) -> list[str]:
["svn", "list", "--recursive", "--non-interactive"],
capture_output=True, text=True, encoding="utf-8", errors="replace",
cwd=str(repo_root), timeout=60, # svn list queries the server
stdin=subprocess.DEVNULL,
)
if result.returncode == 0:
# svn list returns paths relative to the WC URL; directories end with "/"
Expand Down
2 changes: 2 additions & 0 deletions code_review_graph/tools/context.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ def _has_git_changes(root: Path, base: str) -> bool:
["git", "diff", "--name-only", base, "--"],
capture_output=True, text=True,
cwd=str(root), timeout=10,
stdin=subprocess.DEVNULL,
)
if result.returncode == 0 and result.stdout.strip():
return True
Expand All @@ -28,6 +29,7 @@ def _has_git_changes(root: Path, base: str) -> bool:
["git", "status", "--porcelain"],
capture_output=True, text=True,
cwd=str(root), timeout=10,
stdin=subprocess.DEVNULL,
)
return bool(result2.stdout.strip())
except (FileNotFoundError, subprocess.TimeoutExpired):
Expand Down