[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: Greg Stein <gstein_at_gmail.com>
Date: Thu, 22 Oct 2009 12:48:30 -0400

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
Received on 2009-10-22 18:48:44 CEST

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.