patch to support multiple line keyword expansion

Christian Ebert blacktrash at gmx.net
Wed Jun 18 03:27:11 CDT 2008


* Tobias Sargeant on Monday, June 16, 2008 at 21:03:43 +1000
> I've attached a small patch that adds multiple line keyword expansion to the
> keyword extension. I don't know if it will have wide enough appeal to
> warrant being included, but I thought I'd offer it up for consideration. The
> patch is made against keyword.py in the 1.0.1 mercurial release.

Some -- biased, as I wrote keyword.py -- feedback:

I didn't implement multiline expansion (or incremental, like
$Log$) because imho the benefits don't outweigh the risks and
speed loss.

afaics you changed the config behaviour. User configured
[keywordmaps] would be added to the default maps instead of
overriding them. The rationale of overriding the defaults is:

a) keywords can stay completely under user control
   (you may have expansion w/o eg. $Date$ being expanded)
b) the more maps the more complicated the search pattern the
   bigger the slowdown.

> The idea was to allow me to manage separate repositories with different
> source code licenses, and to still be able to push changesets between them
> without the license differences getting pushed between repositories.
> 
> RCS style expansions work as before (and are also functional within
> multiline expansions).

You should be able to do this with an encode/decode filter pair,
except for expansion within the filtered output (perhaps even
that would work, I didn't have time to test).

Some general remarks:

I believe it's better if you made a "real Mercurial patch"
against the source.

Run the test(s); your patch makes test-keyword fail. For
additional functionality it's a good idea to extend the test. 

Update help; in this case the output of "hg help keyword".

Have a look at
<http://www.selenic.com/mercurial/wiki/index.cgi/BasicCodingStyle>
for line lengths etc.

For keyword read the first paragraph of
<http://www.selenic.com/mercurial/wiki/index.cgi/KeywordPlan> ;)
Another reason why I tried to make it as unobtrusive, strict, and
narrow in its scope of tasks as possible.

c
-- 
  Was heißt hier Dogma, ich bin Underdogma!
[ What the hell do you mean dogma, I am underdogma. ]

_F R E E_  _V I D E O S_  -->>  http://www.blacktrash.org/underdogma/


More information about the Mercurial-devel mailing list