Author: kotkov
Date: Thu Mar 4 16:09:33 2021
New Revision: 1887178
URL: http://svn.apache.org/viewvc?rev=1887178&view=rev
Log:
Fix the update editor so that it would set read-only attributes on files added
during update with svn:needs-lock and without the associated lock in the
working copy.
This is a follow-up to r1886490, where I inadvertently broke this behavior
by passing an incorrect state to the working file writer.
* subversion/libsvn_wc/update_editor.c
(open_working_file_writer): The final read-only state does not depend on
whether the file is being added during the update, or not, so don't take
that into account.
* subversion/tests/cmdline/lock_tests.py
(update_add_file_needs_lock): New regression test.
(update_edit_file_needs_lock): New test.
(test_list): Run the new tests.
Modified:
subversion/trunk/subversion/libsvn_wc/update_editor.c
subversion/trunk/subversion/tests/cmdline/lock_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=1887178&r1=1887177&r2=1887178&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/update_editor.c (original)
+++ subversion/trunk/subversion/libsvn_wc/update_editor.c Thu Mar 4 16:09:33
2021
@@ -3687,7 +3687,7 @@ open_working_file_writer(svn_wc__working
else
final_mtime = -1;
- if (needs_lock && !lock_token && !fb->adding_file)
+ if (needs_lock && !lock_token)
is_readonly = TRUE;
else
is_readonly = FALSE;
Modified: subversion/trunk/subversion/tests/cmdline/lock_tests.py
URL:
http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/lock_tests.py?rev=1887178&r1=1887177&r2=1887178&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/cmdline/lock_tests.py (original)
+++ subversion/trunk/subversion/tests/cmdline/lock_tests.py Thu Mar 4 16:09:33
2021
@@ -2479,6 +2479,36 @@ def replace_dir_with_lots_of_locked_file
# This problem was introduced on the 1.8.x branch in r1606976.
sbox.simple_commit()
+def update_add_file_needs_lock(sbox):
+ "update adding a file with svn:needs-lock"
+
+ sbox.build(empty=True)
+ sbox.simple_mkdir('dir')
+ sbox.simple_add_text('test\n', 'dir/file')
+ sbox.simple_propset('svn:needs-lock', 'yes', 'dir/file')
+ sbox.simple_commit()
+
+ sbox.simple_update(revision=0)
+ sbox.simple_update(revision=1)
+ is_readonly(sbox.ospath('dir/file'))
+
+def update_edit_file_needs_lock(sbox):
+ "update editing a file with svn:needs-lock"
+
+ sbox.build(empty=True)
+ sbox.simple_mkdir('dir')
+ sbox.simple_add_text('test\n', 'dir/file')
+ sbox.simple_commit()
+
+ sbox.simple_append('dir/file', 'edited\n', truncate=True)
+ sbox.simple_propset('svn:needs-lock', 'yes', 'dir/file')
+ sbox.simple_commit()
+
+ sbox.simple_update(revision=1)
+ is_writable(sbox.ospath('dir/file'))
+ sbox.simple_update(revision=2)
+ is_readonly(sbox.ospath('dir/file'))
+
########################################################################
# Run the tests
@@ -2547,6 +2577,8 @@ test_list = [ None,
delete_dir_with_lots_of_locked_files,
delete_locks_on_depth_commit,
replace_dir_with_lots_of_locked_files,
+ update_add_file_needs_lock,
+ update_edit_file_needs_lock,
]
if __name__ == '__main__':