author | Christian Ebert <blacktrash@gmx.net> |
Mon, 18 Dec 2006 12:10:05 +0100 | |
branch | updatehook |
changeset 32 | b70b38b15fa4 |
parent 18 | 0a57d4566be9 |
permissions | -rw-r--r-- |
18
0a57d4566be9
Simplify filter pattern for $Hg$ scheme
Christian Ebert <blacktrash@gmx.net>
parents:
3
diff
changeset
|
1 |
# $Hg$ |
1
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(): |
18
0a57d4566be9
Simplify filter pattern for $Hg$ scheme
Christian Ebert <blacktrash@gmx.net>
parents:
3
diff
changeset
|
6 |
'''Truncates hg keywords in IO stream |
0a57d4566be9
Simplify filter pattern for $Hg$ scheme
Christian Ebert <blacktrash@gmx.net>
parents:
3
diff
changeset
|
7 |
from |
0a57d4566be9
Simplify filter pattern for $Hg$ scheme
Christian Ebert <blacktrash@gmx.net>
parents:
3
diff
changeset
|
8 |
<Dollar>Hg: <filename> <cset id> <stuff> <Dollar> |
0a57d4566be9
Simplify filter pattern for $Hg$ scheme
Christian Ebert <blacktrash@gmx.net>
parents:
3
diff
changeset
|
9 |
to |
0a57d4566be9
Simplify filter pattern for $Hg$ scheme
Christian Ebert <blacktrash@gmx.net>
parents:
3
diff
changeset
|
10 |
<Dollar>Hg<Dollar>.''' |
0a57d4566be9
Simplify filter pattern for $Hg$ scheme
Christian Ebert <blacktrash@gmx.net>
parents:
3
diff
changeset
|
11 |
kwrepl = r'%sHg$' % '$' |
0a57d4566be9
Simplify filter pattern for $Hg$ scheme
Christian Ebert <blacktrash@gmx.net>
parents:
3
diff
changeset
|
12 |
re_kwtrunc = re.compile(r'[$]Hg: .+?,v [a-z0-9]{12} [^$]+? \$') |
0a57d4566be9
Simplify filter pattern for $Hg$ scheme
Christian Ebert <blacktrash@gmx.net>
parents:
3
diff
changeset
|
13 |
sys.stdout.write(re_kwtrunc.sub(kwrepl, sys.stdin.read())) |