[PATCH 0 of 1] Add .hginclude support (like .hgignore, except specifies what to include).
Mitch Frazier
mitch at ssc.com
Wed Nov 2 20:38:35 UTC 2005
Benoit Boissinot wrote:
> On 11/2/05, Mitch Frazier <mitch at fmr.name> wrote:
>> Eric Hopper wrote:
>>> On Wed, Nov 02, 2005 at 05:26:59PM +0100, Benoit Boissinot wrote:
>>>>> and then only add files you want, unfortunately this doesn't work as you
>>>>> get python exceptions when you try to run may hg commands.
>>>> That's what i wanted to say, this should work and i think this is the
>>>> proper way to do it. If it tracebacks, this is a bug and we should
>>>> try to fix it.
>>>>
>>>> I think it is much simpler to ignore everything and add what we want
>>>> to track with "hg add" without caring about another config file.
>>> I agree. I think having a .hginclude file is an unnecessary
>>> complication. I've always hated systems that have 'allow' and 'deny'
>>> lists and some weird method of combining the two that always seems to
>>> yield unexpected results in some situation.
>> I would agree that having two config files is a pain, but just having
>> .hgignore capability makes certain things more difficult. If you have a
>> directory with hundreds of items in it and you only want to include a
>> few of them its much easier to say "ignore everything except X, Y, and
>> Z" than it is to say "ignore A, B, C, D, ..., W". Certainly, patterns
>> reduce the size of the job but its still more verbose.
>>
>
> syntax: glob
> *
> in .hgignore already does that, the except is done by "hg adding"
> files, if it doesn't work it should be fixed.
It works sometime, and doesn't other times. Here's a sequence that
doesn't work:
/etc# hg init
/etc# hg add my.cnf
/etc# hg commit
/etc# hg add apache2/
/etc# hg add apache2/*
apache2/mime.types: unsupported file type (type is symbolic link)
/etc# hg add apache2/*/*
/etc# hg add apache2/*/*/*
apache2/*/*/*: No such file or directory
/etc# hg commit
** unknown exception encountered, details follow
** report bug details to mercurial at selenic.com
Traceback (most recent call last):
File "/usr/local/bin/hg", line 13, in ?
commands.run()
File "/usr/local/lib/python/mercurial/commands.py", line 2395,
in run
sys.exit(dispatch(sys.argv[1:]))
File "/usr/local/lib/python/mercurial/commands.py", line 2561,
in dispatch
return d()
File "/usr/local/lib/python/mercurial/commands.py", line 2546,
in <lambda>
d = lambda: func(u, repo, *args, **cmdoptions)
File "/usr/local/lib/python/mercurial/commands.py", line 785,
in commit
repo.commit(files, message, opts['user'], opts['date'], match)
File "/usr/local/lib/python/mercurial/localrepo.py", line 409,
in commit
(new, remove))
File "/usr/local/lib/python/mercurial/manifest.py", line 137,
in add raise AssertionError(
AssertionError: failed to remove apache2/conf.d/apache2-manual.conf
from manifest
Note that if don't do the first "hg commit" and commit "my.cnf" along
with all the apache config files it doesn't raise the exception.
If this worked, it would certainly be possible to use just an .hgignore
file and only add files that you want, but I would argue that an include
capability still has merit. Continuing with the /etc example, if you
want to include all .cnf and .conf files in the repository, doing the
initial add with an ignore/include capability that says "exclude
everything except "*.cnf" and "*.conf" is easier than trying add each
file individually. It also would allow you to more easily and quickly
see new configuration files (matching *.cnf or *.conf) that have been
added to /etc by running "hg status".
Sometimes its easier to say what you want by saying what you don't want,
but sometimes its just easier to say what you want.
More information about the Mercurial
mailing list