tests/test-custom-filters.t
changeset 38104 6e713711331b
parent 26587 56b2bcea2529
child 40656 ee9981bc8b44
equal deleted inserted replaced
38103:fc3cca406b2e 38104:6e713711331b
    10   > EOF
    10   > EOF
    11 
    11 
    12   $ cat > prefix.py <<EOF
    12   $ cat > prefix.py <<EOF
    13   > from mercurial import error
    13   > from mercurial import error
    14   > def stripprefix(s, cmd, filename, **kwargs):
    14   > def stripprefix(s, cmd, filename, **kwargs):
    15   >     header = '%s\n' % cmd
    15   >     header = b'%s\n' % cmd
    16   >     if s[:len(header)] != header:
    16   >     if s[:len(header)] != header:
    17   >         raise error.Abort('missing header "%s" in %s' % (cmd, filename))
    17   >         raise error.Abort(b'missing header "%s" in %s' % (cmd, filename))
    18   >     return s[len(header):]
    18   >     return s[len(header):]
    19   > def insertprefix(s, cmd):
    19   > def insertprefix(s, cmd):
    20   >     return '%s\n%s' % (cmd, s)
    20   >     return b'%s\n%s' % (cmd, s)
    21   > def reposetup(ui, repo):
    21   > def reposetup(ui, repo):
    22   >     repo.adddatafilter('stripprefix:', stripprefix)
    22   >     repo.adddatafilter(b'stripprefix:', stripprefix)
    23   >     repo.adddatafilter('insertprefix:', insertprefix)
    23   >     repo.adddatafilter(b'insertprefix:', insertprefix)
    24   > EOF
    24   > EOF
    25 
    25 
    26   $ cat > .hgignore <<EOF
    26   $ cat > .hgignore <<EOF
    27   > .hgignore
    27   > .hgignore
    28   > prefix.py
    28   > prefix.py