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 2012/05/28 11:05:59 UTC

svn commit: r1343168 - in /subversion/trunk/subversion: libsvn_wc/adm_ops.c tests/cmdline/revert_tests.py

Author: philip
Date: Mon May 28 09:05:58 2012
New Revision: 1343168

URL: http://svn.apache.org/viewvc?rev=1343168&view=rev
Log:
* subversion/libsvn_wc/adm_ops.c
  (revert_restore): Only handle svn:needs-lock if status is normal.

* subversion/tests/cmdline/revert_tests.py
  (revert_permissions_only: Extend.

Found by: Fergus Slorach <su...@gmail.com>

Modified:
    subversion/trunk/subversion/libsvn_wc/adm_ops.c
    subversion/trunk/subversion/tests/cmdline/revert_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=1343168&r1=1343167&r2=1343168&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/adm_ops.c (original)
+++ subversion/trunk/subversion/libsvn_wc/adm_ops.c Mon May 28 09:05:58 2012
@@ -1805,25 +1805,30 @@ revert_restore(svn_wc__db_t *db,
                 }
               else
                 {
-                  svn_boolean_t read_only;
-                  svn_string_t *needs_lock_prop;
+                  if (status == svn_wc__db_status_normal)
+                    {
+                      svn_boolean_t read_only;
+                      svn_string_t *needs_lock_prop;
 
-                  SVN_ERR(svn_io__is_finfo_read_only(&read_only, &finfo,
-                                                     scratch_pool));
+                      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)
-                    {
-                      SVN_ERR(svn_io_set_file_read_only(local_abspath,
-                                                        FALSE, scratch_pool));
-                      notify_required = TRUE;
-                    }
-                  else if (!needs_lock_prop && read_only)
-                    {
-                      SVN_ERR(svn_io_set_file_read_write(local_abspath,
-                                                         FALSE, scratch_pool));
-                      notify_required = TRUE;
+                      needs_lock_prop = apr_hash_get(props, SVN_PROP_NEEDS_LOCK,
+                                                     APR_HASH_KEY_STRING);
+                      if (needs_lock_prop && !read_only)
+                        {
+                          SVN_ERR(svn_io_set_file_read_only(local_abspath,
+                                                            FALSE,
+                                                            scratch_pool));
+                          notify_required = TRUE;
+                        }
+                      else if (!needs_lock_prop && read_only)
+                        {
+                          SVN_ERR(svn_io_set_file_read_write(local_abspath,
+                                                             FALSE,
+                                                             scratch_pool));
+                          notify_required = TRUE;
+                        }
                     }
 
 #if !defined(WIN32) && !defined(__OS2__)

Modified: subversion/trunk/subversion/tests/cmdline/revert_tests.py
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/revert_tests.py?rev=1343168&r1=1343167&r2=1343168&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/cmdline/revert_tests.py (original)
+++ subversion/trunk/subversion/tests/cmdline/revert_tests.py Mon May 28 09:05:58 2012
@@ -1208,6 +1208,17 @@ def revert_permissions_only(sbox):
                                        'revert', sbox.ospath('A/B/E/beta'))
     is_executable(sbox.ospath('A/B/E/beta'))
 
+  # copied file is always writeable
+  sbox.simple_update()
+  expected_output = ["A         %s\n" % sbox.ospath('A/B/E2')]
+  svntest.actions.run_and_verify_svn(None, expected_output, [], 'copy',
+                                     sbox.ospath('A/B/E'),
+                                     sbox.ospath('A/B/E2'))
+  is_writable(sbox.ospath('A/B/E2/alpha'))
+  svntest.actions.run_and_verify_svn(None, [], [],
+                                     'revert', sbox.ospath('A/B/E2/alpha'))
+  is_writable(sbox.ospath('A/B/E2/alpha'))
+
 @XFail()
 @Issue(3851)
 def revert_copy_depth_files(sbox):