Author: danielsh
Date: Tue May 17 12:30:03 2011
New Revision: 1104192

URL: http://svn.apache.org/viewvc?rev=1104192&view=rev
Log:
Add .svn/entries and .svn/format files to wc-ng working copies, in order
to yield clearer error message with pre-1.7 clients.

* subversion/libsvn_wc/wc.h
  (SVN_WC__NON_ENTRIES, SVN_WC__NON_ENTRIES_STRING): New.

* subversion/libsvn_wc/adm_files.c
  (init_adm): Create the files for new working copies.

* subversion/libsvn_wc/workqueue.c
  (run_postupgrade): Create the files during upgrade.

Modified:
    subversion/trunk/subversion/libsvn_wc/adm_files.c
    subversion/trunk/subversion/libsvn_wc/wc.h
    subversion/trunk/subversion/libsvn_wc/workqueue.c

Modified: subversion/trunk/subversion/libsvn_wc/adm_files.c
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/adm_files.c?rev=1104192&r1=1104191&r2=1104192&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/adm_files.c (original)
+++ subversion/trunk/subversion/libsvn_wc/adm_files.c Tue May 17 12:30:03 2011
@@ -396,12 +396,24 @@ init_adm(svn_wc__db_t *db,
   /** Init the tmp area. ***/
   SVN_ERR(init_adm_tmp_area(local_abspath, pool));
 
-  /* Lastly, create the SDB.  */
+  /* Create the SDB. */
   SVN_ERR(svn_wc__db_init(db, local_abspath,
                           repos_relpath, repos_root_url, repos_uuid,
                           initial_rev, depth,
                           pool));
 
+  /* Stamp ENTRIES and FORMAT files for old clients.  */
+  SVN_ERR(svn_io_file_create(svn_wc__adm_child(local_abspath,
+                                               SVN_WC__ADM_ENTRIES,
+                                               pool),
+                             SVN_WC__NON_ENTRIES_STRING,
+                             pool));
+  SVN_ERR(svn_io_file_create(svn_wc__adm_child(local_abspath,
+                                               SVN_WC__ADM_FORMAT,
+                                               pool),
+                             SVN_WC__NON_ENTRIES_STRING,
+                             pool));
+
   return SVN_NO_ERROR;
 }
 

Modified: subversion/trunk/subversion/libsvn_wc/wc.h
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/wc.h?rev=1104192&r1=1104191&r2=1104192&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wc.h (original)
+++ subversion/trunk/subversion/libsvn_wc/wc.h Tue May 17 12:30:03 2011
@@ -166,6 +166,11 @@ extern "C" {
    rules. See issue #2475. */
 #define SVN_WC__CHANGED_CANONICAL_URLS 10
 
+/* The format number written to wc-ng working copies so that old clients
+   can recognize them as "newer Subversion"'s working copies. */
+#define SVN_WC__NON_ENTRIES 11
+#define SVN_WC__NON_ENTRIES_STRING "11\n"
+
 /* A version < this uses the old 'entries' file mechanism.  */
 #define SVN_WC__WC_NG_VERSION 12
 

Modified: subversion/trunk/subversion/libsvn_wc/workqueue.c
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/workqueue.c?rev=1104192&r1=1104191&r2=1104192&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/workqueue.c (original)
+++ subversion/trunk/subversion/libsvn_wc/workqueue.c Tue May 17 12:30:03 2011
@@ -563,9 +563,38 @@ run_postupgrade(svn_wc__db_t *db,
                 void *cancel_baton,
                 apr_pool_t *scratch_pool)
 {
+  const char *entries_path;
+  const char *format_path;
+  const char *wcroot_abspath;
+  const char *adm_path;
+  const char *temp_path;
+
   SVN_ERR(svn_wc__wipe_postupgrade(wri_abspath, FALSE,
                                    cancel_func, cancel_baton, scratch_pool));
 
+  SVN_ERR(svn_wc__db_get_wcroot(&wcroot_abspath, db, wri_abspath,
+                                scratch_pool, scratch_pool));
+
+  adm_path = svn_wc__adm_child(wcroot_abspath, NULL, scratch_pool);
+  entries_path = svn_wc__adm_child(wcroot_abspath, SVN_WC__ADM_ENTRIES,
+                                   scratch_pool);
+  format_path = svn_wc__adm_child(wcroot_abspath, SVN_WC__ADM_FORMAT,
+                                   scratch_pool);
+
+  /* Write the 'format' and 'entries' files.
+     ### The order may matter for some sufficiently old clients.. but
+         this code only runs during upgrade after the files had been
+         removed earlier during the upgrade. */
+  SVN_ERR(svn_io_write_unique(&temp_path, adm_path, SVN_WC__NON_ENTRIES_STRING,
+                              sizeof(SVN_WC__NON_ENTRIES),
+                              svn_io_file_del_none, scratch_pool));
+  SVN_ERR(svn_io_file_rename(temp_path, format_path, scratch_pool));
+
+  SVN_ERR(svn_io_write_unique(&temp_path, adm_path, SVN_WC__NON_ENTRIES_STRING,
+                              sizeof(SVN_WC__NON_ENTRIES),
+                              svn_io_file_del_none, scratch_pool));
+  SVN_ERR(svn_io_file_rename(temp_path, entries_path, scratch_pool));
+
   return SVN_NO_ERROR;
 }
 


Reply via email to