hgkw/hgkwdecode.py
author Christian Ebert <blacktrash@gmx.net>
Fri, 15 Dec 2006 01:21:56 +0100
branchdecodefilter
changeset 16 e29cf107baf2
parent 15 4bd44185f781
permissions -rw-r--r--
Rename parent1 to p
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
14
b60345141aa5 Adapt to filename instead of basename style
Christian Ebert <blacktrash@gmx.net>
parents: 4
diff changeset
     1
# $Hg: hgkw/hgkwdecode.py,v$
4
7e618d820490 decodefilter branch: add decode filter with kwutil module
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
     2
7e618d820490 decodefilter branch: add decode filter with kwutil module
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
     3
from mercurial.demandload import demandload
7e618d820490 decodefilter branch: add decode filter with kwutil module
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
     4
demandload(globals(), 'hgkw:kwutil mercurial:localrepo re sys')
7e618d820490 decodefilter branch: add decode filter with kwutil module
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
     5
7e618d820490 decodefilter branch: add decode filter with kwutil module
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
     6
def kwdecode():
7e618d820490 decodefilter branch: add decode filter with kwutil module
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
     7
    '''Expands keywords into IO stream.'''
7e618d820490 decodefilter branch: add decode filter with kwutil module
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
     8
15
4bd44185f781 Rename lr variable to repo
Christian Ebert <blacktrash@gmx.net>
parents: 14
diff changeset
     9
    repo = localrepo.localrepository(None)
4
7e618d820490 decodefilter branch: add decode filter with kwutil module
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
    10
15
4bd44185f781 Rename lr variable to repo
Christian Ebert <blacktrash@gmx.net>
parents: 14
diff changeset
    11
    kword = kwutil.mkkw(repo, tip=False, node='')
4
7e618d820490 decodefilter branch: add decode filter with kwutil module
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
    12
    re_kw = kwutil.rekw()
7e618d820490 decodefilter branch: add decode filter with kwutil module
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
    13
7e618d820490 decodefilter branch: add decode filter with kwutil module
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
    14
    sys.stdout.write(re_kw.sub(kword, sys.stdin.read()))