Skip to content

feat: Add SVN commit support with GUI interface similar to Git commits #6117

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 14 commits into
base: main
Choose a base branch
from

Conversation

ubuntutester202
Copy link

@ubuntutester202 ubuntutester202 commented Jul 23, 2025

Related GitHub Issue

Closes: #6100

Roo Code Task Context (Optional)

Description

This PR implements comprehensive SVN (Subversion) support for Roo Code, allowing users to work with SVN repositories alongside existing Git functionality. The implementation includes:

Key Features Implemented:

  • SVN Repository Detection: Automatic detection of .svn directories and integration with VS Code workspace
  • SVN Commit Search: Search SVN commits by revision number or message content with XML parsing
  • SVN Status Integration: Real-time working directory status and diff information via @svn-changes mention
  • SVN Version References: Support for r123 and 123 format revision mentions with automatic commit info retrieval
  • Debug Infrastructure: Dedicated SVN debug channel with comprehensive logging and user-friendly error handling
  • Untracked Files Preview: Show first 3 untracked files with intelligent file type detection

Technical Implementation Details:

  • Created src/utils/svn.ts with complete SVN command-line integration
  • Added SvnLogger class for comprehensive debug logging with dedicated VS Code output channel
  • Implemented SvnErrorHandler with user-friendly error messages and guided troubleshooting
  • Added SVN message types to ExtensionMessage.ts for webview communication
  • Integrated SVN detection into workspace initialization and mention processing
  • Added comprehensive test suite with 18 test cases covering all functionality

Design Choices:

  • Used child_process with promisify for reliable SVN command execution
  • Implemented XML parsing for structured SVN log data
  • Added graceful fallbacks when SVN is not available or installed
  • Prioritized user experience with helpful error messages and installation guidance

Test Procedure

Automated Testing:

cd src && npm test svn.spec.ts

✅ All 18 SVN tests pass successfully

Manual Testing Steps:

  1. SVN Repository Detection:

    • Open VS Code in an SVN working copy
    • Verify debugSvn command appears in Command Palette
    • Check SVN repository info is correctly detected
  2. SVN Commit Search:

    • Use @svn-commits mention with revision number (e.g., @svn-commits 123)
    • Search with commit message text (e.g., @svn-commits "bug fix")
    • Verify results show revision, author, date, and message
  3. SVN Status Integration:

    • Make changes to SVN working copy
    • Use @svn-changes mention
    • Verify current status and diff information appears
  4. SVN Version References:

    • Reference revisions like r123 or 123 in chat
    • Verify commit information is automatically retrieved and displayed
  5. Debug Functionality:

    • Run debugSvn command
    • Check "Roo Code - SVN Debug" output channel for comprehensive information
    • Test error scenarios (non-SVN directory, SVN not installed)

Testing Environment:

  • Windows 10 with SVN command-line tools
  • VS Code with multiple SVN working copies
  • Both TortoiseSVN and command-line SVN installations tested

Pre-Submission Checklist

  • Issue Linked: This PR is linked to an approved GitHub Issue (see "Related GitHub Issue" above).
  • Scope: My changes are focused on the linked issue (one major feature/fix per PR).
  • Self-Review: I have performed a thorough self-review of my code.
  • Testing: New and/or updated tests have been added to cover my changes (18 comprehensive test cases).
  • Documentation Impact: I have considered if my changes require documentation updates (see "Documentation Updates" section below).
  • Contribution Guidelines: I have read and agree to the Contributor Guidelines.

Screenshots / Videos

Main User Interface Changes:

  • New debugSvn command available in VS Code Command Palette
  • "Roo Code - SVN Debug" output channel for comprehensive logging
  • SVN commit and status information integrated into AI chat responses
  • User-friendly error dialogs with installation and troubleshooting guidance

Documentation Updates

  • No documentation updates are required.
  • Yes, documentation updates are required.

Rationale: This feature integrates seamlessly with existing mention system (@svn-changes, @svn-commits) and follows established patterns. The debugSvn command is self-explanatory and appears in Command Palette. User-friendly error messages provide guidance when needed.

Additional Notes

Verification of All Acceptance Criteria:
AC1: SVN Repository Detection & Basic Integration - Implemented with workspace detection
AC2: SVN Commit Search & History - Full XML parsing with revision and message search
AC3: SVN Status & Change Detection - Real-time status via @svn-changes mention
AC4: Untracked Files Preview - Shows first 3 files with smart file detection
AC5: SVN Version References & Mentions - Supports r123 and 123 formats
AC6: Debug & Diagnostics - Comprehensive debugSvn command with dedicated output channel
AC7: Error Handling - User-friendly messages with guided troubleshooting
AC8: Test Coverage - 18 comprehensive test cases covering all functionality
AC9: Integration Patterns - Follows existing mention and webview patterns
AC10: Extension Activation - Proper workspace initialization and command registration

Performance Considerations:

  • SVN commands are executed asynchronously to avoid blocking the UI
  • Output truncation prevents excessive memory usage
  • Graceful degradation when SVN is not available

Future Enhancements Ready:

  • Foundation laid for additional SVN operations (commit, update, etc.)
  • Extensible error handling system for new SVN scenarios
  • Debug infrastructure ready for advanced troubleshooting

Get in Touch

Discord Username: [charmmy_51908]


Important

Adds SVN support with commit search, status integration, and debugging capabilities, alongside comprehensive error handling and logging.

  • Behavior:
    • Adds SVN support with automatic .svn directory detection and integration into VS Code workspace.
    • Implements SVN commit search by revision or message in svn.ts.
    • Integrates SVN status and diff information with @svn-changes mention.
    • Supports r123 and 123 revision mentions for automatic commit info retrieval.
    • Adds debugSvn command for SVN debugging in registerCommands.ts.
  • Error Handling:
    • Introduces SvnErrorHandler for user-friendly error messages and troubleshooting.
  • Logging:
    • Adds SvnLogger for comprehensive SVN debug logging.
  • Testing:
    • Adds 18 test cases in svn.spec.ts to cover SVN functionalities.
  • UI Changes:
    • Updates ChatTextArea.tsx and ContextMenu.tsx to handle SVN mentions and display commit information.
  • Misc:
    • Excludes .svn/ in excludes.ts and file-search.ts for file operations.

This description was created by Ellipsis for 0015192. You can customize this summary. It will automatically update as commits are pushed.

在Webview消息处理、扩展消息类型和UI组件中添加对SVN提交搜索的支持
- 新增SVN提交搜索功能及相关类型定义
- 扩展上下文菜单以支持SVN提交选项
- 添加SVN工具函数用于搜索和解析提交信息
- 在聊天文本区域集成SVN提交搜索功能
添加SVN集成调试功能,包括:
1. 新增debugSvn命令用于检查SVN安装和仓库状态
2. 实现SvnLogger用于记录调试信息
3. 增强现有SVN工具函数添加日志记录
4. 在package.json注册新命令
- 在mentionRegex中添加svn-changes匹配项
- 实现获取SVN工作状态的函数并添加调试日志
- 在parseMentions中处理svn-changes提及,返回工作目录变更信息
- 在processUserContentMentions中添加调试日志
当SVN工作目录中存在未跟踪文件时,现在会显示前3个文件的内容预览(针对小文件)或文件类型信息。这有助于开发者快速了解未跟踪文件的内容,而无需手动检查每个文件。
- 在提及解析中增加对SVN版本号的支持
- 添加获取SVN提交信息的工具函数
- 修改提及正则表达式以匹配SVN版本号
- 为SVN提及添加类型定义和格式化函数
将SVN调试相关的注释从中文翻译为英文,提高代码可读性
- 在文件搜索和检查点服务中排除.svn目录
- 改进SVN工具中的错误处理,确保错误信息正确显示
- 新增SVN错误处理类,提供更友好的错误提示和指导
- 改进调试命令的输出信息,包含仓库URL和工作副本路径
- 为常见SVN错误添加详细处理逻辑和用户引导
- 优化命令标题的国际化支持
- 简化提交信息解析逻辑,提高可读性
更新 packages/ipc、packages/evals 中的 node-ipc 依赖版本
同步更新 pnpm-lock.yaml 文件
- 新增svn.spec.ts文件,包含对SVN相关工具函数的单元测试
- 测试内容涵盖SVN安装检查、仓库验证、提交信息提取等功能
- 使用vitest框架进行测试,确保各功能模块的正确性和稳定性
@dosubot dosubot bot added the size:XXL This PR changes 1000+ lines, ignoring generated files. label Jul 23, 2025
@ubuntutester202 ubuntutester202 changed the title feat: Add SVN commit support with GUI interface similar to Git commits (#6100) feat: Add SVN commit support with GUI interface similar to Git commits Jul 23, 2025
@dosubot dosubot bot added the enhancement New feature or request label Jul 23, 2025
return "Error: SVN not available or not an SVN repository"
}

const cleanRevision = revision.replace(/^r/i, "")
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In getSvnCommitInfoForMentions, the revision string is only cleaned using replace(/^r/i, "") but not fully validated. It would be safer to ensure the revision contains only digits before interpolating into the shell command to avoid potential command injection.

Suggested change
const cleanRevision = revision.replace(/^r/i, "")
const cleanRevision = revision.replace(/^r/i, ""); if (!/^\d+$/.test(cleanRevision)) throw new Error("Invalid revision");

@hannesrudolph hannesrudolph added the Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. label Jul 23, 2025
@github-project-automation github-project-automation bot moved this from New to Done in Roo Code Roadmap Jul 23, 2025
@github-project-automation github-project-automation bot moved this from Triage to Done in Roo Code Roadmap Jul 23, 2025
- 在获取SVN提交信息的函数中新增版本号格式验证,确保输入的版本号为有效的数字格式
- 更新上下文菜单选项,新增对SVN类型的支持,确保用户在空查询时能够获取到完整的选项列表
- 我确保最初的两笔提交中与环境有关的改动导致的后续问题得到修复。比如roo-code\apps\vscode-e2e\src\types\global.d.ts和package.json

- pnpm lint和pnpm test都成功
@github-project-automation github-project-automation bot moved this from Done to New in Roo Code Roadmap Jul 23, 2025
@github-project-automation github-project-automation bot moved this from Done to Triage in Roo Code Roadmap Jul 23, 2025
@ubuntutester202
Copy link
Author

Hi! I've fixed the issue that caused CI to fail before:

  • Fixed dependency environment problem, solved check types failure caused by version incompatibility
  • My code implementation for the svn commits part is almost in a form that is convenient for developers to merge.
  • Please review again, thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. size:XXL This PR changes 1000+ lines, ignoring generated files.
Projects
Status: Triage
Development

Successfully merging this pull request may close these issues.

Feature: Add SVN commit support with GUI interface similar to Git commits
2 participants