Ben Collins-Sussman wrote:
> I say you should do your proposal below. Nothing is parsing the
> property-diffs; it's a lame format I wrote in a pinch years ago. It
> needs to be replaced sorely.
>
> On Nov 13, 2007 11:04 PM, C. Michael Pilato <cmpilato@collab.net> wrote:
>> Devs, I just added the following to issue #3019[1] which describes ambiguous
>> output from 'svn diff' with respect to property changes. Would this be a
>> legal change to our output format, especially considering this portion of
>> the diff is ignored by 'patch'?
>>
>> [1] http://subversion.tigris.org/issues/show_bug.cgi?id=3019#desc2
Patch attached.
--
C. Michael Pilato <cmpilato@collab.net>
CollabNet <> www.collab.net <> Distributed Development On Demand
Finish issue #3019 by disambiguating property change actions in 'svn
diff' and 'svnlook diff' output.
* subversion/libsvn_client/diff.c
(display_prop_diffs): Use action verbs instead of the static string
"Name:" as a prefix for property names in diff output.
* subversion/svnlook/main.c
(display_prop_diffs): Make the same changes to the diff header here
for 'svnlook diff' as for 'svn diff'.
* subversion/tests/cmdline/diff_tests.py
(diff_only_property_change, diff_property_changes_to_base,
diff_prop_change_local_propmod, diff_repos_wc_add_with_props,
diff_with_depth): Tweak expected test output.
* subversion/tests/cmdline/depth_tests.py
(diff_in_depthy_wc): Tweak expected test output.
* subversion/tests/cmdline/merge_tests.py
(merge_in_new_file_and_diff): Tweak expected test output.
* subversion/tests/cmdline/special_tests.py
(diff_symlink_to_dir): Tweak expected test output.
Index: subversion/svnlook/main.c
===================================================================
--- subversion/svnlook/main.c (revision 27806)
+++ subversion/svnlook/main.c (working copy)
@@ -765,6 +765,7 @@
for (i = 0; i < prop_diffs->nelts; i++)
{
+ const char *header_fmt;
const svn_string_t *orig_value;
const svn_prop_t *pc = &APR_ARRAY_IDX(prop_diffs, i, svn_prop_t);
@@ -775,7 +776,13 @@
else
orig_value = NULL;
- SVN_ERR(svn_cmdline_printf(pool, _("Name: %s\n"), pc->name));
+ if (! orig_value)
+ header_fmt = _("Added: %s\n");
+ else if (! pc->value)
+ header_fmt = _("Deleted: %s\n");
+ else
+ header_fmt = _("Modified: %s\n");
+ SVN_ERR(svn_cmdline_printf(pool, header_fmt, pc->name));
/* For now, we have a rather simple heuristic: if this is an
"svn:" property, then assume the value is UTF-8 and must
Index: subversion/libsvn_client/diff.c
===================================================================
--- subversion/libsvn_client/diff.c (revision 27806)
+++ subversion/libsvn_client/diff.c (working copy)
@@ -183,10 +183,10 @@
for (i = 0; i < propchanges->nelts; i++)
{
- const svn_prop_t *propchange
- = &APR_ARRAY_IDX(propchanges, i, svn_prop_t);
-
+ const char *header_fmt;
const svn_string_t *original_value;
+ const svn_prop_t *propchange =
+ &APR_ARRAY_IDX(propchanges, i, svn_prop_t);
if (original_props)
original_value = apr_hash_get(original_props,
@@ -201,7 +201,13 @@
&& svn_string_compare(original_value, propchange->value)))
continue;
- SVN_ERR(file_printf_from_utf8(file, encoding, _("Name: %s%s"),
+ if (! original_value)
+ header_fmt = _("Added: %s%s");
+ else if (! propchange->value)
+ header_fmt = _("Deleted: %s%s");
+ else
+ header_fmt = _("Modified: %s%s");
+ SVN_ERR(file_printf_from_utf8(file, encoding, header_fmt,
propchange->name, APR_EOL_STR));
if (strcmp(propchange->name, SVN_PROP_MERGE_INFO) == 0)
Index: subversion/tests/cmdline/diff_tests.py
===================================================================
--- subversion/tests/cmdline/diff_tests.py (revision 27806)
+++ subversion/tests/cmdline/diff_tests.py (working copy)
@@ -617,11 +617,13 @@
"\n",
"Property changes on: iota\n",
"___________________________________________________________________\n",
- "Name: svn:eol-style\n",
+ "Added: svn:eol-style\n",
" + native\n",
"\n" ]
expected_reverse_output = list(expected_output)
+ expected_reverse_output[3] = expected_reverse_output[3].replace("Added",
+ "Deleted")
expected_reverse_output[4] = " - native\n"
@@ -1837,18 +1839,22 @@
"\n",
"Property changes on: A\n",
"___________________________________________________________________\n",
- "Name: dirprop\n",
+ "Added: dirprop\n",
" + r2value\n",
"\n",
"\n",
"Property changes on: iota\n",
"___________________________________________________________________\n",
- "Name: fileprop\n",
+ "Added: fileprop\n",
" + r2value\n",
"\n" ]
expected_output_r2_r1 = list(expected_output_r1_r2)
+ expected_output_r2_r1[3] = expected_output_r2_r1[3].replace("Added",
+ "Deleted")
expected_output_r2_r1[4] = " - r2value\n"
+ expected_output_r2_r1[9] = expected_output_r2_r1[9].replace("Added",
+ "Deleted")
expected_output_r2_r1[10] = " - r2value\n"
@@ -2084,19 +2090,19 @@
"\n",
"Property changes on: A\n",
"___________________________________________________________________\n",
- "Name: dirprop\n",
+ "Modified: dirprop\n",
" - r2value\n",
" + workingvalue\n",
- "Name: newdirprop\n",
+ "Added: newdirprop\n",
" + newworkingvalue\n",
"\n",
"\n",
"Property changes on: iota\n",
"___________________________________________________________________\n",
- "Name: fileprop\n",
+ "Modified: fileprop\n",
" - r2value\n",
" + workingvalue\n",
- "Name: newfileprop\n",
+ "Added: newfileprop\n",
" + newworkingvalue\n",
"\n" ]
@@ -2168,13 +2174,13 @@
"\n",
"Property changes on: foo\n",
"___________________________________________________________________\n",
- "Name: propname\n",
+ "Added: propname\n",
" + propvalue\n",
"\n",
"\n",
"Property changes on: X\n",
"___________________________________________________________________\n",
- "Name: propname\n",
+ "Added: propname\n",
" + propvalue\n",
"\n",
"Index: X/bar\n",
@@ -2186,7 +2192,7 @@
"\n",
"Property changes on: " + os.path.join('X', 'bar') + "\n",
"___________________________________________________________________\n",
- "Name: propname\n",
+ "Added: propname\n",
" + propvalue\n",
"\n" ]
# The output from the BASE->repos diff is the same content, but in a
@@ -2632,25 +2638,25 @@
"\n",
"Property changes on: .\n",
"___________________________________________________________________\n",
- "Name: foo1\n",
+ "Added: foo1\n",
" + bar1\n",
"\n",
"\n",
"Property changes on: iota\n",
"___________________________________________________________________\n",
- "Name: foo2\n",
+ "Added: foo2\n",
" + bar2\n",
"\n",
"\n",
"Property changes on: A\n",
"___________________________________________________________________\n",
- "Name: foo3\n",
+ "Added: foo3\n",
" + bar3\n",
"\n",
"\n",
"Property changes on: " + os.path.join('A', 'B') + "\n",
"___________________________________________________________________\n",
- "Name: foo4\n",
+ "Added: foo4\n",
" + bar4\n",
"\n" ]
@@ -2702,14 +2708,14 @@
"\n",
"Property changes on: .\n",
"___________________________________________________________________\n",
- "Name: foo1\n",
+ "Modified: foo1\n",
" - bar1\n",
" + baz1\n",
"\n",
"\n",
"Property changes on: iota\n",
"___________________________________________________________________\n",
- "Name: foo2\n",
+ "Modified: foo2\n",
" - bar2\n",
" + baz2\n",
"\n",
@@ -2723,14 +2729,14 @@
"+new text\n",
"Property changes on: A\n",
"___________________________________________________________________\n",
- "Name: foo3\n",
+ "Modified: foo3\n",
" - bar3\n",
" + baz3\n",
"\n",
"\n",
"Property changes on: " + os.path.join('A', 'B') + "\n",
"___________________________________________________________________\n",
- "Name: foo4\n",
+ "Modified: foo4\n",
" - bar4\n",
" + baz4\n",
"\n",
Index: subversion/tests/cmdline/special_tests.py
===================================================================
--- subversion/tests/cmdline/special_tests.py (revision 27806)
+++ subversion/tests/cmdline/special_tests.py (working copy)
@@ -524,7 +524,7 @@
"\n",
"Property changes on: svn-test-work/working_copies/special_tests-10/link\n",
"___________________________________________________________________\n",
- "Name: svn:special\n",
+ "Added: svn:special\n",
" + *\n",
"\n" ]
svntest.actions.run_and_verify_svn(None, expected_output, [], 'diff',
Index: subversion/tests/cmdline/merge_tests.py
===================================================================
--- subversion/tests/cmdline/merge_tests.py (revision 27806)
+++ subversion/tests/cmdline/merge_tests.py (working copy)
@@ -1700,7 +1700,7 @@
"\n",
"Property changes on: " + branch_path + "\n",
"___________________________________________________________________\n",
- "Name: " + SVN_PROP_MERGE_INFO + "\n",
+ "Modified: " + SVN_PROP_MERGE_INFO + "\n",
" Merged /A/B/E:r2-3\n",
"\n", ]
svntest.actions.run_and_verify_svn(None, expected_output, [], 'diff',
Index: subversion/tests/cmdline/depth_tests.py
===================================================================
--- subversion/tests/cmdline/depth_tests.py (revision 27806)
+++ subversion/tests/cmdline/depth_tests.py (working copy)
@@ -1024,7 +1024,7 @@
"\n",
"Property changes on: .\n",
"___________________________________________________________________\n",
- "Name: foo\n",
+ "Deleted: foo\n",
" - foo-val\n",
"\n",
"Index: iota\n",
@@ -1036,7 +1036,7 @@
"+This is the file 'iota'.\n",
"Property changes on: A\n",
"___________________________________________________________________\n",
- "Name: bar\n",
+ "Deleted: bar\n",
" - bar-val\n",
"\n",
"\n",
Received on Wed Nov 14 06:46:20 2007