This module can be considered to be private. However, it can serve as an example implementation of a version control backend.
Speaking of Subversion, we use its svn.fs layer mainly, which means we need direct (read) access to the repository content.
Though there’s no documentation for the Python API per se, the doxygen documentation for the C libraries are usually enough. Another possible source of inspiration are the examples and the helper classes in the bindings themselves.
The Subversion bindings are not unicode-aware and they expect to receive UTF-8 encoded string parameters,
On the other hand, all paths manipulated by Trac are unicode objects.
Therefore:
- before being handed out to SVN, the Trac paths have to be encoded to UTF-8, using _to_svn()
- before being handed out to Trac, a SVN path has to be decoded from UTF-8, using _from_svn()
Whenever a value has to be stored as utf8, we explicitly mark the variable name with “_utf8”, in order to avoid any possible confusion.
Repository implementation based on the svn.fs API.
Reset notion of youngest and oldest
Dispose of low-level resources associated to this repository.
Retrieve the base path corresponding to the Subversion repository itself.
This is the same as the path property minus the intra-repository scope, if one was specified.
Determine differences between two arbitrary pairs of paths and revisions.
(wraps repos.svn_repos_dir_delta)
Produce a SubversionChangeset from given revision specification
Build a value identifying the rev in this repository.
Produce a SubversionNode from given path and optionally revision specifications. No revision given means use the latest.
Gives an approximation of the oldest revision.
Retrieve creation and deletion events that happened on given path.
Retrieve the “native” URL from which this repository is reachable from Subversion clients.
Retrieve known branches, as (name, id) pairs.
Purposedly ignores rev and always takes the last revision.
Retrieve the latest revision in the repository.
(wraps fs.youngest_rev)
Check if path exists at rev (or latest if unspecified)
Return revision immediately following rev, eventually below given path or globally.
Take any path specification and produce a path suitable for the rest of the API
Take any revision specification and produce a revision suitable for the rest of the API
Return revision immediately preceeding rev, eventually below given path or globally.
Check relative order between two revision specifications.
Return a list the last changed revision for each line. (wraps client.blame2)
Return the revision in which the node’s path was created.
(wraps fs.revision_root_revision(fs.closest_copy))
Retrieve raw content as a “read()”able object.
Retrieve byte size of a file.
Return None for a folder. (wraps fs.file_length)
Retrieve mime-type property of a file.
Return None for a folder. (wraps fs.revision_prop)
Retrieve the list of (path,rev) copy ancestors of this node. Most recent ancestor first. Each ancestor (path, rev) corresponds to the path and revision of the source at the time the copy or move operation was performed.
Yield SubversionNode corresponding to entries in this directory.
(wraps fs.dir_entries)
Yield change events that happened on this path
Retrieve timestamp of last modification, in micro-seconds.
(wraps fs.revision_prop)
Retrieve processed content as a “read()”able object.