feat: add SVN (Subversion) working copy support#255
feat: add SVN (Subversion) working copy support#255tirth8205 merged 2 commits intotirth8205:mainfrom
Conversation
|
This PR now has merge conflicts with main after recent merges to parser.py and related files. Could you rebase on the latest main? |
|
In addition to the merge conflict, our review found this PR has zero tests for a 435-line feature addition. The |
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
Hi! Could you please add the co-author trailer to the merged commit Once you update the commit message with this line, GitHub will automatically recognize my contribution and add me to the repository contributor list. Thank you very much! |
Summary
Adds first-class SVN support alongside the existing Git integration,
so that projects using Subversion can build and incrementally update
the knowledge graph without any manual configuration.
What changed
incremental.pyfind_svn_root()— walks up the directory tree to locate the SVNworking-copy root (handles both SVN 1.6 per-directory
.svnandthe single-root layout introduced in SVN 1.7).
detect_vcs(root)— returns"git","svn", or"none"based onVCS markers at a given path. Used internally to dispatch to the
correct VCS backend.
find_repo_root()— now falls back tofind_svn_root()when no.gitdirectory is found.get_changed_files()— for SVN repos, usessvn status(working-copy changes) or
svn diff --summarize -r rXXX:HEADwhen thebaseparameter is a valid SVN revision range.
get_staged_and_unstaged()— delegates tosvn statusfor SVN repos.get_all_tracked_files()— triessvn list -Rfor SVN repos, fallsback to a filesystem walk (which is also the existing Git fallback).
_svn_revision_info()— reads branch path and revision number fromsvn info._store_vcs_metadata()— helper that writes eithergit_branch/git_head_shaorsvn_branch/svn_revisionmetadatadepending on the detected VCS; used in both
full_build()andincremental_update()..svn/**toDEFAULT_IGNORE_PATTERNS.changes.pyparse_svn_diff_ranges()— runssvn diffand feeds the unified-diffoutput into the existing
_parse_unified_diff()for line-level changemapping. Accepts an optional revision range.
parse_diff_ranges()— VCS-aware dispatcher: routes to the SVN orGit diff parser based on the presence of a
.svnmarker.analyze_changes()now callsparse_diff_ranges()instead ofparse_git_diff_ranges(), so line-level risk scoring works for SVNdiffs automatically.
tools/review.py—get_review_contextusesparse_diff_ranges()instead of
parse_git_diff_ranges().tools/__init__.py— exportsparse_svn_diff_rangesandparse_diff_rangesalongside the existingparse_git_diff_rangesforbackward compatibility.
cli.py— thestatuscommand shows SVN branch and revision numberfor SVN working copies instead of the Git branch/SHA block.
Backward compatibility
All existing Git behavior is unchanged. The SVN path is only activated
when a
.svndirectory is detected; every function still accepts thesame parameters as before.
Testing
test_incremental.pyandtest_changes.pytests passwithout modification.
files in teardown) are unrelated to this PR.
Notes
svn list -Rqueries the server and may be slow on large repos;the filesystem-walk fallback kicks in automatically if it fails or
times out.
baseparameter semantics for SVN: a string matchingr?\d+(:r?\d+|:HEAD|:BASE|:COMMITTED)?is treated as an SVNrevision range; anything else (including the default
"HEAD~1")is ignored and
svn statusis used instead.