Copying vs of cloning?

Matt Mackall mpm at selenic.com
Tue Oct 2 16:53:56 CDT 2007


On Tue, Oct 02, 2007 at 02:43:10PM -0700, Andrei Gaponenko wrote:
> 
> Hi,
> 
> If one copies a Mercurial repository (with "cp -pr", or using tar), is
> the copy a valid repository?   I thought that after
> 
>     cd /someplace
>     hg clone /a/parent/repo
> 
> copying the newly created repo to /otherplace would be equivalent to
> 
>     cd /otherplace
>     hg clone /a/parent/repo
> 
> However running "diff -r" on two such clones I see that their
> .hg/dirstate files differ.  If I copied repo instead of cloning they
> would be identical.  So copying does not seem to be equivalent to
> cloning.
> 
> What is the difference???

dirstate contains timestamps of the time each file was last known to
be unmodified (checked out, checked in, etc.), which will vary from
clone to clone. But if you do a cp -r, the dirstate will correct
itself on the next stat.

-- 
Mathematics is the supreme nostalgia of our time.


More information about the Mercurial mailing list