[prev in list] [next in list] [prev in thread] [next in thread] 

List:       subversion-cvs
Subject:    svn commit: rev 1611 - trunk trunk/subversion/mod_dav_svn
From:       bcollins () tigris ! org
Date:       2002-03-31 23:13:40
[Download RAW message or body]

Author: bcollins
Date: 2002-03-31 23:13 GMT
New Revision: 1611

Modified:
   trunk/CHANGES
   trunk/subversion/mod_dav_svn/dav_svn.h
   trunk/subversion/mod_dav_svn/mod_dav_svn.c
   trunk/subversion/mod_dav_svn/repos.c
Log:
"Please pass the cheese diff". Simple little feature patch for a
SVNRepoName directive in mod_dav_svn. I have several repos on one server,
and it's nice to have a descriptive name when browsing it.

  * mod_dav_svn/dav_svn.h

    (dav_svn_dir_conf): Add repo_name member.

    (dav_svn_repo_name)(dav_svn_get_repo_name): New functions to pass the
      repository name from the configuration.

  * mod_dav_svn/dav_svn.h

    (dav_svn_repos): Add repo_name member.

  * mod_dav_svn/mod_dav_svn.c:

    (dav_svn_get_resource): Prepend SVNRepoName to the "Revision" line, if
      present in the per-repo config.


Modified: trunk/subversion/mod_dav_svn/mod_dav_svn.c
==============================================================================
--- trunk/subversion/mod_dav_svn/mod_dav_svn.c	(original)
+++ trunk/subversion/mod_dav_svn/mod_dav_svn.c	Sun Mar 31 17:13:36 2002
@@ -45,7 +45,7 @@
 /* per-dir configuration */
 typedef struct {
   const char *fs_path;          /* path to the SVN FS */
-
+  const char *repo_name;        /* repository name */
 } dav_svn_dir_conf;
 
 #define INHERIT_VALUE(parent, child, field) \
@@ -115,10 +115,21 @@
     newconf = apr_pcalloc(p, sizeof(*newconf));
 
     newconf->fs_path = INHERIT_VALUE(parent, child, fs_path);
+    newconf->repo_name = INHERIT_VALUE(parent, child, repo_name);
 
     return newconf;
 }
 
+static const char *dav_svn_repo_name(cmd_parms *cmd, void *config,
+                                     const char *arg1)
+{
+  dav_svn_dir_conf *conf = config;
+
+  conf->repo_name = apr_pstrdup(cmd->pool, arg1);
+
+  return NULL;
+}
+
 static const char *dav_svn_path_cmd(cmd_parms *cmd, void *config,
                                     const char *arg1)
 {
@@ -171,6 +182,14 @@
     return conf->fs_path;
 }
 
+const char *dav_svn_get_repo_name(request_rec *r)
+{
+    dav_svn_dir_conf *conf;
+
+    conf = ap_get_module_config(r->per_dir_config, &dav_svn_module);
+    return conf->repo_name;
+}
+
 const char *dav_svn_get_special_uri(request_rec *r)
 {
     dav_svn_server_conf *conf;
@@ -194,6 +213,10 @@
   AP_INIT_TAKE1("SVNSpecialURI", dav_svn_special_uri_cmd, NULL, RSRC_CONF,
                 "specify the URI component for special Subversion "
                 "resources"),
+
+  /* per directory/location */
+  AP_INIT_TAKE1("SVNRepoName", dav_svn_repo_name, NULL, ACCESS_CONF,
+                "specify the name of a Subversion repository"),
 
   { NULL }
 };

Modified: trunk/subversion/mod_dav_svn/dav_svn.h
==============================================================================
--- trunk/subversion/mod_dav_svn/dav_svn.h	(original)
+++ trunk/subversion/mod_dav_svn/dav_svn.h	Sun Mar 31 17:13:37 2002
@@ -72,6 +72,9 @@
   /* This records the filesystem path to the SVN FS */
   const char *fs_path;
 
+  /* The name of this repository */
+  const char *repo_name;
+
   /* the open repository */
   svn_repos_t *repos;
 

Modified: trunk/subversion/mod_dav_svn/repos.c
==============================================================================
--- trunk/subversion/mod_dav_svn/repos.c	(original)
+++ trunk/subversion/mod_dav_svn/repos.c	Sun Mar 31 17:13:37 2002
@@ -835,6 +835,7 @@
                                         dav_resource **resource)
 {
   const char *fs_path;
+  const char *repo_name;
   dav_resource_combined *comb;
   dav_svn_repos *repos;
   apr_size_t len1;
@@ -858,6 +859,8 @@
                            "of this resource's repository.");
     }
 
+  repo_name = dav_svn_get_repo_name(r);
+
   comb = apr_pcalloc(r->pool, sizeof(*comb));
   comb->res.info = &comb->priv;
   comb->res.hooks = &dav_svn_hooks_repos;
@@ -949,6 +952,9 @@
   /* where is the SVN FS for this resource? */
   repos->fs_path = fs_path;
 
+  /* A name for the repository */
+  repos->repo_name = repo_name;
+
   /* Remember various bits for later URL construction */
   repos->base_url = ap_construct_url(r->pool, "", r);
   repos->special_uri = dav_svn_get_special_uri(r);
@@ -1488,6 +1494,11 @@
     if (SVN_IS_VALID_REVNUM(resource->info->root.rev))
       title = apr_psprintf(resource->pool, "Revision %ld: %s",
                            resource->info->root.rev, title);
+
+    if (resource->info->repos->repo_name)
+      title = apr_psprintf(resource->pool, "%s - %s",
+                          resource->info->repos->repo_name,
+                          title);
 
     bb = apr_brigade_create(resource->pool);
     ap_fprintf(output, bb, "<html><head><title>%s</title></head>\n"

Modified: trunk/CHANGES
==============================================================================
--- trunk/CHANGES	(original)
+++ trunk/CHANGES	Sun Mar 31 17:13:38 2002
@@ -1,3 +1,8 @@
+Version x.xx.x (unreleased)
+
+ User-visible changes:
+ * Added SVNRepoName directive to mod_dav_svn
+
 Version 0.10.2 (released 25 Mar 2002, revision 1587)
 
  User-visible changes:


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic