view hgext/win32text.py @ 5332:b0bfe087ad8a

hgwebdir: ignore hgrc parse errors while building the index page An error in the .hg/hgrc file from a repository would prevent the following repos from being shown in the index page. The IOError handling was unnecessary - it's already handled in readconfig. This should fix issue731. The error in the .hg/hgrc file will still prevent the repo from being exported with hgweb.
author Alexis S. L. Carvalho <alexis@cecm.usp.br>
date Mon, 24 Sep 2007 19:00:11 -0300
parents e58b1c9a0dec
children 30762680fcd2
line wrap: on
line source

import mercurial.util

def dumbdecode(s, cmd):
    return s.replace('\n', '\r\n')

def dumbencode(s, cmd):
    return s.replace('\r\n', '\n')

def clevertest(s, cmd):
    if '\0' in s: return False
    return True

def cleverdecode(s, cmd):
    if clevertest(s, cmd):
        return dumbdecode(s, cmd)
    return s

def cleverencode(s, cmd):
    if clevertest(s, cmd):
        return dumbencode(s, cmd)
    return s

mercurial.util.filtertable.update({
    'dumbdecode:': dumbdecode,
    'dumbencode:': dumbencode,
    'cleverdecode:': cleverdecode,
    'cleverencode:': cleverencode,
    })