mercurial/ui.py
changeset 3737 9f5c46c50118
parent 3721 98f2507c5551
child 3886 abaee83ce0a6
child 3984 f82b3f915605
equal deleted inserted replaced
3736:ad3d5b4367cb 3737:9f5c46c50118
    27 class ui(object):
    27 class ui(object):
    28     def __init__(self, verbose=False, debug=False, quiet=False,
    28     def __init__(self, verbose=False, debug=False, quiet=False,
    29                  interactive=True, traceback=False, report_untrusted=True,
    29                  interactive=True, traceback=False, report_untrusted=True,
    30                  parentui=None):
    30                  parentui=None):
    31         self.overlay = None
    31         self.overlay = None
       
    32         self.buffers = []
    32         if parentui is None:
    33         if parentui is None:
    33             # this is the parent of all ui children
    34             # this is the parent of all ui children
    34             self.parentui = None
    35             self.parentui = None
    35             self.readhooks = []
    36             self.readhooks = []
    36             self.quiet = quiet
    37             self.quiet = quiet
   365         path = self.config("paths", loc)
   366         path = self.config("paths", loc)
   366         if not path and default is not None:
   367         if not path and default is not None:
   367             path = self.config("paths", default)
   368             path = self.config("paths", default)
   368         return path or loc
   369         return path or loc
   369 
   370 
       
   371     def pushbuffer(self):
       
   372         self.buffers.append([])
       
   373 
       
   374     def popbuffer(self):
       
   375         return "".join(self.buffers.pop())
       
   376 
   370     def write(self, *args):
   377     def write(self, *args):
   371         for a in args:
   378         if self.buffers:
   372             sys.stdout.write(str(a))
   379             self.buffers[-1].extend([str(a) for a in args])
       
   380         else:
       
   381             for a in args:
       
   382                 sys.stdout.write(str(a))
   373 
   383 
   374     def write_err(self, *args):
   384     def write_err(self, *args):
   375         try:
   385         try:
   376             if not sys.stdout.closed: sys.stdout.flush()
   386             if not sys.stdout.closed: sys.stdout.flush()
   377             for a in args:
   387             for a in args: