mercurial/ui.py
changeset 8138 0ffb8f791b7c
parent 8137 7fd0616b3d80
child 8139 9302404b60f3
equal deleted inserted replaced
8137:7fd0616b3d80 8138:0ffb8f791b7c
    64                 ui._isatty = sys.stdin.isatty()
    64                 ui._isatty = sys.stdin.isatty()
    65             except AttributeError: # not a real file object
    65             except AttributeError: # not a real file object
    66                 ui._isatty = False
    66                 ui._isatty = False
    67         return ui._isatty
    67         return ui._isatty
    68 
    68 
    69     def verbosity_constraints(self):
       
    70         self.quiet = self.configbool('ui', 'quiet')
       
    71         self.verbose = self.configbool('ui', 'verbose')
       
    72         self.debugflag = self.configbool('ui', 'debug')
       
    73 
       
    74         if self.debugflag:
       
    75             self.verbose = True
       
    76             self.quiet = False
       
    77         elif self.verbose and self.quiet:
       
    78             self.quiet = self.verbose = False
       
    79 
       
    80     def _is_trusted(self, fp, f, warn=True):
    69     def _is_trusted(self, fp, f, warn=True):
    81         st = util.fstat(fp)
    70         st = util.fstat(fp)
    82         if util.isowner(fp, st):
    71         if util.isowner(fp, st):
    83             return True
    72             return True
    84         tusers = self.trusted_users
    73         tusers = self.trusted_users
   181                 for n, path in pathsitems:
   170                 for n, path in pathsitems:
   182                     if path and "://" not in path and not os.path.isabs(path):
   171                     if path and "://" not in path and not os.path.isabs(path):
   183                         cdata.set("paths", n,
   172                         cdata.set("paths", n,
   184                                   os.path.normpath(os.path.join(root, path)))
   173                                   os.path.normpath(os.path.join(root, path)))
   185 
   174 
   186         # update verbosity/interactive/report_untrusted settings
   175         # update ui options
   187         if section is None or section == 'ui':
   176         if section is None or section == 'ui':
   188             if name is None or name in ('quiet', 'verbose', 'debug'):
   177             self.debugflag = self.configbool('ui', 'debug')
   189                 self.verbosity_constraints()
   178             self.verbose = self.debugflag or self.configbool('ui', 'verbose')
   190             if name is None or name == 'interactive':
   179             self.quiet = not self.debugflag and self.configbool('ui', 'quiet')
   191                 interactive = self.configbool("ui", "interactive", None)
   180             if self.verbose and self.quiet:
   192                 if interactive is None and self.interactive:
   181                 self.quiet = self.verbose = False
   193                     self.interactive = self.isatty()
   182 
   194                 else:
   183             self.report_untrusted = self.configbool("ui", "report_untrusted",
   195                     self.interactive = interactive
   184                                                     True)
   196             if name is None or name == 'report_untrusted':
   185             self.interactive = self.configbool("ui", "interactive",
   197                 self.report_untrusted = (
   186                                                self.isatty())
   198                     self.configbool("ui", "report_untrusted", True))
       
   199             self.traceback = self.configbool('ui', 'traceback', False)
   187             self.traceback = self.configbool('ui', 'traceback', False)
   200 
   188 
   201         # update trust information
   189         # update trust information
   202         if (section is None or section == 'trusted') and self.trusted_users:
   190         if (section is None or section == 'trusted') and self.trusted_users:
   203             for user in self.configlist('trusted', 'users'):
   191             for user in self.configlist('trusted', 'users'):