subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject svn commit: r1654573 - in /subversion/branches/pin-externals/subversion: libsvn_client/copy.c tests/cmdline/externals_tests.py
Date Sat, 24 Jan 2015 19:34:05 GMT
Author: stsp
Date: Sat Jan 24 19:34:05 2015
New Revision: 1654573

URL: http://svn.apache.org/r1654573
Log:
On the pin-externals branch, fix pinning of already pinned externals
which were removed in HEAD.

* subversion/libsvn_client/copy.c
  (pin_externals_prop): Don't blindly search externals in the HEAD revision.
   If the external definition specifies a peg revision, look there instead
   of HEAD. 

* subversion/tests/cmdline/externals_tests.py
  (copy_pin_externals): Verify the above behaviour by removing 'A/D/H'
   from HEAD, which is pointed at by an already pinned external.

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=1654573&r1=1654572&r2=1654573&view=diff
==============================================================================
--- subversion/branches/pin-externals/subversion/libsvn_client/copy.c (original)
+++ subversion/branches/pin-externals/subversion/libsvn_client/copy.c Sat Jan 24 19:34:05
2015
@@ -264,10 +264,28 @@ pin_externals_prop(svn_string_t **pinned
                                                    iterpool));
       SVN_ERR(svn_ra_get_session_url(external_ra_session, &session_url, scratch_pool));
       SVN_DBG(("external ra session url: %s", session_url));
-      SVN_ERR(svn_ra_get_latest_revnum(external_ra_session,
-                                       &external_youngest_rev,
-                                       iterpool));
+      if (item->peg_revision.kind == svn_opt_revision_unspecified ||
+          item->peg_revision.kind == svn_opt_revision_head)
+        {
+          SVN_ERR(svn_ra_get_latest_revnum(external_ra_session,
+                                           &external_youngest_rev,
+                                           iterpool));
+        }
+      else
+        {
+          if (item->peg_revision.kind == svn_opt_revision_date)
+            {
+              item->peg_revision.kind = svn_opt_revision_number;
+              SVN_ERR(svn_ra_get_dated_revision(external_ra_session,
+                                                &item->peg_revision.value.number,
+                                                item->peg_revision.value.date,
+                                                iterpool));
+            }
 
+          SVN_ERR_ASSERT(item->peg_revision.kind == svn_opt_revision_number);
+          external_youngest_rev = item->peg_revision.value.number;
+        }
+        
       SVN_ERR(svn_ra_stat(external_ra_session, "",
                           external_youngest_rev,
                           &dirent,
@@ -331,15 +349,6 @@ pin_externals_prop(svn_string_t **pinned
                                             iterpool));
         }
 
-      if (item->peg_revision.kind == svn_opt_revision_date)
-        {
-          item->peg_revision.kind = svn_opt_revision_number;
-          SVN_ERR(svn_ra_get_dated_revision(external_ra_session,
-                                            &item->peg_revision.value.number,
-                                            item->peg_revision.value.date,
-                                            iterpool));
-        }
-
       if (item->revision.kind != svn_opt_revision_number)
         {
           item->revision.kind = svn_opt_revision_number;
@@ -351,6 +360,9 @@ pin_externals_prop(svn_string_t **pinned
           item->peg_revision.kind = svn_opt_revision_number;
           item->peg_revision.value.number = dirent->created_rev;
         }
+ 
+      SVN_ERR_ASSERT(item->revision.kind == svn_opt_revision_number);
+      SVN_ERR_ASSERT(item->peg_revision.kind == svn_opt_revision_number);
 
       pinned_desc = apr_psprintf(iterpool, "-r%lu %s@%lu %s%s",
                                  item->revision.value.number,

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=1654573&r1=1654572&r2=1654573&view=diff
==============================================================================
--- subversion/branches/pin-externals/subversion/tests/cmdline/externals_tests.py (original)
+++ subversion/branches/pin-externals/subversion/tests/cmdline/externals_tests.py Sat Jan
24 19:34:05 2015
@@ -3554,6 +3554,7 @@ def copy_pin_externals(sbox):
 
   wc_dir         = sbox.wc_dir
   repo_url       = sbox.repo_url
+  other_repo_url = repo_url + ".other"
 
   # Perform a repos->repos copy, pinning externals
   svntest.actions.run_and_verify_svn(None, None, [],
@@ -3565,6 +3566,7 @@ def copy_pin_externals(sbox):
 
   # Verify that externals have been pinned.
   last_changed_rev_gamma = 1
+  last_changed_rev_A = 5
   A_copy_D_path = 'A_copy/D'
   def verify_pinned_externals(base_path_or_url):
     expected_output = [
@@ -3595,7 +3597,9 @@ def copy_pin_externals(sbox):
                                        'propget', 'svn:externals',
                                        target)
     expected_output = [
-      '-r5 %s@5 exdir_A\n' % external_url_for["A/D/exdir_A"],
+      '-r%d %s@%d exdir_A\n' % (last_changed_rev_A,
+                                external_url_for["A/D/exdir_A"],
+                                last_changed_rev_A),
       '-r3 %s@3 exdir_A/G\n' % external_url_for["A/D/exdir_A/G/"],
       '-r1 %s@1 exdir_A/H\n' % external_url_for["A/D/exdir_A/H"],
       '-r4 %s@4 x/y/z/blah\n' % external_url_for["A/D/x/y/z/blah"],
@@ -3703,6 +3707,25 @@ def copy_pin_externals(sbox):
   A_copy_D_path = 'A_copy/D-moved'
   verify_pinned_externals(wc_dir)
 
+  # Clean up.
+  svntest.actions.run_and_verify_svn(None, None, [],
+                                    'revert', '-R', wc_dir)
+  svntest.main.safe_rmtree(os.path.join(wc_dir, 'A_copy'))
+
+  # Test an already pinned external which was removed in HEAD.
+  svntest.actions.run_and_verify_svn(None, None, [],
+                                     'rm',
+                                     other_repo_url + '/A/D/H',
+                                     '-m', 'remove A/D/H')
+  sbox.simple_update()
+  svntest.actions.run_and_verify_svn(None, None, [],
+                                     'copy',
+                                     wc_dir + '/A',
+                                     wc_dir + '/A_copy',
+                                     '--pin-externals')
+  last_changed_rev_A = 6
+  verify_pinned_externals(wc_dir)
+
 
 ########################################################################
 # Run the tests



Mime
View raw message