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

Re: Automatic upgrading of WC versions and the pain it causes

From: Malcolm Rowe <malcolm-svn-dev_at_farside.org.uk>
Date: 2006-04-11 18:28:43 CEST

On Tue, Apr 11, 2006 at 02:24:22PM +0200, Peter N. Lundblad wrote:
> Max Bowsher writes:
> > Your suggestion of a local mod to maybe_upgrade_format() is a partial
> > solution, though it carries with it the disadvantages of needing to keep
> > a lurking local mod around in working copies, and to continually avoid
> > accidentally committing or reverting it.
>
> What about adding a configure time option for this? It seems to be
> most interesting for developers anyway, and it avoids a confusing
> option for users.
>

I like that idea. How about the attached?

The only disadvantage of doing it this way is that the application doesn't
clean up the working copy lock when it exits, which arguably it could.
But I don't see a real problem with that.

[[[
Provide a configure-time option to disable automatic working copy format
upgrades.

* configure.in
  Add the --disable-wc-upgrade option.

* subversion/libsvn_wc/lock.c
  (maybe_upgrade_format): If SVN_DISABLE_WC_UPGRADE is set, replace the
    implementation of this function with a version that refuses to update
    working copies instead.
]]]

Regards,
Malcolm

Index: configure.in
===================================================================
--- configure.in (revision 19298)
+++ configure.in (working copy)
@@ -494,6 +494,19 @@ AC_HELP_STRING([--enable-maintainer-mode
 ])
 
 
+AC_ARG_ENABLE(wc-upgrade,
+AC_HELP_STRING([--disable-wc-upgrade],
+ [Disable automatic working copy format upgrades.
+ This option is primarily of use to Subversion developers.]),
+[
+ if test "$enableval" = "no" ; then
+ AC_DEFINE([SVN_DISABLE_WC_UPGRADE], 1,
+ [Defined if automatic working copy format upgrades should
+ be disabled.])
+ fi
+])
+
+
 AC_ARG_ENABLE(gprof,
 AC_HELP_STRING([--enable-gprof],
                [Produce gprof profiling data in 'gmon.out' (GCC only).]),
Index: subversion/libsvn_wc/lock.c
===================================================================
--- subversion/libsvn_wc/lock.c (revision 19298)
+++ subversion/libsvn_wc/lock.c (working copy)
@@ -94,6 +94,8 @@ do_close(svn_wc_adm_access_t *adm_access
          svn_boolean_t recurse);
 
 
+#ifndef SVN_DISABLE_WC_UPGRADE
+
 /* Write, to LOG_ACCUM, log entries to convert an old WC that did not have
    propcaching into a WC that uses propcaching. Do this conversion for
    the directory of ADM_ACCESS and its file children. Use POOL for
@@ -201,12 +203,39 @@ maybe_upgrade_format(svn_wc_adm_access_t
         SVN_ERR(svn_io_write_version_file(path, SVN_WC__VERSION, pool));
 
       adm_access->wc_format = SVN_WC__VERSION;
+ }
+
+ return SVN_NO_ERROR;
+}
+
+#else
+
+/* Alternate version of the above for use when Working copy upgrades
+ are disabled. Return an error if the working copy described by
+ ADM_ACCESS is not at the latest 'SVN_WC__VERSION'. Use POOL for all
+ temporary allocation. */
+static svn_error_t *
+maybe_upgrade_format(svn_wc_adm_access_t *adm_access, apr_pool_t *pool)
+{
+ SVN_ERR(svn_wc__check_format(adm_access->wc_format,
+ adm_access->path,
+ pool));
 
+ if (adm_access->wc_format != SVN_WC__VERSION)
+ {
+ return svn_error_createf(SVN_ERR_WC_UNSUPPORTED_FORMAT, NULL,
+ "Would upgrade working copy '%s' from old "
+ "format (%d) to current format (%d),\n"
+ "but automatic upgrade has been disabled",
+ svn_path_local_style(adm_access->path, pool),
+ adm_access->wc_format, SVN_WC__VERSION);
     }
 
   return SVN_NO_ERROR;
 }
 
+#endif
+
 
 /* Create a physical lock file in the admin directory for ADM_ACCESS. Wait
    up to WAIT_FOR seconds if the lock already exists retrying every

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Tue Apr 11 18:29:20 2006

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.