What is the convention for tracking empty dirs?
Many docs on the web are talking about putting an .hgignore in the dir.
Is it just a wide usage or something mentionned somewhere officially?
I'm training some trainnes to good habits & practice, I need to know the
Hg official way to do things.
Thank you.
--
RMA.
_______________________________________________
Mercurial mailing list
Merc...@selenic.com
http://selenic.com/mailman/listinfo/mercurial
> HI all,
>
> What is the convention for tracking empty dirs? Many docs on the web
> are talking about putting an .hgignore in the dir.
>
> Is it just a wide usage or something mentionned somewhere officially?
>
> I'm training some trainnes to good habits & practice, I need to know
> the Hg official way to do things.
I've never seen a guide that suggests putting a '.hgignore' file into an
empty directory -- but I've seen several guides that suggest '.keep' as
the filename.
But really, the most official way to do this is to stop tracking empty
directories: let the build system create them as needed instead.
--
Martin Geisler
aragost Trifork
Professional Mercurial support
http://mercurial.aragost.com/kick-start/
The official way is to teach your Makefile to create them when they are
needed ... I doubt the .hgignore trick is mentioned somewhere as this
file has a special meaning, but only at the root of the repository ...
Regards,
Benoit
If I search (Google) on "mercurial track empty directory", I find
several resultats advising creating such a file.
--
RMA.
> On 09/22/2011 06:12 PM, Martin Geisler wrote:
>> I've never seen a guide that suggests putting a '.hgignore' file into an
>> empty directory -- but I've seen several guides that suggest '.keep' as
>> the filename.
>
> If I search (Google) on "mercurial track empty directory", I find
> several resultats advising creating such a file.
Okay, that's surprising since that particular filename is used for the
file in which you list ignore patterns. I find
http://hgbook.red-bean.com/read/mercurial-in-daily-use.html
http://mercurial.selenic.com/wiki/FAQ
http://mercurial.selenic.com/bts/issue521
http://der-design.com/mercurial/track-emtpy-directories-scm
http://stackoverflow.com/questions/4805098/how-to-commit-empty-folders-to-a-mercurial-repository
but they don't mention '.hgignore' in relation to empty directories.
--
Martin Geisler
Mercurial links: http://mercurial.ch/
This is actually standard advice in Git-land, which has
per-directory .gitignore files and also doesn't track empty directories.
So it's not at all surprising that someone would incorrectly translate
that advice to Mercurial.
But any file that makes an empty directory non-empty will work.
--
Mathematics is the supreme nostalgia of our time.
> On Thu, 2011-09-22 at 18:44 +0200, Martin Geisler wrote:
>> Mihamina Rakotomandimby <miha...@rktmb.org> writes:
>>
>>> On 09/22/2011 06:12 PM, Martin Geisler wrote:
>>>> I've never seen a guide that suggests putting a '.hgignore' file into an
>>>> empty directory -- but I've seen several guides that suggest '.keep' as
>>>> the filename.
>>>
>>> If I search (Google) on "mercurial track empty directory", I find
>>> several resultats advising creating such a file.
>>
>> Okay, that's surprising since that particular filename is used for the
>> file in which you list ignore patterns. I find
>>
>> http://hgbook.red-bean.com/read/mercurial-in-daily-use.html
>> http://mercurial.selenic.com/wiki/FAQ
>> http://mercurial.selenic.com/bts/issue521
>> http://der-design.com/mercurial/track-emtpy-directories-scm
>> http://stackoverflow.com/questions/4805098/how-to-commit-empty-folders-to-a-mercurial-repository
>>
>> but they don't mention '.hgignore' in relation to empty directories.
>
> This is actually standard advice in Git-land, which has
> per-directory .gitignore files and also doesn't track empty directories.
> So it's not at all surprising that someone would incorrectly translate
> that advice to Mercurial.
>
> But any file that makes an empty directory non-empty will work.
I have thought about adding this sort of functionality to MacHg so people can add empty directories. (A number of users have requested this of MacHg.) In fact for users that don't really know much about Mercurial it's one of the first problems they stumble across...
It would be handy if there was a convention that was "the-standard" which was decreed by you / the community. That way GUI clients could automatically use this convention.
I of course could use .hidden, but it might be nice to have hg in the name like .hghidden, or .hgdummyfile, or something like that...
Cheers,
Jas
> I of course could use .hidden, but it might be nice to have hg in the name like .hghidden, or .hgdummyfile, or something like that…
I've seen and used .empty. I think the file should not reference mercurial in any way.
I know .keep; it is also used in my Gentoo GNU/Linux installation for empty
configuration directories.
Best wishes,
Arne
--
Ein Würfel System - einfach saubere Regeln:
Personally I really don't like "littering" the source tree with .keep
files just to overcome one of the few limitations of Mercurial.
A solution that I'd very much prefer is to have a single .hgkeep or
.hgempty file on the top of the repository, containing a list of
folders that must exist on a given revision. This file could be read
by an extension which would make create the folders as needed on
update.
This .hgkeep file would be version controlled, thus properly tracking
your empty folders in your history.
A long time ago, before I started contributing to TortoiseHg I wrote
such an extension, which I called "hgremap". It was not limited to
creating empty folders, but it could also automatically copy (what I
called "remap") any version controlled file into some other location
in the repository. This could be useful for example, to have some file
templates tracked by mercurial, while the actual files used for your
build are not (so that you can modify them locally).
You can find this extension in BitBucket at:
https://bitbucket.org/AngelEzquerra/hg-remap-extension. The extension
is not very polished but it should work, or at least is worked for me
when I needed it. Maybe it could prove useful as an starting point for
someone else...
Cheers,
Angel
That’s nice. Did you put it into the hg wiki?
Best wishes,
Arne
--
Ich hab' nichts zu verbergen – hab ich gedacht:
- http://draketo.de/licht/lieder/ich-hab-nichts-zu-verbergen
No, I didn't . I didn't feel that it was polished enough... Maybe I
should look into it and see if I can polish it a bit...
> No, I didn't . I didn't feel that it was polished enough... Maybe I
> should look into it and see if I can polish it a bit...
Please do!
I wanted to do something to fix the no-track-dirs for years, but never got
around to implementing it. And now that we get large file support in core, it
might be time to enable simple tracking of directories.
Best wishes,
Arne
--
A man in the streets faces a knife.
Two policemen are there it once. They raise a sign:
“Illegal Scene! Noone may watch this!”
The man gets robbed and stabbed and bleeds to death.
The police had to hold the sign.
…Welcome to Europe, citizen. Censorship is beautiful.
( http://draketo.de/stichwort/censorship )
ugh, that's a little gross. Of course, extend this just a bit so "hg add somedir" and "hg rm somedir" operate on it, put the file in the .hg/ directory, and you've essentially taught mercurial real support for tracking directories. :)
eric