Remove no-longer-used svn_*_get_mergeinfo_for_tree APIs.
[svn.git] / subversion / libsvn_subr / version.c
blob61fa006c52fc32dbe89be0ba33cceb0df2f15a9e
1 /*
2 * version.c: library version number and utilities
4 * ====================================================================
5 * Copyright (c) 2000-2004 CollabNet. All rights reserved.
7 * This software is licensed as described in the file COPYING, which
8 * you should have received as part of this distribution. The terms
9 * are also available at http://subversion.tigris.org/license-1.html.
10 * If newer versions of this license are posted there, you may use a
11 * newer version instead, at your option.
13 * This software consists of voluntary contributions made by many
14 * individuals. For exact contribution history, see the revision
15 * history and logs, available at http://subversion.tigris.org/.
16 * ====================================================================
21 #include "svn_error.h"
22 #include "svn_version.h"
24 #include "svn_private_config.h"
26 const svn_version_t *
27 svn_subr_version(void)
29 SVN_VERSION_BODY;
33 svn_boolean_t svn_ver_compatible(const svn_version_t *my_version,
34 const svn_version_t *lib_version)
36 if (lib_version->tag[0] != '\0')
37 /* Development library; require exact match. */
38 return svn_ver_equal(my_version, lib_version);
39 else if (my_version->tag[0] != '\0')
40 /* Development client; must be newer than the library
41 and have the same major and minor version. */
42 return (my_version->major == lib_version->major
43 && my_version->minor == lib_version->minor
44 && my_version->patch > lib_version->patch);
45 else
46 /* General compatibility rules for released versions. */
47 return (my_version->major == lib_version->major
48 && my_version->minor <= lib_version->minor);
52 svn_boolean_t svn_ver_equal(const svn_version_t *my_version,
53 const svn_version_t *lib_version)
55 return (my_version->major == lib_version->major
56 && my_version->minor == lib_version->minor
57 && my_version->patch == lib_version->patch
58 && 0 == strcmp(my_version->tag, lib_version->tag));
62 svn_error_t *
63 svn_ver_check_list(const svn_version_t *my_version,
64 const svn_version_checklist_t *checklist)
66 svn_error_t *err = SVN_NO_ERROR;
67 int i;
69 for (i = 0; checklist[i].label != NULL; ++i)
71 const svn_version_t *lib_version = checklist[i].version_query();
72 if (!svn_ver_compatible(my_version, lib_version))
73 err = svn_error_createf(SVN_ERR_VERSION_MISMATCH, err,
74 _("Version mismatch in '%s':"
75 " found %d.%d.%d%s,"
76 " expected %d.%d.%d%s"),
77 checklist[i].label,
78 lib_version->major, lib_version->minor,
79 lib_version->patch, lib_version->tag,
80 my_version->major, my_version->minor,
81 my_version->patch, my_version->tag);
84 return err;