# HG changeset patch # User Marcin Kuzminski # Date 1280964104 -7200 # Node ID eda5f01de3c414c300e3f2d4639e8b90d008ef6d # Parent c8fc57b92a60572e8e0179c382f2691854b55c1e fixes #20 hg middleware breaks ui() instance when repository has hgrc file. hgrc file now updates application ui instance with only those section that are present. diff -r c8fc57b92a60 -r eda5f01de3c4 pylons_app/lib/middleware/simplehg.py --- a/pylons_app/lib/middleware/simplehg.py Tue Aug 03 21:25:53 2010 +0200 +++ b/pylons_app/lib/middleware/simplehg.py Thu Aug 05 01:21:44 2010 +0200 @@ -2,7 +2,7 @@ # encoding: utf-8 # middleware to handle mercurial api calls # Copyright (C) 2009-2010 Marcin Kuzminski - +# # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License # as published by the Free Software Foundation; version 2 @@ -17,14 +17,6 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, # MA 02110-1301, USA. - -""" -Created on 2010-04-28 - -@author: marcink -SimpleHG middleware for handling mercurial protocol request (push/clone etc.) -It's implemented with basic auth function -""" from datetime import datetime from itertools import chain from mercurial.error import RepoError @@ -35,7 +27,7 @@ from pylons_app.lib.auth import authfunc, HasPermissionAnyMiddleware, \ get_user_cached from pylons_app.lib.utils import is_mercurial, make_ui, invalidate_cache, \ - check_repo_fast + check_repo_fast, ui_sections from pylons_app.model import meta from pylons_app.model.db import UserLog, User from webob.exc import HTTPNotFound, HTTPForbidden, HTTPInternalServerError @@ -43,6 +35,14 @@ import os import pylons_app.lib.helpers as h import traceback + +""" +Created on 2010-04-28 + +@author: marcink +SimpleHG middleware for handling mercurial protocol request (push/clone etc.) +It's implemented with basic auth function +""" log = logging.getLogger(__name__) @@ -226,8 +226,25 @@ hgrc = os.path.join(self.repo_path, '.hg', 'hgrc') repoui = make_ui('file', hgrc, False) + if repoui: - #set the repository based config - hgserve.repo.ui = repoui + #overwrite our ui instance with the section from hgrc file + for section in ui_sections: + for k, v in repoui.configitems(section): + hgserve.repo.ui.setconfig(section, k, v) return hgserve + + + + + + + + + + + + + +