generate clone without copying any source

Peter Arrenbrecht peter.arrenbrecht at gmail.com
Thu Sep 11 13:11:01 CDT 2008


On Thu, Sep 11, 2008 at 7:37 PM, Thomas Rowe <thomas_rowe at psualum.com> wrote:
> On Thu, Sep 11, 2008 at 07:49:43PM +0300, Giorgos Keramidas wrote:
>> On Thu, 11 Sep 2008 12:23:14 -0400, Thomas Rowe <thomas_rowe at psualum.com> wrote:
>> > I use mercurial to manage personal branches and revisions on a very
>> > large C++ project.  It takes a very long time to compile, so I find
>> > myself doing this:
>> >
>> >   $ hg clone rep1 rep2_hg # All I want here is the child .hg directory.
>> >   $ cp -R --preserve rep1 rep2 # rep2 now has all the object files and
>> >     # compiler specific temporary files, so it doesn't need to be rebuilt.
>> >   $ mv rep2_hg/.hg rep2/
>> >   $ rm -rf rep2_hg
>> >
>> > Is there an easy way to achieve this with straight-up mercurial?
>>
>> You don't really need to hg clone to a temporary tree first.  It
>> should be possible to run:
>>
>>     $ cp -a rep1 rep2
>>     $ cd rep2 ; hg debugrebuildstate
>>
>> The default mode of copying with `cp -a' does not create hard links on
>> my FreeBSD installation here, so this may waste a bit of space in the
>> target clone.  Using hard-links for *everything*, including the working
>> area, is probably going to be a _very_ bad idea if your text editor
>> doesn't break hard-links by default, so the extra disk space usage of
>> cloning like this is generally fine.
>
> My usage in this particular case is on windows, so I doubt hardlinks are
> an issue one way or the other.
>
> I DO want the second repository to be able to push/pull from the first.
> Does copy + debugrebuildstate allow for this?

Yes.


More information about the Mercurial mailing list