Add a "prefix" configuration option
This patch adds a "prefix" configuration option, so repositories created with recursion are named with a prefix. This can be useful to disambiguate between repositories that are named the same but live in different directories.
This commit is contained in:
parent
53155e566a
commit
9c8a6d2408
19
git-arr
19
git-arr
@ -50,6 +50,7 @@ def load_config(path):
|
|||||||
'rootdiff': 'yes',
|
'rootdiff': 'yes',
|
||||||
'desc': '',
|
'desc': '',
|
||||||
'recursive': 'no',
|
'recursive': 'no',
|
||||||
|
'prefix': '',
|
||||||
'commits_in_summary': '10',
|
'commits_in_summary': '10',
|
||||||
'commits_per_page': '50',
|
'commits_per_page': '50',
|
||||||
'max_pages': '250',
|
'max_pages': '250',
|
||||||
@ -68,23 +69,27 @@ def load_config(path):
|
|||||||
# Do a first pass for general sanity checking and recursive expansion.
|
# Do a first pass for general sanity checking and recursive expansion.
|
||||||
for s in config.sections():
|
for s in config.sections():
|
||||||
if config.getboolean(s, 'recursive'):
|
if config.getboolean(s, 'recursive'):
|
||||||
for path in os.listdir(config.get(s, 'path')):
|
root = config.get(s, 'path')
|
||||||
fullpath = find_git_dir(config.get(s, 'path') + '/' + path)
|
prefix = config.get(s, 'prefix')
|
||||||
|
|
||||||
|
for path in os.listdir(root):
|
||||||
|
fullpath = find_git_dir(root + '/' + path)
|
||||||
if not fullpath:
|
if not fullpath:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
if os.path.exists(fullpath + '/disable_gitweb'):
|
if os.path.exists(fullpath + '/disable_gitweb'):
|
||||||
continue
|
continue
|
||||||
|
|
||||||
if config.has_section(path):
|
section = prefix + path
|
||||||
|
if config.has_section(section):
|
||||||
continue
|
continue
|
||||||
|
|
||||||
config.add_section(path)
|
config.add_section(section)
|
||||||
for opt, value in config.items(s, raw = True):
|
for opt, value in config.items(s, raw = True):
|
||||||
config.set(path, opt, value)
|
config.set(section, opt, value)
|
||||||
|
|
||||||
config.set(path, 'path', fullpath)
|
config.set(section, 'path', fullpath)
|
||||||
config.set(path, 'recursive', 'no')
|
config.set(section, 'recursive', 'no')
|
||||||
|
|
||||||
# This recursive section is no longer useful.
|
# This recursive section is no longer useful.
|
||||||
config.remove_section(s)
|
config.remove_section(s)
|
||||||
|
Loading…
Reference in New Issue
Block a user