Copying vs of cloning?

Micah Cowan micah at cowan.name
Tue Oct 2 17:21:18 CDT 2007


-----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.

A reasonable guess would be that the dirstate files include date
information regarding their last update. Or (less likely) some
randomized information.

The former appears to be the case, as comparing a copy, a later-created
repository, and another latest-created repository with a hex dumper,
there is a recurring two-byte number in each of them that differs, and
the order of values for these numbers is the same as the order in which
these repositories were copied/cloned.

- --
HTH,
Micah J. Cowan
Programmer, musician, typesetting enthusiast, gamer...
http://micah.cowan.name/

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFHAsRe7M8hyUobTrERCIzLAJ94/cMqXMA3y88sNwYrRCZeyz8pEQCdH17s
tca76O0r1Zp0AWvhcqmpRfQ=
=GIJA
-----END PGP SIGNATURE-----


More information about the Mercurial mailing list