New config option: ui.report_untrusted (defaults to True)
authorThomas Arendsen Hein <thomas@intevation.de>
Mon, 25 Jun 2007 22:41:15 +0200
changeset 4717 97369f6a6bb6
parent 4716 36d23de02da1
child 4718 934275cd4526
New config option: ui.report_untrusted (defaults to True)
doc/hgrc.5.txt
mercurial/cmdutil.py
mercurial/ui.py
--- a/doc/hgrc.5.txt	Mon Jun 25 22:08:10 2007 +0200
+++ b/doc/hgrc.5.txt	Mon Jun 25 22:41:15 2007 +0200
@@ -452,6 +452,9 @@
     Reduce the amount of output printed.  True or False.  Default is False.
   remotecmd;;
     remote command to use for clone/push/pull operations. Default is 'hg'.
+  report_untrusted;;
+    Warn if a .hg/hgrc file is ignored due to not being owned by a
+    trusted user or group.  True or False.  Default is True.
   slash;;
     Display paths using a slash ("/") as the path separator.  This only
     makes a difference on systems where the default path separator is not
--- a/mercurial/cmdutil.py	Mon Jun 25 22:08:10 2007 +0200
+++ b/mercurial/cmdutil.py	Mon Jun 25 22:41:15 2007 +0200
@@ -275,7 +275,13 @@
     # remember how to call 'hg' before changing the working dir
     util.set_hgexecutable(argv0)
 
-    # check for cwd first
+    # read --config before doing anything else
+    # (e.g. to change trust settings for reading .hg/hgrc)
+    config = earlygetopt(['--config'], args)
+    if config:
+        ui.updateopts(config=parseconfig(config))
+
+    # check for cwd
     cwd = earlygetopt(['--cwd'], args)
     if cwd:
         os.chdir(cwd[-1])
@@ -325,8 +331,7 @@
         atexit.register(print_time)
 
     ui.updateopts(options["verbose"], options["debug"], options["quiet"],
-                 not options["noninteractive"], options["traceback"],
-                 parseconfig(options["config"]))
+                 not options["noninteractive"], options["traceback"])
 
     if options['help']:
         return commands.help_(ui, cmd, options['version'])
--- a/mercurial/ui.py	Mon Jun 25 22:08:10 2007 +0200
+++ b/mercurial/ui.py	Mon Jun 25 22:41:15 2007 +0200
@@ -199,13 +199,15 @@
                     if path and "://" not in path and not os.path.isabs(path):
                         cdata.set("paths", n, os.path.join(root, path))
 
-        # update quiet/verbose/debug and interactive status
+        # update verbosity/interactive/report_untrusted settings
         if section is None or section == 'ui':
             if name is None or name in ('quiet', 'verbose', 'debug'):
                 self.verbosity_constraints()
-
             if name is None or name == 'interactive':
                 self.interactive = self.configbool("ui", "interactive", True)
+            if name is None or name == 'report_untrusted':
+                self.report_untrusted = (
+                    self.configbool("ui", "report_untrusted", True))
 
         # update trust information
         if (section is None or section == 'trusted') and self.trusted_users: