[Download] Add HfApi.resolve_revision and ResolvedRevision (#4604)
* [Download] Add HfApi.resolve_revision and RevisionStr
Resolve a revision (branch, tag, PR ref) to a commit hash once, cache the
mapping in `refs/` and pass the resulting `RevisionStr` around so that all
subsequent calls target the exact same commit.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
* [Download] Resolve revision in file_exists as well
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
* [Download] Don't update refs cache for pre-resolved revisions + raise on ProxyError
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
* flatten docs
* flatten docs
* docs
* doc example
* [Download] Keep repo_info and tree listing separate in snapshot_download
Move the commit-hash check above the resolution logic so that a resolved
RevisionStr and a plain commit hash follow the exact same path.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
* [Download] Rename RevisionStr to ResolvedRevision
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
* [Download] Revert file_exists changes
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
* no need for reduce optimization for now
* comment
* comment
---------
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>