subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject svn commit: r1186944 - in /subversion/trunk/subversion: libsvn_wc/update_editor.c tests/cmdline/special_tests.py
Date Thu, 20 Oct 2011 17:28:11 GMT
Author: stsp
Date: Thu Oct 20 17:28:11 2011
New Revision: 1186944

URL: http://svn.apache.org/viewvc?rev=1186944&view=rev
Log:
Fix an assertion failure when updating a symlink. The client's method of
determining whether an incoming file is a symlink was faulty.

Reported by: Søren Thing Andersen

* subversion/tests/cmdline/special_tests.py
  (update_symlink): New test. Triggers an assertion failure with 1.7.0.

* subversion/libsvn_wc/update_editor.c
  (close_file): If the status of a symlink doesn't change, the server
   won't send a property change, so don't expect to see a property change
   for svn:special if the update doesn't change the property.
   Also, correctly handle incoming deletion of svn:special, in which
   case the server sends a NULL value for svn:special.

Modified:
    subversion/trunk/subversion/libsvn_wc/update_editor.c
    subversion/trunk/subversion/tests/cmdline/special_tests.py

Modified: subversion/trunk/subversion/libsvn_wc/update_editor.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/update_editor.c?rev=1186944&r1=1186943&r2=1186944&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/update_editor.c (original)
+++ subversion/trunk/subversion/libsvn_wc/update_editor.c Thu Oct 20 17:28:11 2011
@@ -4270,6 +4270,7 @@ close_file(void *file_baton,
 
       {
         int i;
+        svn_boolean_t seen_special_prop = FALSE;
 
         for (i = 0; i < regular_prop_changes->nelts; ++i)
           {
@@ -4278,9 +4279,14 @@ close_file(void *file_baton,
 
             if (strcmp(prop->name, SVN_PROP_SPECIAL) == 0)
               {
-                incoming_is_link = TRUE;
+                seen_special_prop = TRUE;
+                incoming_is_link = (prop->value != NULL);
+                break;
               }
           }
+
+        if (!seen_special_prop)
+         incoming_is_link = local_is_link; 
       }
 
 

Modified: subversion/trunk/subversion/tests/cmdline/special_tests.py
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/special_tests.py?rev=1186944&r1=1186943&r2=1186944&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/cmdline/special_tests.py (original)
+++ subversion/trunk/subversion/tests/cmdline/special_tests.py Thu Oct 20 17:28:11 2011
@@ -860,6 +860,47 @@ def symlink_to_wc_svnversion(sbox):
                                             symlink_path, sbox.repo_url,
                                             [ "1\n" ], [])
 
+# Regression in 1.7.0: Update fails to change a symlink
+@SkipUnless(svntest.main.is_posix_os)
+def update_symlink(sbox):
+  "update a symlink"
+
+  sbox.build()
+  wc_dir = sbox.wc_dir
+  mu_path = sbox.ospath('A/mu')
+  iota_path = sbox.ospath('iota')
+  symlink_path = sbox.ospath('symlink')
+
+  # create a symlink to /A/mu
+  os.symlink("A/mu", symlink_path)
+  sbox.simple_add('symlink')
+  sbox.simple_commit()
+
+  # change the symlink to /iota
+  os.remove(symlink_path)
+  os.symlink("iota", symlink_path)
+  sbox.simple_commit()
+
+  # update back to r2
+  svntest.main.run_svn(False, 'update', '-r', '2', wc_dir)
+
+  # now update to head; 1.7.0 throws an assertion here
+  expected_output = svntest.wc.State(wc_dir, {
+    'symlink'          : Item(status='U '),
+  })
+  expected_disk = svntest.main.greek_state.copy()
+  expected_disk.add({'symlink': Item(contents="This is the file 'iota'.\n",
+                                     props={'svn:special' : '*'})})
+  expected_status = svntest.actions.get_virginal_state(wc_dir, 3)
+  expected_status.add({
+    'symlink'           : Item(status='  ', wc_rev='3'),
+  })
+  svntest.actions.run_and_verify_update(wc_dir,
+                                        expected_output,
+                                        expected_disk,
+                                        expected_status,
+                                        None, None, None,
+                                        None, None, 1)
 
 ########################################################################
 # Run the tests
@@ -887,6 +928,7 @@ test_list = [ None,
               merge_foreign_symlink,
               symlink_to_wc_basic,
               symlink_to_wc_svnversion,
+              update_symlink,
              ]
 
 if __name__ == '__main__':



Mime
View raw message