keyword: versioning my homedir and ~/.hgrc

Giorgos Keramidas keramida at ceid.upatras.gr
Sun Jul 5 16:17:41 CDT 2009


Hi Christian & -devel,

I've just enabled the keyword extension to my HOME directory's .hg
repository and noticed something odd:

keyword.py:kwtools{} in the latest crew repository is set to:

# make keyword tools accessible
kwtools = {'templater': None, 'hgcmd': '', 'inc': [], 'exc': ['.hg*']}

My home directory is a Mercurial repository with an .hgignore file that
ignores everything by default, until I "hg add" something:

    # $GKer$

    syntax: glob

    # Ignore everything by default; this makes it easier to version-control
    # only the stuff I'm really interested in keeping under mercurial.
    **

The `.hg/hgrc' file at `/home/keramida/.hg/hgrc' enables the keyword
extension and includes the following patterns:

    # $GKer: hgadmin/conf/hgrc 2763b12c44a3 2009/07/05 12:02:51 keramida $

    [extensions]
    keyword =

    [keywordmaps]
    Date = {date|utcdate}
    GKer = {file} {node|short} {date|utcdate} {author|user}

    [keyword]
    ** =
    .bbdb = ignore
    .gnupg/pubring.gpg = ignore
    .gnupg/random_seed = ignore
    .gnupg/secring.gpg = ignore
    .gnupg/trustdb.gpg = ignore

With this setup in place, I can't get keywords to expand in my `~/.hgrc'
file.  By editing keyword.py to remove '.hg*' from the 'exc' key, or by
setting the 'exc' list to include only '.hgtags' this is fixed:

     # make keyword tools accessible
    -kwtools = {'templater': None, 'hgcmd': '', 'inc': [], 'exc': ['.hg*']}
    +kwtools = {'templater': None, 'hgcmd': '', 'inc': [], 'exc': ['.hgtags']}

and I can expand my local $Gker$ keyword in .hgrc and .hgignore:

    keramida at kobe:/home/keramida$ ident .hgrc .hgignore
    .hgrc:
         $GKer: .hgrc ccb3925ebc56 2009/07/05 12:27:30 keramida $

    .hgignore:
         $GKer: .hgignore ccb3925ebc56 2009/07/05 12:27:30 keramida $

Does this look like a safe change?  Is there some other, better way to
make sure .hgrc and .hgignore are not auto-excluded and always skipped
from keyword expansion?



More information about the Mercurial-devel mailing list