You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by da...@apache.org on 2010/10/18 06:08:25 UTC

svn commit: r1023647 - in /subversion/trunk/subversion: libsvn_wc/translate.c tests/cmdline/lock_tests.py

Author: danielsh
Date: Mon Oct 18 04:08:24 2010
New Revision: 1023647

URL: http://svn.apache.org/viewvc?rev=1023647&view=rev
Log:
More non-marking as read-only of locally-added files.  This time, for
repos->wc copy with the copy source a file.  (The case of the copy source
being a directory is not yet handled.)

Found by: Paul Maier <sv...@web.de>

* subversion/tests/cmdline/lock_tests.py
  (cp_isnt_ro):  Extend test, and tweak comments.

* subversion/libsvn_wc/translate.c
  (svn_wc__maybe_set_read_only):
    Don't set read-only for status_added files.

Modified:
    subversion/trunk/subversion/libsvn_wc/translate.c
    subversion/trunk/subversion/tests/cmdline/lock_tests.py

Modified: subversion/trunk/subversion/libsvn_wc/translate.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/translate.c?rev=1023647&r1=1023646&r2=1023647&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/translate.c (original)
+++ subversion/trunk/subversion/libsvn_wc/translate.c Mon Oct 18 04:08:24 2010
@@ -376,6 +376,7 @@ svn_wc__maybe_set_read_only(svn_boolean_
                             apr_pool_t *scratch_pool)
 {
   const svn_string_t *needs_lock;
+  svn_wc__db_status_t status;
   svn_wc__db_lock_t *lock;
   svn_error_t *err;
 
@@ -384,7 +385,7 @@ svn_wc__maybe_set_read_only(svn_boolean_
 
   SVN_ERR_ASSERT(svn_dirent_is_absolute(local_abspath));
 
-  err = svn_wc__db_read_info(NULL, NULL, NULL, NULL, NULL, NULL,
+  err = svn_wc__db_read_info(&status, NULL, NULL, NULL, NULL, NULL,
                              NULL, NULL, NULL, NULL, NULL,
                              NULL, NULL, NULL, NULL, NULL, NULL,
                              NULL, NULL, NULL, NULL, NULL, NULL,
@@ -399,6 +400,11 @@ svn_wc__maybe_set_read_only(svn_boolean_
   else if (err)
     return svn_error_return(err);
   else if (lock)
+    /* ### Is this "we have the lock?" */
+    return SVN_NO_ERROR;
+
+  /* Files that aren't in the repository yet should be left writable. */
+  if (status == svn_wc__db_status_added)
     return SVN_NO_ERROR;
 
   SVN_ERR(svn_wc__internal_propget(&needs_lock, db, local_abspath,

Modified: subversion/trunk/subversion/tests/cmdline/lock_tests.py
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/lock_tests.py?rev=1023647&r1=1023646&r2=1023647&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/cmdline/lock_tests.py (original)
+++ subversion/trunk/subversion/tests/cmdline/lock_tests.py Mon Oct 18 04:08:24 2010
@@ -1598,31 +1598,40 @@ def cp_isnt_ro(sbox):
   sbox.build()
   wc_dir = sbox.wc_dir
 
+  mu_URL = sbox.repo_url + '/A/mu'
   mu_path = os.path.join(wc_dir, 'A', 'mu')
   mu2_path = os.path.join(wc_dir, 'A', 'mu2')
+  mu3_path = os.path.join(wc_dir, 'A', 'mu3')
   kappa_path = os.path.join(wc_dir, 'kappa')
   open(kappa_path, 'w').write("This is the file 'kappa'.\n")
 
-  # added file
+  ## added file
   sbox.simple_add(kappa_path)
   svntest.actions.set_prop('svn:needs-lock', 'yes', kappa_path)
   is_writable(kappa_path)
   sbox.simple_commit(kappa_path)
   is_readonly(kappa_path)
 
-  # versioned file
+  ## versioned file
   svntest.actions.set_prop('svn:needs-lock', 'yes', mu_path)
   is_writable(mu_path)
   sbox.simple_commit(mu_path)
   is_readonly(mu_path)
 
-  # added-with-history file (aka uncommitted copied file)
-  svntest.actions.set_prop('svn:needs-lock', 'yes', mu_path)
+  # At this point, mu has 'svn:needs-lock' set
+
+  ## wc->wc copied file
   svntest.main.run_svn(None, 'copy', mu_path, mu2_path)
   is_writable(mu2_path)
   sbox.simple_commit(mu2_path)
   is_readonly(mu2_path)
 
+  ## URL->wc copied file
+  svntest.main.run_svn(None, 'copy', mu_URL, mu3_path)
+  is_writable(mu3_path)
+  sbox.simple_commit(mu3_path)
+  is_readonly(mu3_path)
+
 
 ########################################################################
 # Run the tests