hgkw/hgkwencode.py
branchupdatehook
changeset 18 0a57d4566be9
parent 3 b9f2c0853da3
equal deleted inserted replaced
17:7aebaf13ea3c 18:0a57d4566be9
     1 # $Hg: hgkwencode.py,v$
     1 # $Hg$
     2 
     2 
     3 import re, sys
     3 import re, sys
     4 
     4 
     5 def kwencode():
     5 def kwencode():
     6     '''Truncates keywords in IO stream.'''
     6     '''Truncates hg keywords in IO stream
     7 
     7     from
     8     re_kwtrunc = re.compile(r'([$]Hg: .+?,v) [a-z0-9]{12} [^$]+? \$')
     8     <Dollar>Hg: <filename> <cset id> <stuff> <Dollar>
     9     sys.stdout.write(re_kwtrunc.sub(r'\1$', sys.stdin.read()))
     9     to
       
    10     <Dollar>Hg<Dollar>.'''
       
    11     kwrepl = r'%sHg$' % '$'
       
    12     re_kwtrunc = re.compile(r'[$]Hg: .+?,v [a-z0-9]{12} [^$]+? \$')
       
    13     sys.stdout.write(re_kwtrunc.sub(kwrepl, sys.stdin.read()))