This small patch makes it so that when you do 'svn propedit --revprop', the 
tmpfile's name is "svn-revprop-rN.tmp" (where N is the number of the revision 
whose revprop is being edited).

For regular properties, nothing has changed: the tmpfile name is still just 
"svn-prop.tmp".

This change is useful because many editors display the file's basename during 
editing (e.g., in a status line somewhere near the bottom of the screen).  So 
if you get interrupted while editing a revprop, when you come back to your 
editor hours or days later, it's nice to have as many clues as possible as to 
what you were doing :-).

Comments welcome.  It passes all tests, and I *think* it should be a pretty 
uncontroversial improvement, but I wanted to run it by you all before 
committing since it's been a while (~12 years?) since my most recent 
substantive change to code or test suite.

Best regards,
-Karl

[[[
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.
]]]

Index: subversion/svn/propedit-cmd.c
===================================================================
--- subversion/svn/propedit-cmd.c       (revision 1885919)
+++ subversion/svn/propedit-cmd.c       (working copy)
@@ -143,7 +143,9 @@
       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));
Index: subversion/tests/cmdline/prop_tests.py
===================================================================
--- subversion/tests/cmdline/prop_tests.py      (revision 1885919)
+++ subversion/tests/cmdline/prop_tests.py      (working copy)
@@ -2829,6 +2829,33 @@
                                         expected_status,
                                         extra_files=extra_files)
 
+
+# Test that editing a regular property results in a temporary file
+# based on the name "svn-prop" but editing a revprop results in a
+# temporary file based on the name "svn-revprop-rN" (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()
+
+  # 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 'af968da2ce9' on your system.
+  os.environ['SVN_EDITOR'] = 'af968da2ce9'
+
+  svntest.actions.run_and_verify_svn(None,
+                                     ".*af968da2ce9.*svn-revprop-r1\\.tmp.*",
+                                     'propedit', '--revprop', 
+                                     '-r1', 'svn:log',
+                                     sbox.repo_url)
+
+  svntest.actions.run_and_verify_svn(None,
+                                     ".*af968da2ce9.*svn-prop\\.tmp.*",
+                                     'propedit', 'ignored-propname',
+                                     os.path.join(sbox.wc_dir, 'A', 'mu'))
+
+
 ########################################################################
 # Run the tests
 
@@ -2880,6 +2907,7 @@
               iprops_list_abspath,
               wc_propop_on_url,
               prop_conflict_root,
+              tmpfile_name_matches_prop_type,
              ]
 
 if __name__ == '__main__':

Reply via email to