.hg* files in working directory (and archive)

Thomas Arendsen Hein thomas at intevation.de
Wed Nov 25 01:26:03 CST 2009


* Zoran Bosnjak <zoran.bosnjak at via.si> [20091125 08:16]:
> - 'hg archive' command stores .hg* files too. I believe that this is a
> leak of internal mercurial information to archive file. I could not find a
> hg command to extract sources alone. A few extra (hidden) files are
> generally not a problem, but there are situations when a user wants to
> have a CLEAN archive. Simple and effective solution would be to add (-c
> --clean) option to 'hg archive' which would skip mercurial files while
> doing archive. The question is only: what files to skip?

Check the ui.archivemeta config option, you can set it to false to
avoid including the .hg_archival.txt file.

With the --exclude option you can exclude the other .hg* files.

(ok, just -c would be easier :))

> -The second problem (same cause) is the opposite situation. If I want to
> bring new set of sources to repository as they are, for example:
>   - hg update -r vendor_release1.0
>   - remove all files in working directory (but .hg*)
>   - place new sources in working directory
>   - hg addremove
>   - hg commit -m "new vendor release"
>   - hg tag vendor_release2.0
> There is a problem on a second step. I think a mercurial command should be
> provided to clean working directory of all user's files and keep mercurial
> files. At the moment, user needs internal mercurial knowledge to perform
> this task with filesystem manipulation. I've tried to find a way to
> properly 'import' vendor sources to mercurial, but I could not find set of
> hg commands to do it. Again it should be easy to add a flag to 'hg purge'
> extension that would clean working directory this way.

You don't need much internal hg knowledge. Just move all .hg* files
to the new extracted source directory and you're ready to addremove
and commit.

> I would like to extend mercurial to fix the problems above (new flags to
> hg archive and hg purge). But, may I assume that .hg/ and .hg* - and
> nothing more is (and will always be) mercurial internals? Is it better to
> use (and maintain) explicit list of internal files so that manipulation
> like this would be possible? Or maybe to move .hg* files inside
> subdirectory of .hg/ so that they are distinguished based on location (but
> still version controlled)? Please advice. Thanks a lot.

It will always be .hg*, but determining a limites set isn't possible
as extensions or new Mercurial releases will add new files here.

Putting them below .hg/ is inconsistent, because only those files,
who will be committed together with the normal files are kept in the
working directory.

Regards,
Thomas Arendsen Hein

-- 
thomas at intevation.de - http://intevation.de/~thomas/ - OpenPGP key: 0x5816791A
Intevation GmbH, Neuer Graben 17, 49074 Osnabrueck - AG Osnabrueck, HR B 18998
Geschaeftsfuehrer: Frank Koormann, Bernhard Reiter, Dr. Jan-Oliver Wagner


More information about the Mercurial-devel mailing list