Author: hwright
Date: Wed Nov 25 17:52:19 2009
New Revision: 884219

URL: http://svn.apache.org/viewvc?rev=884219&view=rev
Log:
Reintegrate the 1.6.x-future-proof branch:

 * ^/subversion/branches/1.6.x-future-proof
   Make 1.6.7 (and subsequent Subversion releases) recognize Subversion 1.7+
   working copies.
   Justification:
     Throwing a decent error is a Good Thing, especially in a world where we
     are getting ready to drastically alter the way working copies are stored
     and recognized.
   Votes:
     +1: hwright, arfrever, cmpilato

Modified:
    subversion/branches/1.6.x/   (props changed)
    subversion/branches/1.6.x/CHANGES   (props changed)
    subversion/branches/1.6.x/STATUS
    subversion/branches/1.6.x/subversion/libsvn_wc/questions.c

Propchange: subversion/branches/1.6.x/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Wed Nov 25 17:52:19 2009
@@ -1,3 +1,4 @@
+/subversion/branches/1.6.x-future-proof:880259-884209
 /subversion/trunk:879688,880274-880275,880474,881905
 subversion/branches/1.5.x-r30215:870312
 subversion/branches/1.6.x-UNC-paths:876471-876545

Propchange: subversion/branches/1.6.x/CHANGES
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Wed Nov 25 17:52:19 2009
@@ -1,3 +1,4 @@
+/subversion/branches/1.6.x-future-proof/CHANGES:880259-884209
 /subversion/trunk/CHANGES:879688,880274-880275,880474,881905
 subversion/branches/1.5.x-r30215/CHANGES:870312
 subversion/branches/1.6.x-UNC-paths/CHANGES:876471-876545

Modified: subversion/branches/1.6.x/STATUS
URL: 
http://svn.apache.org/viewvc/subversion/branches/1.6.x/STATUS?rev=884219&r1=884218&r2=884219&view=diff
==============================================================================
--- subversion/branches/1.6.x/STATUS (original)
+++ subversion/branches/1.6.x/STATUS Wed Nov 25 17:52:19 2009
@@ -183,13 +183,3 @@
 
 Approved changes:
 =================
-
- * ^/subversion/branches/1.6.x-future-proof
-   Make 1.6.7 (and subsequent Subversion releases) recognize Subversion 1.7+
-   working copies.
-   Justification:
-     Throwing a decent error is a Good Thing, especially in a world where we
-     are getting ready to drastically alter the way working copies are stored
-     and recognized.
-   Votes:
-     +1: hwright, arfrever, cmpilato

Modified: subversion/branches/1.6.x/subversion/libsvn_wc/questions.c
URL: 
http://svn.apache.org/viewvc/subversion/branches/1.6.x/subversion/libsvn_wc/questions.c?rev=884219&r1=884218&r2=884219&view=diff
==============================================================================
--- subversion/branches/1.6.x/subversion/libsvn_wc/questions.c (original)
+++ subversion/branches/1.6.x/subversion/libsvn_wc/questions.c Wed Nov 25 
17:52:19 2009
@@ -41,8 +41,44 @@
 
 #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,
+                const char *target_path,
+                int *wc_format,
+                apr_pool_t *pool)
+{
+  svn_node_kind_t kind;
+  const char *wc_db_path = svn_path_join_many(pool, abspath, ".svn", "wc.db",
+                                              NULL);
+
+  SVN_ERR(svn_io_check_path(wc_db_path, &kind, pool));
+
+  if (kind == svn_node_file)
+    {
+      /* This value is completely bogus, but it is much higher than 1.6 will
+         have any prayer of reading. */
+      *wc_format = 9999;
+
+      return svn_error_createf(SVN_ERR_WC_UNSUPPORTED_FORMAT, NULL,
+         _("The path '%s' appears to be part of a Subversion 1.7 or greater\n"
+           "working copy rooted at '%s'.\n"
+           "Please upgrade your Subversion client to use this working copy."
+           ),
+         svn_path_local_style(target_path, pool),
+         svn_path_local_style(abspath, pool));
+    }
+
+  if (svn_dirent_is_root(abspath, strlen(abspath)))
+    return SVN_NO_ERROR;
+  else
+    return is_inside_wc_ng(svn_path_dirname(abspath, pool), target_path,
+                           wc_format, pool);
+}
+
+
 /* ### todo: make this compare repository too?  Or do so in parallel
    code.  */
 svn_error_t *
@@ -95,7 +131,17 @@
     }
   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, path, 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 +171,9 @@
          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));
     }


Reply via email to