hgkw/hgkwencode.py
author Christian Ebert <blacktrash@gmx.net>
Thu, 14 Dec 2006 16:24:30 +0100
branchdecodefilter
changeset 11 56a61a5c696d
parent 3 b9f2c0853da3
child 14 b60345141aa5
child 18 0a57d4566be9
permissions -rw-r--r--
Switch to complete filename in first keyword field This will hopefully allow to iterate over the stream in hgkwdecode, and lookup the relatively latest revision of corresponding file.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1
1d997ec7be86 Add simple [encode] filter in python
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
     1
# $Hg: hgkwencode.py,v$
1d997ec7be86 Add simple [encode] filter in python
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
     2
1d997ec7be86 Add simple [encode] filter in python
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
     3
import re, sys
1d997ec7be86 Add simple [encode] filter in python
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
     4
3
b9f2c0853da3 Make pattern compilation local to function
Christian Ebert <blacktrash@gmx.net>
parents: 2
diff changeset
     5
def kwencode():
b9f2c0853da3 Make pattern compilation local to function
Christian Ebert <blacktrash@gmx.net>
parents: 2
diff changeset
     6
    '''Truncates keywords in IO stream.'''
1
1d997ec7be86 Add simple [encode] filter in python
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
     7
3
b9f2c0853da3 Make pattern compilation local to function
Christian Ebert <blacktrash@gmx.net>
parents: 2
diff changeset
     8
    re_kwtrunc = re.compile(r'([$]Hg: .+?,v) [a-z0-9]{12} [^$]+? \$')
b9f2c0853da3 Make pattern compilation local to function
Christian Ebert <blacktrash@gmx.net>
parents: 2
diff changeset
     9
    sys.stdout.write(re_kwtrunc.sub(r'\1$', sys.stdin.read()))