Skip to content

feat(_internal): Add copytree_reflink for CoW-optimized directory copying - #503

Merged
tony merged 5 commits into
masterfrom
pr/copy-ref
Nov 29, 2026
Merged

tony merged 5 commits into
masterfrom
pr/copy-ref

Conversation

@tony

@tony tony commented Dec 30, 2025

Copy link
Copy Markdown
Member

Summary

  • Add copytree_reflink function using cp --reflink=auto for Copy-on-Write optimization
  • Falls back to shutil.copytree on unsupported filesystems
  • Update pytest fixtures to use reflink copying for faster test setup

Test plan

  • Unit tests for copytree_reflink (success, fallback, error handling)
  • Integration with pytest fixtures verified

@codecov

codecov Bot commented Dec 30, 2025 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 95.45455% with 9 lines in your changes missing coverage. Please review.
✅ Project coverage is 72.75%. Comparing base (cb94c18) to head (68885e1).

Files with missing lines Patch % Lines
src/libvcs/_internal/copy.py 68.00% 7 Missing and 1 partial ⚠️
src/libvcs/pytest_plugin.py 75.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #503      +/-   ##
==========================================
+ Coverage   72.36%   72.75%   +0.38%     
==========================================
  Files          50       52       +2     
  Lines       11372    11567     +195     
  Branches     1695     1709      +14     
==========================================
+ Hits         8229     8415     +186     
- Misses       2328     2336       +8     
- Partials      815      816       +1     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

tony added a commit that referenced this pull request Dec 30, 2025
tony added a commit that referenced this pull request Dec 30, 2025
@tony tony mentioned this pull request Apr 26, 2026
tony added a commit that referenced this pull request Apr 26, 2026
@tony tony mentioned this pull request Nov 28, 2026
17 of 24 tasks
tony added a commit that referenced this pull request Nov 29, 2026
@tony tony mentioned this pull request Nov 29, 2026
17 of 30 tasks
tony added 5 commits November 28, 2026 20:44
why: Improve test fixture performance on CoW filesystems (Btrfs, XFS, APFS)
by leveraging reflink copying which only copies metadata instead of data.

what:
- Add copytree_reflink() using cp --reflink=auto with shutil fallback
- Add _apply_ignore_patterns() for post-copy cleanup of ignored files
what:
- Update git_repo fixture to use copytree_reflink
- Update hg_repo fixture to use copytree_reflink
- Update svn_repo fixture to use copytree_reflink
what:
- Add copytree_reflink scenario tests (simple, ignore, empty)
- Add fallback tests for cp failure, not found, OS error
- Add integration tests for git-like structure copying
what:
- Add docs/internals/copy.md with API reference and usage examples
- Add copy to internals toctree
- Document reflink benefits and filesystem support
@tony
tony merged commit 3555330 into master Nov 29, 2026
9 checks passed
@tony
tony deleted the pr/copy-ref branch November 29, 2026 02:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant