hgkw/hgkwencode.py
branchextension
changeset 38 6a830bed4af1
parent 37 3dc31476c148
child 39 14038784f986
equal deleted inserted replaced
37:3dc31476c148 38:6a830bed4af1
     1 # $Hg$
       
     2 
       
     3 import re, sys
       
     4 
       
     5 def kwencode():
       
     6     '''Truncates hg keywords in IO stream
       
     7     from
       
     8     <Dollar>Hg: <filename> <cset id> <stuff> <Dollar>
       
     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()))