tests/test-log-exthook.t
changeset 39657 2b9f315a4217
parent 35888 c8e2d6ed1f9e
child 40441 005bc856e919
equal deleted inserted replaced
39656:e3768bd48e26 39657:2b9f315a4217
     1 Test hg log changeset printer external hook
     1 Test hg log changeset printer external hook
     2 -------------------------------------------
     2 -------------------------------------------
     3 
     3 
     4   $ cat > $TESTTMP/logexthook.py <<EOF
     4   $ cat > $TESTTMP/logexthook.py <<EOF
     5   > from __future__ import absolute_import
     5   > from __future__ import absolute_import
       
     6   > import codecs
     6   > from mercurial import (
     7   > from mercurial import (
     7   >   commands,
     8   >   commands,
     8   >   logcmdutil,
     9   >   logcmdutil,
     9   >   repair,
    10   >   repair,
    10   > )
    11   > )
    11   > def rot13description(self, ctx):
    12   > def rot13description(self, ctx):
    12   >     summary = "summary".encode('rot13')
    13   >     summary = codecs.encode("summary", 'rot-13')
    13   >     description = ctx.description().strip().splitlines()[0].encode('rot13')
    14   >     description = ctx.description().strip().splitlines()[0].encode('rot13')
    14   >     self.ui.write("%s:     %s\n" % (summary, description))
    15   >     self.ui.write("%s:     %s\n" % (summary, description))
    15   > def reposetup(ui, repo):
    16   > def reposetup(ui, repo):
    16   >     logcmdutil.changesetprinter._exthook = rot13description
    17   >     logcmdutil.changesetprinter._exthook = rot13description
    17   > EOF
    18   > EOF