From 5e89bc99f6632f1111307d02ff68e1751caf170c Mon Sep 17 00:00:00 2001 From: dakkar Date: Sat, 17 Jan 2009 17:59:35 +0100 Subject: patch from lu_zero, for cgit groups --- gitosis/cgit.py | 36 ++++++++++++++++++++++-------------- 1 file changed, 22 insertions(+), 14 deletions(-) diff --git a/gitosis/cgit.py b/gitosis/cgit.py index 0e85154..c98c2a2 100644 --- a/gitosis/cgit.py +++ b/gitosis/cgit.py @@ -44,29 +44,37 @@ def generate_project_list_fp(config, fp): enable = getboolean_default(config, section, 'cgit', global_enable) - print >> fp, '#section: %s, local: %d'%(sectiontitle[1],enable) - if not enable: continue + groupname = get_default(config, section, 'cgit_group', "") + grouped_section.setdefault(groupname,[]).append(section) - name = sectiontitle[1] + for groupname, group in grouped_sections.iteritems(): + if groupname + print >> fp, 'repo.group=%s'%(groupname) - fullpath = _repository_path(log, repositories, name, name) + for section in group: + sectiontitle = section.split(None, 1) + print >> fp, '#section: %s, local: %d'%(sectiontitle[1],enable) - print >> fp, 'repo.url=%s'%(name) + name = sectiontitle[1] - if fullpath is None: - continue + fullpath = _repository_path(log, repositories, name, name) - print >> fp, 'repo.path=%s'%(fullpath) + print >> fp, 'repo.url=%s'%(name) - for field_pair in field_map.iteritems(): - try: - field_value = config.get(section, field_pair[0]) - except (NoSectionError, NoOptionError): + if fullpath is None: continue - else: - print >> fp, '%s=%s'%(field_pair[1],field_value) + + print >> fp, 'repo.path=%s'%(fullpath) + + for field_pair in field_map.iteritems(): + try: + field_value = config.get(section, field_pair[0]) + except (NoSectionError, NoOptionError): + continue + else: + print >> fp, '%s=%s'%(field_pair[1],field_value) def _repository_path(log, repositories, name, default_value): """ -- cgit v1.2.3