views:

156

answers:

3

In clearcase If I am working on some file X and want to also see its previous version(say version 5) it is available as X@@/main/5. Is something similar available with other (preferably free) version control systems? HG has hg cat and hg co. but they still do not come close to clearcase's feature above... Regards Vijay

+1  A: 

A quick Google search found gitfs:

gitfs is a FUSE-based filesystem for working with source trees stored in git repositories. The eventual goal is to provide a convenient way to work with lots of branches and patches. Currently only very basic functionality is implemented -- read-only access to the existing tags and objects.

There are likely other (more active) projects offering similar features (both for Git and other VCSes).

Greg Hewgill
+1  A: 

Basically every hg command you would want to handle an arbitrary revision can - using -r in hg is just like using @@ in clearcase all the time. hg "only" needs -r because files aren't versioned independently of the repository, so given a file and a repo version, -r is unambiguous.

If you want to edit a file, piping hg cat is exactly like reading file@@/branch/ver - they provide exactly the same (read-only) access to the data.

If you want the convenience of dynamic views over MVFS in Mercurial, that's an entirely different problem and you can't really do it (you can do it read-only over NFS, but obviously there's no versioning there).

Nick Bastin
A: 

First, X@@/main/5 is an extended pathname which you can really explore only in dynamic views.

Second, you can quickly access an older version of a file in Git:

git show REVISION:path/to/file

(with the path of the file being always from the root of the git repository)
And you can use git show for other usage (see the file as it is in another branch for instance)

See "How to retrieve a single file from specific revision in Git?" for more.


In term of dynamic exploration of a revision-based filesystem, the equivalent of hgfs for Git would be:

  • gitfs FUSE-based filesystem for working with source trees stored in git repositories.

figfs (the Filesystem Interface to Git FileSystem), which expands on gitfs.

The repository is presented as a filesystem which allows multiple versions and branches of the project code to be viewed simultaneously and without the need to reconfigure the user's workspace.

In order to provide a filesystem service, figfs uses the Filesystem in User space (FUSE)

From the work of Reilly Grant

alt text

A FUSE application allows a filesystem to be implemented as a user-space process.
An application’s request is passed through the VFS layer and into the FUSE driver which sends the request to the user space filesystem daemon.
Figfs then accesses the Git repository through the normal filesystem and returns the resulting data to the application.

VonC
Based on Greg's comment I was able to find http://www.ueber.net/code/man/hgfs/tip/man/4/hgfs.html . which does something similar for mercurial.My reason for perfering filesystem interface over `hg cat` and similar commands is that these commands require an extra step of extracting the revision which has to be done outside the IDE. e.g. if I am drawing a schematic with xfig and wanted to load the 5th revision having a filesystem interface allows me to do a direct file->open operation whereas `hg cat` requires an additional step to dump the revision before use.
Vijay
@Vijay: understood. I have completed my answer and added the equivalent of hgfs for git: figfs.
VonC