Add gnc_get_long_version, a guint concocted by adding the version values together allowing two digits for each. Add a new version value, GNUNCASH_NANO_VERSION, to be incremented when there's any change to data serialization. Use the new gnc_get_long_version to tag the Gnucash version in the versions table in the dbi backend.

git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@20202 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
John Ralls 2011-01-29 23:38:10 +00:00
parent e2c04cbbd4
commit 725e14eb17
5 changed files with 21 additions and 3 deletions

View File

@ -24,6 +24,10 @@ AC_INIT([GnuCash], [2.4.0], [gnucash-devel@gnucash.org])
AC_CONFIG_HEADERS(config.h)
AC_CONFIG_SRCDIR(src/engine/Transaction.h)
#Change this in development versions when changing anything that
#affects stored data structures. Reset to zero when bumping version.
GNUCASH_NANO_VERSION=0
# Initialize automake -- make sure we have at least version 1.9
AM_INIT_AUTOMAKE([1.9 dist-bzip2])
@ -67,6 +71,7 @@ AC_SUBST(GCONF_SCHEMA_CONFIG_SOURCE_DIRONLY)
AC_SUBST(GNUCASH_MAJOR_VERSION)
AC_SUBST(GNUCASH_MINOR_VERSION)
AC_SUBST(GNUCASH_MICRO_VERSION)
AC_SUBST(GNUCASH_NANO_VERSION)
AC_SUBST(GNUCASH_LATEST_STABLE_SERIES)
AC_DEFINE_UNQUOTED(GNUCASH_MAJOR_VERSION, $GNUCASH_MAJOR_VERSION,
@ -75,6 +80,8 @@ AC_DEFINE_UNQUOTED(GNUCASH_MINOR_VERSION, $GNUCASH_MINOR_VERSION,
[GnuCash Minor version number])
AC_DEFINE_UNQUOTED(GNUCASH_MICRO_VERSION, $GNUCASH_MICRO_VERSION,
[GnuCash Micro version number])
AC_DEFINE_UNQUOTED(GNUCASH_NANO_VERSION, $GNUCASH_NANO_VERSION,
[GnuCash Nano version number])
AC_DEFINE_UNQUOTED(GNUCASH_LATEST_STABLE_SERIES, "$GNUCASH_LATEST_STABLE_SERIES",
[Most recent stable GnuCash series])

View File

@ -285,7 +285,7 @@ test_dbi_version_control( const gchar* driver, const gchar* url )
QofBook *book;
QofBackend *qbe;
QofBackendError err;
gint ourversion = gnc_get_svn_version();
gint ourversion = gnc_get_long_version();
printf( "Testing safe save %s\n", driver );

View File

@ -494,7 +494,7 @@ gnc_sql_sync_all( GncSqlBackend* be, /*@ dependent @*/ QofBook *book )
ENTER( "book=%p, primary=%p", book, be->primary_book );
update_progress( be );
(void)reset_version_info( be );
gnc_sql_set_table_version( be, "Gnucash", gnc_get_svn_version() );
gnc_sql_set_table_version( be, "Gnucash", gnc_get_long_version() );
gnc_sql_set_table_version( be, "Gnucash-Resave", GNC_RESAVE_VERSION );
/* Create new tables */
@ -609,7 +609,7 @@ gnc_sql_commit_edit( GncSqlBackend *be, QofInstance *inst )
gboolean is_dirty;
gboolean is_destroying;
gboolean is_infant;
const gint gnc_version = gnc_get_svn_version();
const gint gnc_version = gnc_get_long_version();
g_return_if_fail( be != NULL );
g_return_if_fail( inst != NULL );

View File

@ -88,3 +88,12 @@ gnc_get_svn_version (void)
{
return strtol(GNUCASH_SVN_REV, NULL, 10);
}
guint
gnc_get_long_version()
{
return GNUCASH_MAJOR_VERSION * 1000000 +
GNUCASH_MINOR_VERSION * 10000 +
GNUCASH_MICRO_VERSION * 100 +
GNUCASH_NANO_VERSION;
}

View File

@ -40,6 +40,8 @@ void gnc_set_extra(gboolean enabled);
void gnc_set_gconf_path(const gchar *prefix);
const gchar *gnc_get_gconf_path(void);
guint gnc_get_long_version( void );
gint gnc_get_svn_version(void);
#endif /* GNC_MAIN_H */