File: hooks.py

package info (click to toggle)
hg-git 1.2.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,372 kB
  • sloc: python: 8,708; sh: 185; makefile: 23
file content (16 lines) | stat: -rw-r--r-- 491 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
import pprint

from mercurial import pycompat

def showargs(ui, repo, hooktype, **kwargs):
    if not kwargs:
        ui.write(b'| %s\n' % hooktype)

    for k, v in pycompat.byteskwargs(kwargs).items():
        if k in (b"txnid", b"changes"):
            # ignore these; they are either unstable or too verbose
            continue
        if not isinstance(v, bytes):
            v = repr(v).encode('ascii', errors='backslashreplace')
        ui.write(b'| %s.%s=%s\n' % (hooktype, k, v))