Sparse working copy

Paul Boddie paul.boddie at biotek.uio.no
Fri Nov 16 12:51:07 UTC 2012


On 16/11/12 12:43, Jan Vrany wrote:
> I would need a "sparse" working copy, a handy feature of SVN. That 
> means, a possibility to clone a repository and have only a part of the 
> of the files checked out in the working copy (only subdirectory of 
> whole tree and and not in full depth). I mean, lets say full structure 
> is:
>  p1
>   - c1.st
>   - c2.st
>   - makefile
>   - plugin1
>     - data1
>   - plugin2
>     - data2
>
> To modify c1.st, i need to clone the repository sparsely, so
> the working copy contains only c1.st, c2.st, makefile and possibly
> empty plugin1 & plugin2. I do not need to have data1 and data2 in my
> WC for they are HUGE (1GB, say) and I certainly won't touch them
> from IDE.

As far as I know, and I'm sure corrections will follow, if you have 
chosen to manage data1 and data2 in the repository then you would need 
to have their history stored within the .hg directory structure, but you 
could avoid having them "checked out" (in addition to occupying space in 
the history) by doing something like this:

cd p1
hg update null
hg revert -r tip c1.st c2.st makefile

At this point, you have three files as working, usable files but not the 
data files. I imagine that you have to be somewhat careful performing a 
revert on directories because this will make their contents available as 
working files as well. Remember that this only saves the additional 
space that would otherwise be occupied by those files when performing a 
normal update to a particular revision, and the .hg directory would 
still be as large as ever.

Of course, various extensions exist to help with working with large 
files, but I don't have any experience with them, and others are much 
more likely to be able to inform you about this to more or less any degree.

Paul

P.S. Maybe there's some discussion of "selective" or "narrow" checkouts 
on the Wiki, but I couldn't really find much after a cursory attempt to 
look for them.



More information about the Mercurial mailing list