[Copy] Support cross-repo file copies (#4203)
* feat: support cross-repo LFS file copies in CommitOperationCopy
Add `src_repo_id` and `src_repo_type` to `CommitOperationCopy` to enable copying
LFS files across repositories. For cross-repo LFS copies, the client fetches the
xet hash from the source repo via `get_paths_info` and passes it to the server which
handles the xet hash duplication. Regular (non-LFS) cross-repo files are downloaded
and re-uploaded as before.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* support it in copy_files (i.e. in hf buckets cp)
* address issue
* use parse_hf_uri
* _duplicate_lfs_files before commit
* ignore failed ops
* fix test
* fix cursor comment
* fix /duplicate call
* better
* [CommitOperationCopy] Add cross-repo copy support: tests and docs
- Update CommitOperationCopy docstring: document cross-repo copy, add examples
- Add unit tests for CommitOperationCopy validation (src_repo_id/src_repo_type)
- Add parametrized unit tests for _resolve_copy_target_path
- Add integration test for cross-repo copy via create_commit (test_hf_api.py)
- Add repo-to-repo copy_files integration tests (test_buckets.py)
- Update upload guide: document new src_repo_id/src_repo_type args
- Update buckets guide: rename section, add repo-to-repo examples
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fix test?
* revert
* a
* new docs + remove useless tests
* better tests
* style
* duplicate
* useless docs
* refactor: unify intra-repo and cross-repo copy logic in _fetch_files_to_copy
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* raise on LFS duplication failure instead of warn-and-skip
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* nit
* better?
* merge_contents
* FilesDuplicationError
* FileDuplicationError
* optimize code
* docstring
* Update src/huggingface_hub/hf_api.py
Co-authored-by: célina <hanouticelina@gmail.com>
* remove unittest
---------
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Co-authored-by: célina <hanouticelina@gmail.com>