You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by st...@apache.org on 2014/12/08 16:38:52 UTC

svn commit: r1643844 - in /subversion/branches/pin-externals/subversion: libsvn_client/copy.c tests/cmdline/externals_tests.py

Author: stsp
Date: Mon Dec  8 15:38:51 2014
New Revision: 1643844

URL: http://svn.apache.org/r1643844
Log:
On the pin-externals branch: Don't crash when setting externals within a copy.

* subversion/libsvn_client/copy.c
  (path_driver_cb_func): When setting a new svn:externals value, open the
   target directory if it wasn't already opened, and close it afterwards.

Modified:
    subversion/branches/pin-externals/subversion/libsvn_client/copy.c
    subversion/branches/pin-externals/subversion/tests/cmdline/externals_tests.py

Modified: subversion/branches/pin-externals/subversion/libsvn_client/copy.c
URL: http://svn.apache.org/viewvc/subversion/branches/pin-externals/subversion/libsvn_client/copy.c?rev=1643844&r1=1643843&r2=1643844&view=diff
==============================================================================
--- subversion/branches/pin-externals/subversion/libsvn_client/copy.c (original)
+++ subversion/branches/pin-externals/subversion/libsvn_client/copy.c Mon Dec  8 15:38:51 2014
@@ -973,9 +973,24 @@ path_driver_cb_func(void **dir_baton,
 
   if (path_info->externals)
     {
+      svn_boolean_t opened_dir = FALSE;
+
+      if (*dir_baton == NULL)
+        {
+          SVN_ERR(cb_baton->editor->open_directory(path, parent_baton,
+                                                   SVN_INVALID_REVNUM,
+                                                   pool, dir_baton));
+          opened_dir = TRUE;
+        }
+
       SVN_DBG(("New externals for %s: %s", path_info->dst_path, path_info->externals->data));
       SVN_ERR(cb_baton->editor->change_dir_prop(*dir_baton, SVN_PROP_EXTERNALS,
                                                 path_info->externals, pool));
+      if (opened_dir)
+        {
+          SVN_ERR(cb_baton->editor->close_directory(*dir_baton, pool));
+          *dir_baton = NULL;
+        }
     }
 
   return SVN_NO_ERROR;

Modified: subversion/branches/pin-externals/subversion/tests/cmdline/externals_tests.py
URL: http://svn.apache.org/viewvc/subversion/branches/pin-externals/subversion/tests/cmdline/externals_tests.py?rev=1643844&r1=1643843&r2=1643844&view=diff
==============================================================================
--- subversion/branches/pin-externals/subversion/tests/cmdline/externals_tests.py (original)
+++ subversion/branches/pin-externals/subversion/tests/cmdline/externals_tests.py Mon Dec  8 15:38:51 2014
@@ -3479,6 +3479,32 @@ def switch_relative_externals(sbox):
   svntest.actions.run_and_verify_svn(None, None, [],
                                      'up', wc)
 
+def pin_externals(sbox):
+  "test svn copy --pin-externals"
+
+  externals_test_setup(sbox)
+
+  wc_dir         = sbox.wc_dir
+  repo_url       = sbox.repo_url
+
+  # Perform a repos->repos copy, pinning externals
+  svntest.actions.run_and_verify_svn(None, None, [],
+                                     'copy',
+                                     repo_url + '/A',
+                                     repo_url + '/A_copy',
+                                     '-m', 'copy',
+                                     '--pin-externals')
+
+  # Create a working copy.
+  svntest.actions.run_and_verify_svn(None, None, [],
+                                     'checkout',
+                                     repo_url, wc_dir)
+
+  # Perform a repos->wc copy, pinning externals
+
+  # Perform a wc->repos copy, pinning externals
+
+  # Perform a wc->wc copy, pinning externals
 
 ########################################################################
 # Run the tests
@@ -3538,6 +3564,7 @@ test_list = [ None,
               update_external_peg_rev,
               update_deletes_file_external,
               switch_relative_externals,
+              pin_externals,
              ]
 
 if __name__ == '__main__':