You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by ph...@apache.org on 2011/07/25 19:59:45 UTC

svn commit: r1150812 - in /subversion/trunk/subversion: libsvn_wc/adm_ops.c tests/cmdline/special_tests.py

Author: philip
Date: Mon Jul 25 17:59:44 2011
New Revision: 1150812

URL: http://svn.apache.org/viewvc?rev=1150812&view=rev
Log:
Fix issue 3972, revert always claims to revert symlinks

* subversion/libsvn_wc/adm_ops.c
  (revert_restore): Move executable/read-only queries closer to the point
   where the values are used, don't do executable processing for symlinks.

* subversion/tests/cmdline/special_tests.py
  (symlink_destination_change): Extend to include a repeat revert.

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

Modified: subversion/trunk/subversion/libsvn_wc/adm_ops.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/adm_ops.c?rev=1150812&r1=1150811&r2=1150812&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/adm_ops.c (original)
+++ subversion/trunk/subversion/libsvn_wc/adm_ops.c Mon Jul 25 17:59:44 2011
@@ -1389,8 +1389,6 @@ revert_restore(svn_wc__db_t *db,
       else if (on_disk == svn_node_file)
         {
           svn_boolean_t modified;
-          svn_boolean_t executable;
-          svn_boolean_t read_only;
           apr_hash_t *props;
 #ifdef HAVE_SYMLINK
           svn_string_t *special_prop;
@@ -1438,11 +1436,6 @@ revert_restore(svn_wc__db_t *db,
                                                          db, local_abspath,
                                                          TRUE, scratch_pool));
 
-              SVN_ERR(svn_io__is_finfo_executable(&executable, &finfo,
-                                                  scratch_pool));
-              SVN_ERR(svn_io__is_finfo_read_only(&read_only, &finfo,
-                                                 scratch_pool));
-
               if (modified)
                 {
                   SVN_ERR(svn_io_remove_file2(local_abspath, FALSE,
@@ -1451,10 +1444,12 @@ revert_restore(svn_wc__db_t *db,
                 }
               else
                 {
+                  svn_boolean_t read_only;
                   svn_string_t *needs_lock_prop;
-#if !defined(WIN32) && !defined(__OS2__)
-                  svn_string_t *executable_prop;
-#endif
+
+                  SVN_ERR(svn_io__is_finfo_read_only(&read_only, &finfo,
+                                                     scratch_pool));
+
                   needs_lock_prop = apr_hash_get(props, SVN_PROP_NEEDS_LOCK,
                                                  APR_HASH_KEY_STRING);
                   if (needs_lock_prop && !read_only)
@@ -1471,19 +1466,31 @@ revert_restore(svn_wc__db_t *db,
                     }
 
 #if !defined(WIN32) && !defined(__OS2__)
-                  executable_prop = apr_hash_get(props, SVN_PROP_EXECUTABLE,
-                                                 APR_HASH_KEY_STRING);
-                  if (executable_prop && !executable)
-                    {
-                      SVN_ERR(svn_io_set_file_executable(local_abspath, TRUE,
-                                                         FALSE, scratch_pool));
-                      notify_required = TRUE;
-                    }
-                  else if (!executable_prop && executable)
+#ifdef HAVE_SYMLINK
+                  if (!special)
+#endif
                     {
-                      SVN_ERR(svn_io_set_file_executable(local_abspath, FALSE,
-                                                         FALSE, scratch_pool));
-                      notify_required = TRUE;
+                      svn_boolean_t executable;
+                      svn_string_t *executable_prop;
+
+                      SVN_ERR(svn_io__is_finfo_executable(&executable, &finfo,
+                                                          scratch_pool));
+                      executable_prop = apr_hash_get(props, SVN_PROP_EXECUTABLE,
+                                                     APR_HASH_KEY_STRING);
+                      if (executable_prop && !executable)
+                        {
+                          SVN_ERR(svn_io_set_file_executable(local_abspath,
+                                                             TRUE, FALSE,
+                                                             scratch_pool));
+                          notify_required = TRUE;
+                        }
+                      else if (!executable_prop && executable)
+                        {
+                          SVN_ERR(svn_io_set_file_executable(local_abspath,
+                                                             FALSE, FALSE,
+                                                             scratch_pool));
+                          notify_required = TRUE;
+                        }
                     }
 #endif
                 }

Modified: subversion/trunk/subversion/tests/cmdline/special_tests.py
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/special_tests.py?rev=1150812&r1=1150811&r2=1150812&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/cmdline/special_tests.py (original)
+++ subversion/trunk/subversion/tests/cmdline/special_tests.py Mon Jul 25 17:59:44 2011
@@ -711,6 +711,7 @@ def unrelated_changed_special_status(sbo
                                      '-m', 'psi changed special status')
 
 
+@Issue(3972)
 @SkipUnless(svntest.main.is_posix_os)
 def symlink_destination_change(sbox):
   "revert a symlink destination change"
@@ -747,6 +748,10 @@ def symlink_destination_change(sbox):
   expected_status.tweak('newfile', status='  ')
   svntest.actions.run_and_verify_status(wc_dir, expected_status)
 
+  # Issue 3972, repeat revert produces no output
+  svntest.actions.run_and_verify_svn(None, [], [], 'revert', '-R', wc_dir)
+  svntest.actions.run_and_verify_status(wc_dir, expected_status)
+
   # Now replace the symlink with a normal file and try to commit, we
 
 #----------------------------------------------------------------------