hgfs – mercurial file system


hgfs [ -D ] [ -m mtpt ] [ -s service ] [ dir ]


Mercurial is a distributed version control system. It tracks and organizes files and keeps a change history of them. The file revisions are stored as packed deltas in a repository that can be checked out with the hg(1) program.

Hgfs serves a mercurial repository as a read-only filesystem where each file revision and its metadata is accessible as files.

The repository may be specified by passing the working directory dir as the final argument. When omitted, hgfs locates the repository by walking upwards from the current working directory until the .hg sub-directory is found. If no mtpt was specified with -m , then hgfs will mount itself on /mnt/hg (default). When a service name is given with the -s flag, the 9p service pipe /srv/service is created and may be mounted from another namespace. The -D flag enables 9p debug messages.

The root of the served filesystem contains directories each corresponding to a specific changeset revision in the repository.

Revision directories are named by a revision id which takes the form [d.]h, where d is the decimal revision number starting from 0 and h is the hexadecimal hash of the changeset. Both the revision number d and the hash h are able to identify a revision uniquely; only one of them needs to be given when walking the root directory. The hexadecimal hash may be shortened so long as the resulting lookup yields a unique result. The special name tip corresponds to the latest revision but does not appear in the directory listing.

In each revision directory the following files can be found:


contains the revision id of the changeset.  


contains the parent revision id of the changeset.  


If the changeset was a merge, contains the other parent revision id. Otherwise, a zero size file.  


The log file contains a list of file names, separated by a newline, that where affected in this changeset. Files that are listed in the log but are not accessible in the files or changes directories have been deleted in this changeset.  


committer of the changeset.  


commit message of the changeset.  


A directory that contains a snapshot of the tree at the time the changeset was committed.  

To retrieve the nth past version of a file relative to the changeset, one can append .n to the filename. Appending .revn yields a file that contains its revision id as text. Note that appending .rev0 or .rev yields the file containing the revision id of the changeset when the file was last modified and .0 yields the same file as when omitting the appendix.


Same as files, but contains only the changed files of the changeset.  






Hgfs first appeared in 9front (June, 2011).