Remove the svn_parent_path config value, and replace it with a root_parents
config value, which can handle CVS repositories as well as Subversion ones. git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@872 8cb11bc2-c004-0410-86c3-e597b4017df7remotes/tags/1.0.0-rc1
parent
648ac31eb3
commit
4d6369388e
|
@ -43,7 +43,8 @@ import fnmatch
|
|||
class Config:
|
||||
_sections = ('general', 'options', 'cvsdb', 'templates')
|
||||
_force_multi_value = ('cvs_roots', 'forbidden', 'disable_enscript_lang',
|
||||
'svn_roots', 'languages', 'kv_files')
|
||||
'svn_roots', 'languages', 'kv_files',
|
||||
'root_parents')
|
||||
|
||||
def __init__(self):
|
||||
for section in self._sections:
|
||||
|
@ -148,7 +149,7 @@ class Config:
|
|||
|
||||
self.general.cvs_roots = { }
|
||||
self.general.svn_roots = { }
|
||||
self.general.svn_parent_path = None
|
||||
self.general.root_parents = []
|
||||
self.general.default_root = ''
|
||||
self.general.rcs_path = ''
|
||||
if sys.platform == "win32":
|
||||
|
|
|
@ -2703,22 +2703,38 @@ def handle_config():
|
|||
else:
|
||||
cfg.load_config(pathname, None)
|
||||
|
||||
# special handling for svn_parent_path. any subdirectories
|
||||
# present in the directory specified as the svn_parent_path that
|
||||
# have a child file named "format" will be treated as svn_roots.
|
||||
if cfg.general.svn_parent_path is not None:
|
||||
pp = cfg.general.svn_parent_path
|
||||
# special handling for root_parents. Each item in root_parents is
|
||||
# a "directory : repo_type" string. For each item in
|
||||
# root_parents, we get a list of the subdirectories.
|
||||
#
|
||||
# If repo_type is "cvs", and the subdirectory contains a child
|
||||
# "CVSROOT/config", then it is added to cvs_roots.
|
||||
#
|
||||
# If repo_type is "svn", and the subdirectory contains a child
|
||||
# "format", then it is added to svn_roots.
|
||||
for pp in cfg.general.root_parents:
|
||||
pos = string.rfind(pp, ':')
|
||||
if pos < 0:
|
||||
raise debug.ViewcvsException(
|
||||
"The path '%s' in 'root_parents' does not include a "
|
||||
"repository type." % pp)
|
||||
pp, repo_type = map(string.strip, (pp[:pos], pp[pos+1:]))
|
||||
|
||||
try:
|
||||
subpaths = os.listdir(pp)
|
||||
except OSError:
|
||||
raise debug.ViewcvsException(
|
||||
"The setting for 'svn_parent_path' does not refer to "
|
||||
"a valid directory.")
|
||||
"The path '%s' in 'root_parents' does not refer to "
|
||||
"a valid directory." % pp)
|
||||
|
||||
for subpath in subpaths:
|
||||
if os.path.exists(os.path.join(pp, subpath)) \
|
||||
and os.path.exists(os.path.join(pp, subpath, "format")):
|
||||
cfg.general.svn_roots[subpath] = os.path.join(pp, subpath)
|
||||
if os.path.exists(os.path.join(pp, subpath)):
|
||||
if repo_type == 'cvs' and \
|
||||
os.path.exists(os.path.join(pp, subpath, "CVSROOT", "config")):
|
||||
cfg.general.cvs_roots[subpath] = os.path.join(pp, subpath)
|
||||
elif repo_type == 'svn' and \
|
||||
os.path.exists(os.path.join(pp, subpath, "format")):
|
||||
cfg.general.svn_roots[subpath] = os.path.join(pp, subpath)
|
||||
|
||||
debug.t_end('load-config')
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
#
|
||||
# cvs_roots (for CVS)
|
||||
# svn_roots (for Subversion)
|
||||
# svn_parent_path (for Subversion)
|
||||
# root_parents (for CVS or Subversion)
|
||||
# default_root
|
||||
# rcs_path or cvsnt_exe_path
|
||||
# mime_types_file
|
||||
|
@ -79,22 +79,26 @@ cvs_roots = cvs: /home/cvsroot
|
|||
#
|
||||
#svn_roots = svn: /home/svnrepos
|
||||
|
||||
#
|
||||
# The 'svn_parent_path' is a directory in which any number of
|
||||
# Subversion repositories may reside. Rather than force you to add a
|
||||
# new entry to 'svn_roots' each time you create a new repository,
|
||||
# ViewCVS rewards you for putting all your Subversion repositories in
|
||||
# a single parent directory by allowing you to simply specifiy that
|
||||
# parent directory. ViewCVS will then notice each Subversion
|
||||
# The 'root_parents' setting specifies a list of directories in which
|
||||
# any number of repositories may reside. Rather than force you to add
|
||||
# a new entry to 'cvs_roots' or 'svn_roots' each time you create a new
|
||||
# repository, ViewCVS rewards you for organising all your repositories
|
||||
# under a few parent directories by allowing you to simply specifiy
|
||||
# just those parent directories. ViewCVS will then notice each
|
||||
# repository in that directory as a new root whose name is the
|
||||
# subdirectory of the parent path in which that repository lives.
|
||||
#
|
||||
# You can specify multiple parent paths separated by commas or new lines.
|
||||
#
|
||||
# Caution: these names can, of course, clash with names you have
|
||||
# defined in your cvs_roots or svn_roots configuration items. If this
|
||||
# occurs, you can either rename the offending repository on disk, or
|
||||
# grant new names to the clashing item in cvs_roots or svn_roots.
|
||||
# Each parent path is processed sequentially, so repositories under
|
||||
# later parent paths may override earlier ones.
|
||||
#
|
||||
#svn_parent_path = /home/svn-repositories
|
||||
#root_parents = /home/svn-repositories : svn,
|
||||
# /home/cvs-repositories : cvs
|
||||
|
||||
# this is the name of the default root.
|
||||
default_root = cvs
|
||||
|
|
Loading…
Reference in New Issue