Copying vs of cloning?

Matt Mackall mpm at selenic.com
Tue Oct 2 17:39:19 CDT 2007


On Tue, Oct 02, 2007 at 03:21:18PM -0700, Micah Cowan wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA256
> 
> 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???
> 
> Your assumption would be correct only if you could demonstrate that two
> newly cloned repositories do _not_ differ in their .hg/dirstate files. I
> tried, and they do.

Nonetheless, a copy _is_ a valid repository, provided the copy is made while
no one is adding to the repo. In which case you'll get a completely
working repository that will make verify unhappy. The dirstate is
mostly a cache and will correct itself.

--
Mathematics is the supreme nostalgia of our time.


More information about the Mercurial mailing list