Re: svn commit: r1865841 - in /subversion/trunk/subversion: libsvn_wc/diff_local.c tests/cmdline/changelist_tests.py

2019-08-28 Thread Daniel Shahaf
julianf...@apache.org wrote on Sat, 24 Aug 2019 10:50 +00:00:
> Author: julianfoad
> Date: Sat Aug 24 10:50:44 2019
> New Revision: 1865841
> 
> URL: http://svn.apache.org/viewvc?rev=1865841=rev
> Log:
> Fix issue #4822, "svn diff --changelist ARG" broken in subdirectories.

Should this be backported?


svn commit: r1865841 - in /subversion/trunk/subversion: libsvn_wc/diff_local.c tests/cmdline/changelist_tests.py

2019-08-24 Thread julianfoad
Author: julianfoad
Date: Sat Aug 24 10:50:44 2019
New Revision: 1865841

URL: http://svn.apache.org/viewvc?rev=1865841=rev
Log:
Fix issue #4822, "svn diff --changelist ARG" broken in subdirectories.

A follow-up to r1835234.

* subversion/libsvn_wc/diff_local.c
  (svn_wc__diff7): Pass the correct anchor dir to the changelist filter.

* subversion/tests/cmdline/changelist_tests.py
  (diff_with_changelists_subdir): New test.
  (test_list): Run it.

Modified:
subversion/trunk/subversion/libsvn_wc/diff_local.c
subversion/trunk/subversion/tests/cmdline/changelist_tests.py

Modified: subversion/trunk/subversion/libsvn_wc/diff_local.c
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/diff_local.c?rev=1865841=1865840=1865841=diff
==
--- subversion/trunk/subversion/libsvn_wc/diff_local.c (original)
+++ subversion/trunk/subversion/libsvn_wc/diff_local.c Sat Aug 24 10:50:44 2019
@@ -490,7 +490,7 @@ svn_wc__diff7(svn_boolean_t anchor_at_gi
   SVN_ERR(svn_hash_from_cstring_keys(_hash, changelist_filter,
  result_pool));
   diff_processor = svn_wc__changelist_filter_tree_processor_create(
- diff_processor, wc_ctx, local_abspath,
+ diff_processor, wc_ctx, eb.anchor_abspath,
  changelist_hash, result_pool);
 }
 

Modified: subversion/trunk/subversion/tests/cmdline/changelist_tests.py
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/changelist_tests.py?rev=1865841=1865840=1865841=diff
==
--- subversion/trunk/subversion/tests/cmdline/changelist_tests.py (original)
+++ subversion/trunk/subversion/tests/cmdline/changelist_tests.py Sat Aug 24 
10:50:44 2019
@@ -1180,6 +1180,44 @@ def readd_after_revert(sbox):
   svntest.actions.run_and_verify_svn(None, [],
  'add', dummy)
 
+#--
+
+# A wc-wc diff returned no results if changelists were specified and the
+# diff target dir was not the WC root.
+@Issue(4822)
+def diff_with_changelists_subdir(sbox):
+  "diff --changelist (wc-wc) in subdir of WC"
+
+  sbox.build()
+  wc_dir = sbox.wc_dir
+
+  expected_paths = sbox.ospaths(['A/D/gamma'])
+  subdir = 'A/D'
+  clname = 'a'
+
+  for path in expected_paths:
+svntest.main.file_append(path, "New text.\n")
+  svntest.main.run_svn(None, "changelist", clname, *expected_paths)
+
+  # Run 'svn diff ...'
+  exit_code, output, errput = svntest.main.run_svn(None,
+'diff', '--changelist', clname,
+sbox.ospath(subdir))
+
+  # Filter the output for lines that begin with 'Index:', and
+  # reduce even those lines to just the actual path.
+  paths = sorted([x[7:].rstrip() for x in output if x[:7] == 'Index: '])
+
+  # Diff output on Win32 uses '/' path separators.
+  if sys.platform == 'win32':
+paths = [x.replace('/', os.sep) for x in paths]
+
+  # And, compare!
+  if (paths != expected_paths):
+raise svntest.Failure("Expected paths (%s) and actual paths (%s) "
+  "don't gel"
+  % (str(expected_paths), str(paths)))
+
 
 
 # Run the tests
@@ -1203,6 +1241,7 @@ test_list = [ None,
   add_remove_non_existent_target,
   add_remove_unversioned_target,
   readd_after_revert,
+  diff_with_changelists_subdir,
  ]
 
 if __name__ == '__main__':