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

Re: svn commit: r40186 - branches/1.6.x-future-proof/subversion/libsvn_wc

From: Hyrum K. Wright <hyrum_at_hyrumwright.org>
Date: Thu, 22 Oct 2009 17:21:16 -0500

I went to the trouble to read the format number so that it would fit
within our existing "oops, I've got a format number higher than I know
what to do with" paradigm. I realize we could just set it to 99 or
something equally as bogus, but that felt too hacky and grabbing the
format number is a single function call.

But frankly, whatever performance difference that exists shouldn't
matter very much anyway, since this is an error condition, and that
condition isn't likely to be hit. (What I *would* like, though, would
be a way to say "you're part of the wc-ng working copy rooted at /bar/
gruff/foo". Oh well.)

-Hyrum

On Oct 22, 2009, at 11:48 AM, Greg Stein wrote:

> Why bother reading the version out of the wc.db? If the file is
> present, then you have a 1.7+ working copy. A simple
> svn_io_check_path() would do the trick.
>
> Cheers,
> -g
>
> On Thu, Oct 22, 2009 at 11:45, Hyrum K. Wright
> <hyrum_at_hyrumwright.org> wrote:
>> Author: hwright
>> Date: Thu Oct 22 08:45:03 2009
>> New Revision: 40186
>>
>> Log:
>> On the 1.6.x-future-proof branch:
>>
>> If we don't discover that we're in a working copy, try and
>> determine if we're
>> in a working copy from the future. In other words, recurse up the
>> directory
>> tree looking for a wc.db, and return it's version number if found.
>>
>> * subversion/libsvn_wc/questions.c
>> (is_inside_wc_ng): New.
>> (svn_wc_check_wc): Check for the wc-ng format, if no other format
>> is found.
>> (svn_wc__check_format): Adjust the error message. Users don't
>> have a
>> snowball's chance in a very hot place of downgrading from 1.7 to
>> 1.6.
>>
>> Modified:
>> branches/1.6.x-future-proof/subversion/libsvn_wc/questions.c
>>
>> Modified: branches/1.6.x-future-proof/subversion/libsvn_wc/
>> questions.c
>> URL: http://svn.collab.net/viewvc/svn/branches/1.6.x-future-proof/subversion/libsvn_wc/questions.c?pathrev=40186&r1=40185&r2=40186
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> =====================================================================
>> --- branches/1.6.x-future-proof/subversion/libsvn_wc/
>> questions.c Thu Oct 22 08:41:17 2009 (r40185)
>> +++ branches/1.6.x-future-proof/subversion/libsvn_wc/
>> questions.c Thu Oct 22 08:45:03 2009 (r40186)
>> @@ -41,8 +41,34 @@
>>
>> #include "svn_private_config.h"
>> #include "private/svn_wc_private.h"
>> +#include "private/svn_sqlite.h"
>>
>>
>> +static svn_error_t *
>> +is_inside_wc_ng(const char *abspath,
>> + int *wc_format,
>> + apr_pool_t *pool)
>> +{
>> + svn_error_t *err;
>> + const char *wc_db_path = svn_path_join_many(pool, abspath,
>> ".svn", "wc.db",
>> + NULL);
>> +
>> + err = svn_sqlite__get_schema_version(wc_format, wc_db_path, pool);
>> + if (!err)
>> + return SVN_NO_ERROR;
>> +
>> + if (err->apr_err == SVN_ERR_SQLITE_ERROR)
>> + svn_error_clear(err);
>> + else
>> + return err;
>> +
>> + if (svn_dirent_is_root(abspath, strlen(abspath)))
>> + return SVN_NO_ERROR;
>> + else
>> + return is_inside_wc_ng(svn_path_dirname(abspath, pool),
>> wc_format, pool);
>> +}
>> +
>> +
>> /* ### todo: make this compare repository too? Or do so in parallel
>> code. */
>> svn_error_t *
>> @@ -95,7 +121,17 @@ svn_wc_check_wc(const char *path,
>> }
>> else if (err)
>> return err;
>> - else
>> +
>> + /* Let's check for the future. */
>> + if (*wc_format == 0)
>> + {
>> + const char *abspath;
>> +
>> + SVN_ERR(svn_path_get_absolute(&abspath, path, pool));
>> + SVN_ERR(is_inside_wc_ng(abspath, wc_format, pool));
>> + }
>> +
>> + if (*wc_format > 0)
>> {
>> /* If we managed to read the format file we assume that we
>> are dealing with a real wc so we can return a nice
>> @@ -125,12 +161,9 @@ svn_wc__check_format(int wc_format, cons
>> least post-1.5 crossgrades will be somewhat less painful. */
>> return svn_error_createf
>> (SVN_ERR_WC_UNSUPPORTED_FORMAT, NULL,
>> - _("This client is too old to work with working copy
>> '%s'. You need\n"
>> - "to get a newer Subversion client, or to downgrade this
>> working "
>> - "copy.\n"
>> - "See "
>> - "http://subversion.tigris.org/faq.html#working-copy-format-change\n
>> "
>> - "for details."
>> + _("The path '%s' appears to be part of a Subversion 1.7
>> or greater\n"
>> + "working copy. Please upgrade your Subversion client
>> to use this\n"
>> + "working copy."
>> ),
>> svn_path_local_style(path, pool));
>> }
>>
>> ------------------------------------------------------
>> http://subversion.tigris.org/ds/viewMessage.do?dsForumId=495&dsMessageId=2410293
>>
>
> ------------------------------------------------------
> http://subversion.tigris.org/ds/viewMessage.do?dsForumId=462&dsMessageId=2410306

------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=462&dsMessageId=2410457
Received on 2009-10-23 00:21:38 CEST

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