added REDMINE_URL to document_details_* context
[redakcja.git] / lib / vstorage / hgui.py
1 """
2     Mercurial ui module replacement.
3 """
4
5 import mercurial.ui
6 import logging
7
8 class SilentUI(mercurial.ui.ui):
9
10     def __init__(self, *args, **kwargs):
11         super(SilentUI, self).__init__(*args, **kwargs)
12
13         # make sure this doesn't collide with anything in Mercurial
14         self.__logger = logging.getLogger('mercurial')
15
16     def _is_trusted(self, fd, filename):
17         """ Checks if config file is trusted - on server side, this isn't very useful. """
18         return True
19
20     def write(self, *args):
21         if self._buffers:
22             self._buffers[-1].extend([str(a) for a in args])
23         else:
24             self.__logger.info(''.join(args))
25
26     def write_err(self, *args):
27         self.__logger.error(''.join(args))
28
29     def flush(self):
30         pass
31
32     def interactive(self):
33         return False
34
35     def _readline(self, prompt=''):
36         return u''
37
38     def status(self, *msg):
39         self.__logger.debug(''.join(msg))
40
41     def warn(self, *msg):
42         self.__logger.warn(''.join(msg))
43
44     def note(self, *msg):
45         self.__logger.info(''.join(msg))
46
47     def debug(self, *msg):
48         self.__logger.debug(''.join(msg))
49
50     def edit(self, text, user):
51         return text
52
53     def traceback(self, exc=None):
54         if exc is not None: self.__logger.exception()
55
56     def progress(self, *args, **kwargs):
57         pass