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

[PATCH] add version queries and version checks (issue 1861)

From: Edmund Horner <chrysophylax_at_chrysophylax.cjb.net>
Date: 2004-06-12 13:23:40 CEST

Hi, sorry about disappearing for a while. Blame my tendency to
procrastinate...

I've "generalised" the version checking from libsvn_client/version.c and
clients/cmdline/main.c into these libraries:

svn_delta
svn_diff
svn_fs
svn_fs_base
svn_fs_fs
svn_ra
svn_ra_dav
svn_ra_local
svn_ra_svn
svn_repos
svn_wc

Several second-level libraries (svn_fs_base, svn_fs_fs, svn_ra_dav,
svn_ra_local, svn_ra_svn) don't have public include/svn_libname.h files
so I've changed their private header files instead, although I expect
this version checking mechanism needs to be altered for those cases, if
it's warranted at all. Those changes might well be excluded from the patch.

Altered "clients" include:

svnlook
svndumpfilter
svnadmin
svnserve
svnversion
svn-push (because it was there)

This is the first draft, so let me know what's wrong. I'm checking dev@
once a day and am happy to redo the patch if that's asked for.

Cheers,
Edmund.

Patch attached, and log message follows:

[[
Implement library version functions, and check library versions in
command-line clients. Each library features a "svn_libname_version"
function that returns information on the Subversion version the library
is compiled as. Clients call their own "check_lib_versions" (or a
similarly named) function that uses svn_ver_check_list (from
libsvn_subr/version.c) to call the version functions of a list of
libraries, which ensures there as no version mismatches.

This change is a generalisation of r9697 to other libraries and
clients, and fixes issue 1861.

* subversion/libsvn_delta/version.c
* subversion/libsvn_diff/version.c
* subversion/libsvn_fs/version.c
* subversion/libsvn_fs_base/version.c
* subversion/libsvn_fs_fs/version.c
* subversion/libsvn_ra/version.c
* subversion/libsvn_ra_dav/version.c
* subversion/libsvn_ra_local/version.c
* subversion/libsvn_ra_svn/version.c
* subversion/libsvn_repos/version.c
* subversion/libsvn_wc/version.c:
     New files.

* subversion/include/svn_delta.h (svn_delta_version)
* subversion/include/svn_diff.h (svn_diff_version)
* subversion/include/svn_fs.h (svn_fs_version)
* subversion/libsvn_fs_base/fs.h (svn_fs_base_version)
* subversion/libsvn_fs_fs/fs.h (svn_fs_fs_version)
* subversion/include/svn_ra.h (svn_ra_version)
* subversion/libsvn_ra_dav/ra_dav.h (svn_ra_dav_version)
* subversion/libsvn_ra_local/ra_local.h (svn_ra_local_version)
* subversion/include/svn_ra_svn.h (svn_ra_svn_version)
* subversion/include/svn_repos.h (svn_repos_version)
* subversion/include/svn_wc.h (svn_wc_version):
     New function symbols.

* subversion/svnadmin/main.c
* subversion/svnlook/main.c
* subversion/svndumpfilter/main.c
* subversion/svnserve/main.c
* subversion/svnversion/main.c
* contrib/client-side/svn-push/svn-push.c
     (check_lib_versions): New function that checks the compiled
         versions of all svn libraries needed by this client.
     (main): Call check_lib_versions() and exit with failure if library
         versions are not adequate.
]]

Index: subversion/libsvn_fs_base/fs.h
===================================================================
--- subversion/libsvn_fs_base/fs.h (revision 9945)
+++ subversion/libsvn_fs_base/fs.h (working copy)
@@ -30,6 +30,13 @@
 extern "C" {
 #endif /* __cplusplus */
 
+
+/**
+ * Get libsvn_fs_base version information.
+ * @since New in 1.1.
+ */
+const svn_version_t *svn_fs_base_version (void);
+
 
 /*** The filesystem structure. ***/
 
Index: subversion/libsvn_fs_base/version.c
===================================================================
--- subversion/libsvn_fs_base/version.c (revision 0)
+++ subversion/libsvn_fs_base/version.c (revision 0)
@@ -0,0 +1,27 @@
+/*
+ * version.c: library version number
+ *
+ * ====================================================================
+ * Copyright (c) 2000-2004 CollabNet. All rights reserved.
+ *
+ * This software is licensed as described in the file COPYING, which
+ * you should have received as part of this distribution. The terms
+ * are also available at http://subversion.tigris.org/license-1.html.
+ * If newer versions of this license are posted there, you may use a
+ * newer version instead, at your option.
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals. For exact contribution history, see the revision
+ * history and logs, available at http://subversion.tigris.org/.
+ * ====================================================================
+ */
+
+
+
+#include "svn_version.h"
+
+const svn_version_t *
+svn_fs_base_version (void)
+{
+ SVN_VERSION_BODY;
+}

Property changes on: subversion/libsvn_fs_base/version.c
___________________________________________________________________
Name: svn:keywords
   + Id
Name: svn:eol-style
   + native

Index: subversion/libsvn_ra/version.c
===================================================================
--- subversion/libsvn_ra/version.c (revision 0)
+++ subversion/libsvn_ra/version.c (revision 0)
@@ -0,0 +1,27 @@
+/*
+ * version.c: library version number
+ *
+ * ====================================================================
+ * Copyright (c) 2000-2004 CollabNet. All rights reserved.
+ *
+ * This software is licensed as described in the file COPYING, which
+ * you should have received as part of this distribution. The terms
+ * are also available at http://subversion.tigris.org/license-1.html.
+ * If newer versions of this license are posted there, you may use a
+ * newer version instead, at your option.
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals. For exact contribution history, see the revision
+ * history and logs, available at http://subversion.tigris.org/.
+ * ====================================================================
+ */
+
+
+
+#include "svn_version.h"
+
+const svn_version_t *
+svn_ra_version (void)
+{
+ SVN_VERSION_BODY;
+}

Property changes on: subversion/libsvn_ra/version.c
___________________________________________________________________
Name: svn:keywords
   + Id
Name: svn:eol-style
   + native

Index: subversion/svnadmin/main.c
===================================================================
--- subversion/svnadmin/main.c (revision 9945)
+++ subversion/svnadmin/main.c (working copy)
@@ -30,6 +30,7 @@
 #include "svn_config.h"
 #include "svn_repos.h"
 #include "svn_fs.h"
+#include "svn_version.h"
 
 #include "svn_private_config.h"
 
@@ -133,6 +134,24 @@
 }
 
 
+/* Version compatibility check */
+static svn_error_t *
+check_lib_versions (void)
+{
+ static const svn_version_checklist_t checklist[] =
+ {
+ { "svn_subr", svn_subr_version },
+ { "svn_repos", svn_repos_version },
+ { "svn_fs", svn_fs_version },
+ { "svn_delta", svn_delta_version },
+ { NULL, NULL }
+ };
+
+ SVN_VERSION_DEFINE (my_version);
+ return svn_ver_check_list (&my_version, checklist);
+}
+
+
 
 /** Subcommands. **/
 
@@ -866,6 +885,16 @@
   pool = svn_pool_create_ex (NULL, allocator);
   apr_allocator_owner_set (allocator, pool);
 
+ /* Check library versions */
+ err = check_lib_versions ();
+ if (err)
+ {
+ svn_handle_error (err, stderr, FALSE);
+ svn_error_clear (err);
+ svn_pool_destroy (pool);
+ return EXIT_FAILURE;
+ }
+
   if (argc <= 1)
     {
       subcommand_help (NULL, NULL, pool);
Index: subversion/include/svn_diff.h
===================================================================
--- subversion/include/svn_diff.h (revision 9945)
+++ subversion/include/svn_diff.h (working copy)
@@ -50,6 +50,7 @@
 #include "svn_types.h"
 #include "svn_error.h"
 #include "svn_io.h"
+#include "svn_version.h"
 
 #ifdef __cplusplus
 extern "C" {
@@ -57,6 +58,13 @@
 
 
 
+/**
+ * Get libsvn_diff version information.
+ * @since New in 1.1.
+ */
+const svn_version_t *svn_diff_version (void);
+
+
 /* Diffs. */
 
 /** An opaque type that represents a difference between either two or
Index: subversion/include/svn_fs.h
===================================================================
--- subversion/include/svn_fs.h (revision 9945)
+++ subversion/include/svn_fs.h (working copy)
@@ -37,6 +37,13 @@
 #endif /* __cplusplus */
 
 
+/**
+ * Get libsvn_fs version information.
+ * @since New in 1.1.
+ */
+const svn_version_t *svn_fs_version (void);
+
+
 /* Opening and creating filesystems. */
 
 
Index: subversion/include/svn_ra_svn.h
===================================================================
--- subversion/include/svn_ra_svn.h (revision 9945)
+++ subversion/include/svn_ra_svn.h (working copy)
@@ -323,6 +323,12 @@
                                     svn_config_t *pwdb, const char **user,
                                     svn_boolean_t *success);
 
+/**
+ * Get libsvn_ra_svn version information.
+ * @since New in 1.1.
+ */
+const svn_version_t *svn_ra_svn_version (void);
+
 #ifdef __cplusplus
 }
 #endif /* __cplusplus */
Index: subversion/include/svn_repos.h
===================================================================
--- subversion/include/svn_repos.h (revision 9945)
+++ subversion/include/svn_repos.h (working copy)
@@ -29,6 +29,7 @@
 #include "svn_delta.h"
 #include "svn_types.h"
 #include "svn_error.h"
+#include "svn_version.h"
 
 
 #ifdef __cplusplus
@@ -37,6 +38,13 @@
 
 /* ---------------------------------------------------------------*/
 
+/**
+ * Get libsvn_repos version information.
+ * @since New in 1.1.
+ */
+const svn_version_t *svn_repos_version (void);
+
+
 
 /** Callback type for checking authorization on paths produced by (at
  * least) svn_repos_dir_delta().
Index: subversion/include/svn_delta.h
===================================================================
--- subversion/include/svn_delta.h (revision 9945)
+++ subversion/include/svn_delta.h (working copy)
@@ -33,6 +33,7 @@
 #include "svn_string.h"
 #include "svn_error.h"
 #include "svn_io.h"
+#include "svn_version.h"
 
 #ifdef __cplusplus
 extern "C" {
@@ -40,6 +41,13 @@
 
 
 
+/**
+ * Get libsvn_delta version information.
+ * @since New in 1.1.
+ */
+const svn_version_t *svn_delta_version (void);
+
+
 /** Text deltas.
  *
  * A text delta represents the difference between two strings of
Index: subversion/include/svn_wc.h
===================================================================
--- subversion/include/svn_wc.h (revision 9945)
+++ subversion/include/svn_wc.h (working copy)
@@ -50,6 +50,13 @@
 #endif /* __cplusplus */
 
 
+/**
+ * Get libsvn_wc version information.
+ * @since New in 1.1.
+ */
+const svn_version_t *svn_wc_version (void);
+
+
 /* Locking/Opening/Closing */
 
 /** Baton for access to a working copy administrative area.
Index: subversion/include/svn_ra.h
===================================================================
--- subversion/include/svn_ra.h (revision 9945)
+++ subversion/include/svn_ra.h (working copy)
@@ -40,6 +40,13 @@
 
 /* Misc. declarations */
 
+/**
+ * Get libsvn_ra version information.
+ * @since New in 1.1.
+ */
+const svn_version_t *svn_ra_version (void);
+
+
 /** This is a function type which allows the RA layer to fetch working
  * copy (WC) properties.
  *
Index: subversion/libsvn_fs/version.c
===================================================================
--- subversion/libsvn_fs/version.c (revision 0)
+++ subversion/libsvn_fs/version.c (revision 0)
@@ -0,0 +1,27 @@
+/*
+ * version.c: library version number
+ *
+ * ====================================================================
+ * Copyright (c) 2000-2004 CollabNet. All rights reserved.
+ *
+ * This software is licensed as described in the file COPYING, which
+ * you should have received as part of this distribution. The terms
+ * are also available at http://subversion.tigris.org/license-1.html.
+ * If newer versions of this license are posted there, you may use a
+ * newer version instead, at your option.
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals. For exact contribution history, see the revision
+ * history and logs, available at http://subversion.tigris.org/.
+ * ====================================================================
+ */
+
+
+
+#include "svn_version.h"
+
+const svn_version_t *
+svn_fs_version (void)
+{
+ SVN_VERSION_BODY;
+}

Property changes on: subversion/libsvn_fs/version.c
___________________________________________________________________
Name: svn:keywords
   + Id
Name: svn:eol-style
   + native

Index: subversion/libsvn_diff/version.c
===================================================================
--- subversion/libsvn_diff/version.c (revision 0)
+++ subversion/libsvn_diff/version.c (revision 0)
@@ -0,0 +1,27 @@
+/*
+ * version.c: library version number
+ *
+ * ====================================================================
+ * Copyright (c) 2000-2004 CollabNet. All rights reserved.
+ *
+ * This software is licensed as described in the file COPYING, which
+ * you should have received as part of this distribution. The terms
+ * are also available at http://subversion.tigris.org/license-1.html.
+ * If newer versions of this license are posted there, you may use a
+ * newer version instead, at your option.
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals. For exact contribution history, see the revision
+ * history and logs, available at http://subversion.tigris.org/.
+ * ====================================================================
+ */
+
+
+
+#include "svn_version.h"
+
+const svn_version_t *
+svn_diff_version (void)
+{
+ SVN_VERSION_BODY;
+}

Property changes on: subversion/libsvn_diff/version.c
___________________________________________________________________
Name: svn:keywords
   + Id
Name: svn:eol-style
   + native

Index: subversion/libsvn_wc/version.c
===================================================================
--- subversion/libsvn_wc/version.c (revision 0)
+++ subversion/libsvn_wc/version.c (revision 0)
@@ -0,0 +1,27 @@
+/*
+ * version.c: library version number
+ *
+ * ====================================================================
+ * Copyright (c) 2000-2004 CollabNet. All rights reserved.
+ *
+ * This software is licensed as described in the file COPYING, which
+ * you should have received as part of this distribution. The terms
+ * are also available at http://subversion.tigris.org/license-1.html.
+ * If newer versions of this license are posted there, you may use a
+ * newer version instead, at your option.
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals. For exact contribution history, see the revision
+ * history and logs, available at http://subversion.tigris.org/.
+ * ====================================================================
+ */
+
+
+
+#include "svn_version.h"
+
+const svn_version_t *
+svn_wc_version (void)
+{
+ SVN_VERSION_BODY;
+}

Property changes on: subversion/libsvn_wc/version.c
___________________________________________________________________
Name: svn:keywords
   + Id
Name: svn:eol-style
   + native

Index: subversion/libsvn_ra_local/ra_local.h
===================================================================
--- subversion/libsvn_ra_local/ra_local.h (revision 9945)
+++ subversion/libsvn_ra_local/ra_local.h (working copy)
@@ -77,6 +77,17 @@
 
 
 
+/** Miscellaneous routines **/
+
+/**
+ * Get libsvn_ra_local version information.
+ * @since New in 1.1.
+ */
+const svn_version_t *svn_ra_local_version (void);
+
+
+
+
 /** Private routines **/
 
     
Index: subversion/libsvn_ra_local/version.c
===================================================================
--- subversion/libsvn_ra_local/version.c (revision 0)
+++ subversion/libsvn_ra_local/version.c (revision 0)
@@ -0,0 +1,27 @@
+/*
+ * version.c: library version number
+ *
+ * ====================================================================
+ * Copyright (c) 2000-2004 CollabNet. All rights reserved.
+ *
+ * This software is licensed as described in the file COPYING, which
+ * you should have received as part of this distribution. The terms
+ * are also available at http://subversion.tigris.org/license-1.html.
+ * If newer versions of this license are posted there, you may use a
+ * newer version instead, at your option.
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals. For exact contribution history, see the revision
+ * history and logs, available at http://subversion.tigris.org/.
+ * ====================================================================
+ */
+
+
+
+#include "svn_version.h"
+
+const svn_version_t *
+svn_ra_local_version (void)
+{
+ SVN_VERSION_BODY;
+}

Property changes on: subversion/libsvn_ra_local/version.c
___________________________________________________________________
Name: svn:keywords
   + Id
Name: svn:eol-style
   + native

Index: subversion/svnlook/main.c
===================================================================
--- subversion/svnlook/main.c (revision 9945)
+++ subversion/svnlook/main.c (working copy)
@@ -255,7 +255,27 @@
     return SVN_NO_ERROR;
 }
 
+
+/* Version compatibility check */
 static svn_error_t *
+check_lib_versions (void)
+{
+ static const svn_version_checklist_t checklist[] =
+ {
+ { "svn_subr", svn_subr_version },
+ { "svn_repos", svn_repos_version },
+ { "svn_fs", svn_fs_version },
+ { "svn_delta", svn_delta_version },
+ { "svn_diff", svn_diff_version },
+ { NULL, NULL }
+ };
+
+ SVN_VERSION_DEFINE (my_version);
+ return svn_ver_check_list (&my_version, checklist);
+}
+
+
+static svn_error_t *
 get_property (svn_string_t **prop_value /* native */,
               svn_boolean_t need_translation,
               svnlook_ctxt_t *c,
@@ -1811,6 +1831,16 @@
   pool = svn_pool_create_ex (NULL, allocator);
   apr_allocator_owner_set (allocator, pool);
 
+ /* Check library versions */
+ err = check_lib_versions ();
+ if (err)
+ {
+ svn_handle_error (err, stderr, FALSE);
+ svn_error_clear (err);
+ svn_pool_destroy (pool);
+ return EXIT_FAILURE;
+ }
+
   if (argc <= 1)
     {
       subcommand_help (NULL, NULL, pool);
Index: subversion/svndumpfilter/main.c
===================================================================
--- subversion/svndumpfilter/main.c (revision 9945)
+++ subversion/svndumpfilter/main.c (working copy)
@@ -812,6 +812,24 @@
 }
 
 
+/* Version compatibility check */
+static svn_error_t *
+check_lib_versions (void)
+{
+ static const svn_version_checklist_t checklist[] =
+ {
+ { "svn_subr", svn_subr_version },
+ { "svn_repos", svn_repos_version },
+ { "svn_fs", svn_fs_version },
+ { "svn_delta", svn_delta_version },
+ { NULL, NULL }
+ };
+
+ SVN_VERSION_DEFINE (my_version);
+ return svn_ver_check_list (&my_version, checklist);
+}
+
+
 /* qsort-ready comparison function. */
 static int compare_paths (const void *a, const void *b)
 {
@@ -999,6 +1017,16 @@
   pool = svn_pool_create_ex (NULL, allocator);
   apr_allocator_owner_set (allocator, pool);
                   
+ /* Check library versions */
+ err = check_lib_versions ();
+ if (err)
+ {
+ svn_handle_error (err, stderr, FALSE);
+ svn_error_clear (err);
+ svn_pool_destroy (pool);
+ return EXIT_FAILURE;
+ }
+
   if (argc <= 1)
     {
       subcommand_help (NULL, NULL, pool);
Index: subversion/libsvn_repos/version.c
===================================================================
--- subversion/libsvn_repos/version.c (revision 0)
+++ subversion/libsvn_repos/version.c (revision 0)
@@ -0,0 +1,27 @@
+/*
+ * version.c: library version number
+ *
+ * ====================================================================
+ * Copyright (c) 2000-2004 CollabNet. All rights reserved.
+ *
+ * This software is licensed as described in the file COPYING, which
+ * you should have received as part of this distribution. The terms
+ * are also available at http://subversion.tigris.org/license-1.html.
+ * If newer versions of this license are posted there, you may use a
+ * newer version instead, at your option.
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals. For exact contribution history, see the revision
+ * history and logs, available at http://subversion.tigris.org/.
+ * ====================================================================
+ */
+
+
+
+#include "svn_version.h"
+
+const svn_version_t *
+svn_repos_version (void)
+{
+ SVN_VERSION_BODY;
+}

Property changes on: subversion/libsvn_repos/version.c
___________________________________________________________________
Name: svn:keywords
   + Id
Name: svn:eol-style
   + native

Index: subversion/libsvn_ra_svn/version.c
===================================================================
--- subversion/libsvn_ra_svn/version.c (revision 0)
+++ subversion/libsvn_ra_svn/version.c (revision 0)
@@ -0,0 +1,27 @@
+/*
+ * version.c: library version number
+ *
+ * ====================================================================
+ * Copyright (c) 2000-2004 CollabNet. All rights reserved.
+ *
+ * This software is licensed as described in the file COPYING, which
+ * you should have received as part of this distribution. The terms
+ * are also available at http://subversion.tigris.org/license-1.html.
+ * If newer versions of this license are posted there, you may use a
+ * newer version instead, at your option.
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals. For exact contribution history, see the revision
+ * history and logs, available at http://subversion.tigris.org/.
+ * ====================================================================
+ */
+
+
+
+#include "svn_version.h"
+
+const svn_version_t *
+svn_ra_svn_version (void)
+{
+ SVN_VERSION_BODY;
+}

Property changes on: subversion/libsvn_ra_svn/version.c
___________________________________________________________________
Name: svn:keywords
   + Id
Name: svn:eol-style
   + native

Index: subversion/libsvn_delta/version.c
===================================================================
--- subversion/libsvn_delta/version.c (revision 0)
+++ subversion/libsvn_delta/version.c (revision 0)
@@ -0,0 +1,27 @@
+/*
+ * version.c: library version number
+ *
+ * ====================================================================
+ * Copyright (c) 2000-2004 CollabNet. All rights reserved.
+ *
+ * This software is licensed as described in the file COPYING, which
+ * you should have received as part of this distribution. The terms
+ * are also available at http://subversion.tigris.org/license-1.html.
+ * If newer versions of this license are posted there, you may use a
+ * newer version instead, at your option.
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals. For exact contribution history, see the revision
+ * history and logs, available at http://subversion.tigris.org/.
+ * ====================================================================
+ */
+
+
+
+#include "svn_version.h"
+
+const svn_version_t *
+svn_delta_version (void)
+{
+ SVN_VERSION_BODY;
+}

Property changes on: subversion/libsvn_delta/version.c
___________________________________________________________________
Name: svn:keywords
   + Id
Name: svn:eol-style
   + native

Index: subversion/libsvn_ra_dav/ra_dav.h
===================================================================
--- subversion/libsvn_ra_dav/ra_dav.h (revision 9945)
+++ subversion/libsvn_ra_dav/ra_dav.h (working copy)
@@ -698,6 +698,13 @@
                              apr_pool_t *pool);
 
 
+/**
+ * Get libsvn_ra_dav version information.
+ * @since New in 1.1.
+ */
+
+const svn_version_t *svn_ra_dav_version (void);
+
 #ifdef __cplusplus
 }
 #endif /* __cplusplus */
Index: subversion/libsvn_ra_dav/version.c
===================================================================
--- subversion/libsvn_ra_dav/version.c (revision 0)
+++ subversion/libsvn_ra_dav/version.c (revision 0)
@@ -0,0 +1,27 @@
+/*
+ * version.c: library version number
+ *
+ * ====================================================================
+ * Copyright (c) 2000-2004 CollabNet. All rights reserved.
+ *
+ * This software is licensed as described in the file COPYING, which
+ * you should have received as part of this distribution. The terms
+ * are also available at http://subversion.tigris.org/license-1.html.
+ * If newer versions of this license are posted there, you may use a
+ * newer version instead, at your option.
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals. For exact contribution history, see the revision
+ * history and logs, available at http://subversion.tigris.org/.
+ * ====================================================================
+ */
+
+
+
+#include "svn_version.h"
+
+const svn_version_t *
+svn_ra_dav_version (void)
+{
+ SVN_VERSION_BODY;
+}

Property changes on: subversion/libsvn_ra_dav/version.c
___________________________________________________________________
Name: svn:keywords
   + Id
Name: svn:eol-style
   + native

Index: subversion/svnserve/main.c
===================================================================
--- subversion/svnserve/main.c (revision 9945)
+++ subversion/svnserve/main.c (working copy)
@@ -37,6 +37,8 @@
 #include "svn_utf.h"
 #include "svn_path.h"
 #include "svn_opt.h"
+#include "svn_repos.h"
+#include "svn_version.h"
 
 #include "server.h"
 
@@ -195,6 +197,25 @@
 }
 #endif
 
+/* Version compatibility check */
+static svn_error_t *
+check_lib_versions (void)
+{
+ static const svn_version_checklist_t checklist[] =
+ {
+ { "svn_subr", svn_subr_version },
+ { "svn_repos", svn_repos_version },
+ { "svn_fs", svn_fs_version },
+ { "svn_delta", svn_delta_version },
+ { "svn_ra_svn", svn_ra_svn_version },
+ { NULL, NULL }
+ };
+
+ SVN_VERSION_DEFINE (my_version);
+ return svn_ver_check_list (&my_version, checklist);
+}
+
+
 int main(int argc, const char *const *argv)
 {
   enum run_mode run_mode = run_mode_none;
@@ -229,6 +250,16 @@
   /* Create our top-level pool. */
   pool = svn_pool_create(NULL);
 
+ /* Check library versions */
+ err = check_lib_versions ();
+ if (err)
+ {
+ svn_handle_error (err, stderr, FALSE);
+ svn_error_clear (err);
+ svn_pool_destroy (pool);
+ return EXIT_FAILURE;
+ }
+
   apr_getopt_init(&os, pool, argc, argv);
 
   params.root = "/";
Index: subversion/svnversion/main.c
===================================================================
--- subversion/svnversion/main.c (revision 9945)
+++ subversion/svnversion/main.c (working copy)
@@ -157,6 +157,23 @@
 }
 
 
+/* Version compatibility check */
+static svn_error_t *
+check_lib_versions (void)
+{
+ static const svn_version_checklist_t checklist[] =
+ {
+ { "svn_subr", svn_subr_version },
+ { "svn_client", svn_client_version },
+ { "svn_wc", svn_wc_version },
+ { NULL, NULL }
+ };
+
+ SVN_VERSION_DEFINE (my_version);
+ return svn_ver_check_list (&my_version, checklist);
+}
+
+
 /*
  * Why is this not an svn subcommand? I have this vague idea that it could
  * be run as part of the build process, with the output embedded in the svn
@@ -200,6 +217,16 @@
   pool = svn_pool_create_ex (NULL, allocator);
   apr_allocator_owner_set (allocator, pool);
 
+ /* Check library versions */
+ err = check_lib_versions ();
+ if (err)
+ {
+ svn_handle_error (err, stderr, FALSE);
+ svn_error_clear (err);
+ svn_pool_destroy (pool);
+ return EXIT_FAILURE;
+ }
+
   sb.switched = FALSE;
   sb.modified = FALSE;
   sb.committed = FALSE;
Index: subversion/libsvn_fs_fs/fs.h
===================================================================
--- subversion/libsvn_fs_fs/fs.h (revision 9945)
+++ subversion/libsvn_fs_fs/fs.h (working copy)
@@ -27,6 +27,12 @@
 extern "C" {
 #endif /* __cplusplus */
 
+/**
+ * Get libsvn_fs_fs version information.
+ * @since New in 1.1.
+ */
+const svn_version_t *svn_fs_fs_version (void);
+
 
 /*** The filesystem structure. ***/
 
Index: subversion/libsvn_fs_fs/version.c
===================================================================
--- subversion/libsvn_fs_fs/version.c (revision 0)
+++ subversion/libsvn_fs_fs/version.c (revision 0)
@@ -0,0 +1,27 @@
+/*
+ * version.c: library version number
+ *
+ * ====================================================================
+ * Copyright (c) 2000-2004 CollabNet. All rights reserved.
+ *
+ * This software is licensed as described in the file COPYING, which
+ * you should have received as part of this distribution. The terms
+ * are also available at http://subversion.tigris.org/license-1.html.
+ * If newer versions of this license are posted there, you may use a
+ * newer version instead, at your option.
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals. For exact contribution history, see the revision
+ * history and logs, available at http://subversion.tigris.org/.
+ * ====================================================================
+ */
+
+
+
+#include "svn_version.h"
+
+const svn_version_t *
+svn_fs_fs_version (void)
+{
+ SVN_VERSION_BODY;
+}

Property changes on: subversion/libsvn_fs_fs/version.c
___________________________________________________________________
Name: svn:keywords
   + Id
Name: svn:eol-style
   + native

Index: contrib/client-side/svn-push/svn-push.c
===================================================================
--- contrib/client-side/svn-push/svn-push.c (revision 9945)
+++ contrib/client-side/svn-push/svn-push.c (working copy)
@@ -139,7 +139,25 @@
 
   return SVN_NO_ERROR;
 }
+
 
+/* Version compatibility check */
+static svn_error_t *
+check_lib_versions (void)
+{
+ static const svn_version_checklist_t checklist[] =
+ {
+ { "svn_subr", svn_subr_version },
+ { "svn_delta", svn_delta_version },
+ { "svn_ra", svn_ra_version },
+ { NULL, NULL }
+ };
+
+ SVN_VERSION_DEFINE (my_version);
+ return svn_ver_check_list (&my_version, checklist);
+}
+
+
 int
 main (int argc, char *argv[])
 {
@@ -154,6 +172,14 @@
     return EXIT_FAILURE;
 
   top_pool = svn_pool_create (NULL);
+
+ /* Check library versions */
+ error = check_lib_versions ();
+ if (error)
+ {
+ svn_handle_error (error, stderr, 0);
+ return EXIT_FAILURE;
+ }
 
 #define CMD_LINE_ERROR \
         { \

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Sat Jun 12 13:25:07 2004

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

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.