Hearing no dissent, I committed a version of this patch in r1051945.

A typical message is now:

  svn: Please see the 'svn upgrade' command
  svn: Working copy '/home/julianfoad/tmp/svn/walk/wc' is too old
(format 10, created by Subversion 1.6)

- Julian


On Fri, 2010-12-17 at 17:20 +0000, Julian Foad wrote:
> Currently (at r1050442), running a 1.7-dev svn on a 1.6 WC gives:
> 
>   $ svn st
>   svn: Please see the 'svn upgrade' command
>   svn: Working copy format of '/home/julianfoad/src/subversion-n-gamma'
> is too old (10)
> 
> I would like to see a more user-friendly message, giving the version
> number instead of (or as well as) the WC format number, e.g.:
> 
>   $ svn st
>   svn: Please see the 'svn upgrade' command
>   svn: Working copy '/home/julianfoad/src/subversion-n-gamma' is too old
> (format 10, created by svn 1.6)
> 
> Agreed so far?
> 
> The simple way is to embed a (format => version) conversion table in
> libsvn_wc where this message is generated.  Patch attached.
> 
> The more "proper" layered way is for the the client to have that
> knowledge and do that conversion.  That requires somehow passing the
> format number of that WC path to the client.  (Extracting that info from
> the error message is the wrong way, of course - and not portable to
> other locales.)  Lacking parameterized error objects, I can't think of a
> practical way to achieve this.
> 
> I think the simple patch (or something very like it) should be
> acceptable.  What do you think?  If not, any bright ideas how to do it
> better?
> 
> - Julian
> 
> differences between files attachment
> (version-in-wc-format-error-1.patch)
> * subversion/libsvn_wc/upgrade.c
>   (upgrade_to_wcng): 
>   (svn_wc__upgrade_sdb): 
> 
> --This line, and those below, will be ignored--
> 
> Index: subversion/libsvn_wc/upgrade.c
> ===================================================================
> --- subversion/libsvn_wc/upgrade.c    (revision 1050449)
> +++ subversion/libsvn_wc/upgrade.c    (working copy)
> @@ -1309,6 +1309,21 @@ upgrade_to_wcng(void **dir_baton,
>  }
>  
> 
> +/* Return a string indicating the released version (or versions) of
> + * Subversion that used WC format number WC_FORMAT, or else "unknown"
> + * if no released version used WC_FORMAT. */
> +static const char *
> +version_string_from_format(int wc_format)
> +{
> +  switch (wc_format)
> +    {
> +    case 4: return "<=1.3";
> +    case 8: return "1.4";
> +    case 9: return "1.5";
> +    case 10: return "1.6";
> +    }
> +  return _("(development version)");
> +}
>  
>  svn_error_t *
>  svn_wc__upgrade_sdb(int *result_format,
> @@ -1321,15 +1336,18 @@ svn_wc__upgrade_sdb(int *result_format,
>  
>    if (start_format < SVN_WC__WC_NG_VERSION /* 12 */)
>      return svn_error_createf(SVN_ERR_WC_UPGRADE_REQUIRED, NULL,
> -                             _("Working copy format of '%s' is too old 
> (%d)"),
> +                             _("Working copy '%s' is too old (format %d, "
> +                               "created by Subversion %s)"),
>                               svn_dirent_local_style(wcroot_abspath,
>                                                      scratch_pool),
> -                             start_format);
> +                             start_format,
> +                             version_string_from_format(start_format));
>  
>    /* Early WCNG formats no longer supported. */
>    if (start_format < 19)
>      return svn_error_createf(SVN_ERR_WC_UPGRADE_REQUIRED, NULL,
> -                             _("Working copy format of '%s' is too old (%d); 
> "
> +                             _("Working copy '%s' is an old development "
> +                               "version (format %d); to upgrade it, "
>                                 "use a format 18 client, then "
>                                 "use 'tools/dev/wc-ng/bump-to-19.py', then "
>                                 "use the current client"),


Reply via email to