hgkw/pretxnkw.py
branchextension
changeset 40 38ee735886d2
parent 39 14038784f986
child 41 e1c539e1282b
equal deleted inserted replaced
39:14038784f986 40:38ee735886d2
    44                                                # %Y-%m-%d %H:%M:%S
    44                                                # %Y-%m-%d %H:%M:%S
    45 
    45 
    46     re_kw = re.compile(r'\$Hg[^$]*?\$')
    46     re_kw = re.compile(r'\$Hg[^$]*?\$')
    47 
    47 
    48     for f in files:
    48     for f in files:
    49         text = repo.wfile(f).read()
    49         data = repo.wfile(f).read()
    50         if not util.binary(text):
    50         if not util.binary(data):
    51             kw = '$Hg: %s,v %s %s %s $' % (
    51             kw = '$Hg: %s,v %s %s %s $' % (
    52                     os.path.basename(f), cid, date, user)
    52                     os.path.basename(f), cid, date, user)
    53             text, kwct = re_kw.subn(kw, text)
    53             data, kwct = re_kw.subn(kw, data)
    54             if kwct:
    54             if kwct:
    55                 ui.note(_('expanding keywords in %s\n' % f))
    55                 ui.note(_('expanding keywords in %s\n' % f))
    56                 # backup file?
    56                 # backup file?
    57                 repo.wfile(f, 'w').write(text)
    57                 repo.wfile(f, 'w').write(data)