You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by kf...@apache.org on 2021/01/28 20:56:39 UTC

svn commit: r1885997 - in /subversion/trunk/subversion: svn/propedit-cmd.c tests/cmdline/prop_tests.py

Author: kfogel
Date: Thu Jan 28 20:56:39 2021
New Revision: 1885997

URL: http://svn.apache.org/viewvc?rev=1885997&view=rev
Log:
Distinguish between regular properties and revprops in tmpfile name.

* subversion/svn/propedit-cmd.c 
  (svn_cl__propedit): In the revprop case, create a tmpfile name that
   indicates that a revprop is being edited and on which revision.

* subversion/tests/cmdline/prop_tests.py 
  (tmpfile_name_matches_prop_type): New test function.
  (test_list): Run it.

Review by: danielsh

Modified:
    subversion/trunk/subversion/svn/propedit-cmd.c
    subversion/trunk/subversion/tests/cmdline/prop_tests.py

Modified: subversion/trunk/subversion/svn/propedit-cmd.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/svn/propedit-cmd.c?rev=1885997&r1=1885996&r2=1885997&view=diff
==============================================================================
--- subversion/trunk/subversion/svn/propedit-cmd.c (original)
+++ subversion/trunk/subversion/svn/propedit-cmd.c Thu Jan 28 20:56:39 2021
@@ -143,7 +143,9 @@ svn_cl__propedit(apr_getopt_t *os,
       SVN_ERR(svn_cmdline__edit_string_externally(
                &propval, NULL,
                opt_state->editor_cmd, temp_dir,
-               propval, "svn-prop",
+               propval, 
+               apr_psprintf(pool, "svn-revprop-r%ld",
+                            opt_state->start_revision.value.number),
                ctx->config,
                svn_prop_needs_translation(pname),
                opt_state->encoding, pool));

Modified: subversion/trunk/subversion/tests/cmdline/prop_tests.py
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/prop_tests.py?rev=1885997&r1=1885996&r2=1885997&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/cmdline/prop_tests.py (original)
+++ subversion/trunk/subversion/tests/cmdline/prop_tests.py Thu Jan 28 20:56:39 2021
@@ -2829,6 +2829,38 @@ def prop_conflict_root(sbox):
                                         expected_status,
                                         extra_files=extra_files)
 
+
+# Test that editing a regular property creates a temporary file named
+# "svn-prop.tmp" whereas editing a revprop results in a temporary file
+# named "svn-revprop-rN.tmp" (where "N" is the number of the revision
+# whose revprop would be edited).
+def tmpfile_name_matches_prop_type(sbox):
+  "propedit tmpfile name matches property type"
+
+  sbox.build(read_only=True)
+
+  # We want the editor invocation to fail -- all we care about is the
+  # name of the tmpfile left over after that failure.  I'm guessing
+  # you don't have a editor named this on your system:
+  non_editor = 'af968da2ce9'
+
+  svntest.actions.run_and_verify_svn(
+    None,
+    '.*' + re.escape(non_editor) + r'.*svn-revprop-r1\.tmp.*',
+    'propedit', '--revprop', 
+    '--editor-cmd', non_editor,
+    '-r1', 'svn:log',
+    sbox.repo_url)
+
+  svntest.actions.run_and_verify_svn(
+    None,
+    '.*' + re.escape(non_editor) + r'.*svn-prop\.tmp.*',
+    'propedit', 
+    '--editor-cmd', non_editor,
+    'ignored-propname',
+    sbox.ospath('A/mu'))
+
+
 ########################################################################
 # Run the tests
 
@@ -2880,6 +2912,7 @@ test_list = [ None,
               iprops_list_abspath,
               wc_propop_on_url,
               prop_conflict_root,
+              tmpfile_name_matches_prop_type,
              ]
 
 if __name__ == '__main__':