[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

[Incomplete PATCH] was Re: Misrepresentation of BerkeleyDB FS module as "base"

From: John Peacock <jpeacock_at_rowman.com>
Date: 2005-04-01 02:23:07 CEST

C. Michael Pilato wrote:
> Yes, yes! You're totally right. Keep the module names, but maybe do
> a little sum'in-sum'in like this:
>
> * fs_base : Module for working with a Berkeley DB (bdb) repository.
> * fs_fs : Module for working with a plain file (fsfs) repository.
>
> But then, on second (actually, third) thought, I actually don't care
> to see the --fs-type-compliant names at all. Just looks ugly.

How does the attached patch look (before I add the same code to the other
commandline apps)? Here's the current output (though that can easily change):

$ subversion/clients/cmdline/svn --version
svn, version 1.2.0 (dev build)
    compiled Mar 31 2005, 17:02:58

Copyright (C) 2000-2004 CollabNet.
Subversion is open source software, see http://subversion.tigris.org/
This product includes software developed by CollabNet (http://www.Collab.Net/).

The following filesystem back-end implementations are available:

* fs_base : can access BerkeleyDB repositories
* fs_fs : can access FSFS (filesystem) repositories

The following repository access (RA) modules are available:

* ra_dav : Module for accessing a repository via WebDAV (DeltaV) protocol.
   - handles 'http' schema
* ra_svn : Module for accessing a repository using the svn network protocol.
   - handles 'svn' schema
* ra_local : Module for accessing a repository on local disk.
   - handles 'file' schema

[[[

Add routine to enumerate the available FS backends and add that to the
--version text for commandline tools.

* subversion/include/svn_fs.h
    (svn_fs_print_fs_modules): New function to enumerate available FS
    backends, based heavily on svn_ra_print_ra_modules().

* subversion/libsvn_fs/fs-loader.c
    (struct fs_type_defn): Add description of FS backends.
    (svn_fs_print_fs_modules): New function to iterate over fs_type_defn and
    return a description string of available backends.

* subversion/clients/cmdline/help-cmd.c
    (print_help): Add call to svn_fs_print_fs_modules() to enumerate
    backends and prepend that information to the RA modules report.

]]]

John

-- 
John Peacock
Director of Information Research and Technology
Rowman & Littlefield Publishing Group
4720 Boston Way
Lanham, MD 20706
301-459-3366 x.5010
fax 301-429-5747

--- subversion/clients/cmdline/help-cmd.c (revision 13189)
+++ subversion/clients/cmdline/help-cmd.c (local)
@@ -25,6 +25,7 @@
 #include "svn_string.h"
 #include "svn_error.h"
 #include "svn_version.h"
+#include "svn_fs.h"
 #include "cl.h"
 
 #include "svn_private_config.h"
@@ -60,19 +61,28 @@
   char *help_header =
     apr_psprintf (pool, gettext (help_header_template), SVN_VER_NUMBER);
 
+ const char *fs_desc_start
+ = _("The following filesystem back-end "
+ "implementations are available:\n\n");
+ svn_stringbuf_t *fs_desc_body, *desc_all;
+
   const char *ra_desc_start
- = _("The following repository access (RA) modules are available:\n\n");
- svn_stringbuf_t *ra_desc_body, *ra_desc_all;
+ = _("\nThe following repository access (RA) modules are available:\n\n");
+ svn_stringbuf_t *ra_desc_body;
 
- ra_desc_all = svn_stringbuf_create (ra_desc_start, pool);
+ desc_all = svn_stringbuf_create (fs_desc_start, pool);
+ SVN_ERR (svn_fs_print_fs_modules (&fs_desc_body, pool));
+ svn_stringbuf_appendstr (desc_all, fs_desc_body);
+
+ svn_stringbuf_appendcstr (desc_all, ra_desc_start);
   SVN_ERR (svn_ra_print_ra_libraries2 (&ra_desc_body, pool));
- svn_stringbuf_appendstr (ra_desc_all, ra_desc_body);
-
+ svn_stringbuf_appendstr (desc_all, ra_desc_body);
+
   return svn_opt_print_help (os,
                              "svn", /* ### erm, derive somehow? */
                              print_version,
                              quiet,
- ra_desc_all->data,
+ desc_all->data,
                              help_header, /* already gettext()'d */
                              svn_cl__cmd_table,
                              svn_cl__options,
--- subversion/include/svn_fs.h (revision 13189)
+++ subversion/include/svn_fs.h (local)
@@ -44,7 +44,16 @@
  */
 const svn_version_t *svn_fs_version (void);
 
+/** @since New in 1.2.
+ *
+ * Return a @a *descriptions string (allocated in @a pool) that is a textual
+ * list of all available FS modules.
+ */
+svn_error_t *
+svn_fs_print_fs_modules (svn_stringbuf_t **descriptions,
+ apr_pool_t *pool);
 
+
 /* Opening and creating filesystems. */
 
 
--- subversion/libsvn_fs/fs-loader.c (revision 13189)
+++ subversion/libsvn_fs/fs-loader.c (local)
@@ -26,6 +26,7 @@
 #include "svn_version.h"
 #include "svn_fs.h"
 #include "svn_path.h"
+#include "svn_pools.h"
 #include "svn_xml.h"
 #include "svn_private_config.h"
 
@@ -51,10 +52,12 @@
 static const struct fs_type_defn {
   const char *fs_type;
   const char *fsap_name;
+ const char *fsap_description;
   fs_init_func_t initfunc;
 } fs_modules[] = {
   {
     SVN_FS_TYPE_BDB, "base",
+ "BerkeleyDB",
 #ifdef SVN_LIBSVN_FS_LINKS_FS_BASE
     svn_fs_base__init
 #endif
@@ -62,6 +65,7 @@
 
   {
     SVN_FS_TYPE_FSFS, "fs",
+ "FSFS (filesystem)",
 #ifdef SVN_LIBSVN_FS_LINKS_FS_FS
     svn_fs_fs__init
 #endif
@@ -907,3 +911,33 @@
 {
   SVN_VERSION_BODY;
 }
+
+svn_error_t *
+svn_fs_print_fs_modules (svn_stringbuf_t **descriptions,
+ apr_pool_t *pool)
+{
+ const struct fs_type_defn *fst;
+ apr_pool_t *iterpool = svn_pool_create (pool);
+ *descriptions = svn_stringbuf_create ("", pool);
+
+ for (fst = fs_modules; fst->fs_type; fst++)
+ {
+ char *line;
+
+ svn_pool_clear (iterpool);
+
+ if (fst->initfunc)
+ {
+ line = apr_psprintf (iterpool,
+ "* fs_%s : can access %s repositories\n",
+ fst->fsap_name,
+ fst->fsap_description);
+ svn_stringbuf_appendcstr (*descriptions, line);
+
+ }
+ }
+
+ svn_pool_destroy (iterpool);
+
+ return SVN_NO_ERROR;
+}
=== subversion/clients/cmdline/help-cmd.c
==================================================================
=== subversion/include/svn_fs.h
==================================================================
=== subversion/libsvn_fs/fs-loader.c
==================================================================

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Fri Apr 1 02:21:12 2005

This is an archived mail posted to the Subversion Dev mailing list.