.hg folder contains no store folder.

52 views
Skip to first unread message

Steve Gardner

unread,
Aug 31, 2012, 5:58:42 AM8/31/12
to merc...@selenic.com
We have a strange situation with one of our Mercurial repositories, and
I'd like to confirm if its likely to cause us any problems in future.

The repository is being updated using push over hgweb.cgi and in the
past there were a number of problems with permissions errors, so I think
at some point all of the files under the hg folder were deleted and then
recreated via a push from a copy of the repository.


Most of our repositories contain a cache folder and a store folder
within the .hg folder, but now in this one there is a data folder
instead of the store folder.
Everything else seems to work as it should (the history is still
correct etc), but I would like to be certain that nothing will be broken
by this.


Steve
_______________________________________________
Mercurial mailing list
Merc...@selenic.com
http://selenic.com/mailman/listinfo/mercurial

Adrian Buehlmann

unread,
Aug 31, 2012, 8:03:16 AM8/31/12
to Steve Gardner, merc...@selenic.com
On 2012-08-31 11:58, Steve Gardner wrote:
> We have a strange situation with one of our Mercurial repositories, and
> I'd like to confirm if its likely to cause us any problems in future.
>
> The repository is being updated using push over hgweb.cgi and in the
> past there were a number of problems with permissions errors, so I think
> at some point all of the files under the hg folder were deleted and then
> recreated via a push from a copy of the repository.
>
>
> Most of our repositories contain a cache folder and a store folder
> within the .hg folder, but now in this one there is a data folder
> instead of the store folder.
> Everything else seems to work as it should (the history is still
> correct etc), but I would like to be certain that nothing will be broken
> by this.

This story seems to match with a repository having Mercurial's very
first repository format.

Just creating an empty ".hg" directory (instead of using 'hg init' or
'hg clone') leaves a valid Mercurial repository.

I just tried this on my Windows 7 box:

$ hg version -q
Mercurial Distributed SCM (version 2.2.2+12-d1a0ac9b6b8a)
$ mkdir b
$ cd b
$ mkdir .hg
$ hg verify
repository uses revlog format 0
checking changesets
checking manifests
crosschecking files in changesets and manifests
checking files
0 files, 0 changesets, 0 total revisions

As you can see, an empty .hg directory is a valid repository. But it's
in an ancient format. Continuing the experiment:

$ echo foo > bla.txt
$ hg add
adding bla.txt
$ hg ci -m1
$ cd .hg
$ dir
Volume in drive C has no label.
Volume Serial Number is F80E-0A52

Directory of C:\Users\adi\hgrepos\tests\b\.hg

31.08.2012 13:42 <DIR> .
31.08.2012 13:42 <DIR> ..
31.08.2012 13:42 104 00changelog.d
31.08.2012 13:42 76 00changelog.i
31.08.2012 13:42 50 00manifest.d
31.08.2012 13:42 76 00manifest.i
31.08.2012 13:42 <DIR> cache
31.08.2012 13:42 <DIR> data
31.08.2012 13:42 64 dirstate
31.08.2012 13:42 1 last-message.txt
31.08.2012 13:42 43 phaseroots
31.08.2012 13:42 2 thgstatus
31.08.2012 13:42 102 undo
31.08.2012 13:42 0 undo.bookmarks
31.08.2012 13:42 7 undo.branch
31.08.2012 13:42 9 undo.desc
31.08.2012 13:42 64 undo.dirstate
31.08.2012 13:42 0 undo.phaseroots
14 File(s) 598 bytes
4 Dir(s) 374'871'592'960 bytes free

You will notice that there is no file named "requires" in the .hg
directory. And thus no "store" subdirectory. Because that format [aka
"layout"] didn't use a "store" subdirectory.

See also http://mercurial.selenic.com/wiki/RequiresFile

The "requires" file was introduced later. It is used to denote in what
format a repository is.

Current Mercurial versions can read and write all repository formats
ever released (up to that version you are using).

If your repo passes "hg verify", then your data should be fine.

If you want to profit from a newer repo format (which is recommended),
then you can clone it using the pull protocol.

$ hg clone --pull repoA repoB

repoB will then be in the format that is "most recent" (for the version
of "hg" you are using). repoA can be in any old format (which includes
the very first one).

Steve Gardner

unread,
Sep 3, 2012, 4:33:33 AM9/3/12
to Adrian Buehlmann, merc...@selenic.com
Adrian,

Thanks very much for a clear and detailed epxlanation. That helps a
lot.

Steve
Reply all
Reply to author
Forward
0 new messages