SVN AI Commit Message
Adds a sparkle button to the SVN Source Control input (provided by johnstoncode.svn-scm) that generates a commit message from your working copy diff — the same UX as the built-in Git/Copilot button.
Requirements
- VS Code 1.90+
svn-scm extension
svn CLI on your PATH
- One of:
- GitHub Copilot (uses the VS Code Language Model API), or
- An Anthropic API key (stored in VS Code Secret Storage)
Usage
- Open an SVN working copy.
- Make some changes.
- Click the sparkle (✨) icon in the SCM input toolbar, or run SVN AI: Generate Commit Message.
The message streams into the input box. Press Esc during generation to cancel — the input box is restored to whatever it was before.
Branch indicator
The status bar shows the branch the active working copy is switched to ($(git-branch) booking_dev). Click it — or run SVN AI: Switch Branch — to open a branch palette; picking an entry runs svn switch ^/branch/<name> in the working-copy root.
- The list is read with
svn list from the paths in svnAiCommit.branch.paths and cached for 5 minutes; the ↻ button in the palette reloads it (SVN AI: Refresh Branch List does the same).
- Switch to another path or URL... accepts anything svn does:
^/branch/x, branch/x, or a full repository URL.
- If the working copy has uncommitted changes you get a confirmation first, because a switch merges them into the target branch.
- Unrelated locations need
--ignore-ancestry; the extension detects that case and offers to retry.
- The label follows switches made elsewhere (svn-scm, TortoiseSVN, a terminal) — it re-reads on window focus and when
.svn/wc.db changes.
The default paths cover the two common layouts (^/trunk, ^/branches/*, ^/branch/*). Paths that do not exist are skipped, so a single setting works across repositories. To include tags, add ^/tags/*.
Configuration
All settings live under svnAiCommit.*:
| Setting |
Default |
Description |
provider |
auto |
auto | copilot | anthropic |
model.smart |
"" |
Override for aggregation / single-call model. |
model.fast |
"" |
Override for per-file summary model. |
maxConcurrency |
5 |
Parallel per-file calls (1–20). |
singleCallThresholdTokens |
25000 |
Below this, all diffs go in one call. |
perFileMaxTokens |
6000 |
Per-file truncation budget. |
maxDiffBytes |
10485760 |
Hard cap on svn diff stdout. |
style |
plain |
conventional | plain | custom |
customStyleInstructions |
"" |
Used when style = custom. |
language |
auto |
Output language (e.g. en, fr). |
includeBody |
true |
Include a body section. |
maxBodyLines |
8 |
Cap body length. |
onExistingMessage |
prompt |
prompt | replace | append |
branch.enabled |
true |
Show the branch indicator in the status bar. |
branch.paths |
["^/trunk", "^/branches/*", "^/branch/*"] |
Where branches live. A trailing /* lists one level below the path. |
branch.showFullPath |
false |
Show branch/booking_dev instead of booking_dev. |
Anthropic API key
Run SVN AI: Set Anthropic API Key. The key is stored in VS Code Secret Storage. To remove it, run SVN AI: Clear Anthropic API Key.
How it works
- Shells out to
svn diff --internal-diff (streams stdout, hard-capped by maxDiffBytes).
- Splits the diff per file (
Index: boundary), classifies each as text / binary / property-only / generated.
- Routes:
- Total tokens under
singleCallThresholdTokens → one call to the smart model with the full diff.
- Otherwise → fast model summarizes each text file in parallel, smart model aggregates.
- Final smart-model call streams into the SCM input box.
How the branch switcher works
svn info --xml (local, no network) gives the current location; the branch label is <relative-url> with the configured container prefix stripped.
svn list --xml --non-interactive <url> enumerates each .../* path, up to 4 in parallel, 30s timeout each.
svn switch --non-interactive ^/<path> runs in the working-copy root. It is not cancellable: killing svn mid-switch leaves a working copy that needs svn cleanup.
Troubleshooting
- "svn CLI not found" — Install Subversion and make sure
svn is on your PATH.
- "No AI provider available" — Install GitHub Copilot or set an Anthropic API key.
- No sparkle button — Make sure
johnstoncode.svn-scm is installed and the workspace folder is an SVN working copy.
- First Copilot call blocked — Accept the Copilot Language Model consent dialog when prompted, then retry.
- No branch indicator — The workspace folder (or a parent of it) must contain
.svn. Check that svnAiCommit.branch.enabled is on and that the entry is not hidden via the status bar's right-click menu.
- Empty branch list —
svnAiCommit.branch.paths does not match your repository layout. Run svn list ^/ in the working copy to see the top-level directories.
- Branch list times out or asks for credentials — Everything runs with
--non-interactive. Run svn list <url> once in a terminal to cache credentials.
Out of scope (v0.2)
- Creating or deleting branches, merging, per-changelist messages, pre-commit hooks, multi-repo per-repo config, real tokenizers, cross-session caching, other SCMs.
License
MIT.
| |