[PATCH 1 of 2] Fix hgwebdir after 9858477ed74cce9dc8f4069f9453a1bda0e13ba1 broke it

Benoit Boissinot benoit.boissinot at ens-lyon.org
Wed Aug 8 16:00:39 CDT 2007


On Mon, Aug 06, 2007 at 10:22:39PM -0700, Eric M. Hopper wrote:
> On Mon, 2007-08-06 at 23:43 +0200, Benoit Boissinot wrote:
> > On 8/6/07, Eric Hopper <hopper at omnifarious.org> wrote:
> > > 2 files changed, 24 insertions(+), 8 deletions(-)
> > > mercurial/commands.py     |    2 +-
> > > mercurial/hgweb/server.py |   30 +++++++++++++++++++++++-------
> > >
> > >
> > Why not use this simpler patch ?
> 
> Because in most cases the config entries you really want are in the
> webdir config even when you have a repo available.  You basically want
> the repo to override the webdir settings if it has any config entries
> that would.
> 
> So, unless there's a way to combine the config entries from two ui
> instances in a clean way, this is what I choose.

I'm pretty sure that 

repo.ui.config(section, var, ui.config(section, var, default))
is equivalent to
repo.ui.config(section, var, default)
since the repo.ui object inherits the options from the global ui object.

(and my testing confirm this)

Your patch does the following:

+    def create_getconfig(section, *uis): # uis are least significant to most
+        def getconfig(var, default = None):
+            val = default
+            for u in uis:
+                val = u.config(section, var, val)
+            return val
+ [snip]
+    if repo is None:
+        getconfig, getconfigbool = create_getconfig("web", ui)
+    else:
+        getconfig, getconfigbool = create_getconfig("web", ui, repo.ui)

so what you really need is just choosing the ui object between repo.ui
and ui.

Anyway thanks for you effort, I pushed the patch to -stable (I modified it
a little to apply, and fixed a coding style issue).

regards,

Benoit
-- 
:wq


More information about the Mercurial-devel mailing list