Following on from my original message, I've attempted to put together a
patch (attached, for review) to add a regression test for issue #2333.
The basic problem seems to be that there are problems with reporting diffs
following a directory rename. For example, a pre-commit repos-wc diff shows
only the deletion of the files under the old name, while a post-commit
repos-wc diff shows both the deletion _and_ the addition.
I'm fairly sure this is wrong, though I might not be entirely correct about
what the expected result should be.
Please be somewhat gentle with the review: not only is this my first
contributed patch to Subversion, it's also my first-ever Python program,
assembled cargo-cult-style from the other examples in that file.
I would appreciate a thorough review of the tests themselves, as it's
obviously pretty hard to double-check that the expected results are
correct without also fixing the problem, something that's beyond my
level of skill at the moment.
[[[
New XFail test for diff on a renamed directory, for issue #2333.
* subversion/tests/clients/cmdline/diff_tests.py
(diff_renamed_dir: New test.
(test_list): Add the new test, as XFail.
]]]
Regards,
Malcolm
Index: subversion/tests/clients/cmdline/diff_tests.py
===================================================================
--- subversion/tests/clients/cmdline/diff_tests.py (revision 16013)
+++ subversion/tests/clients/cmdline/diff_tests.py (working copy)
@@ -1787,8 +1787,76 @@
if (re_nodisplay.match(line)):
raise svntest.Failure
+#----------------------------------------------------------------------
+# Regression test for issue #2333: Renaming a directory should produce
+# deletion and addition diffs for each included file.
+def diff_renamed_dir(sbox):
+ "diff a renamed directory"
+ sbox.build()
+ was_cwd = os.getcwd()
+ os.chdir(sbox.wc_dir)
+
+ svntest.main.run_svn(None, 'mv', os.path.join('A', 'D', 'G'),
+ os.path.join('A', 'D', 'I'))
+
+ # Check a repos->wc diff
+ diff_output, err_output = svntest.main.run_svn(None, 'diff',
+ os.path.join('A', 'D'))
+ if check_diff_output(diff_output,
+ os.path.join('A', 'D', 'G', 'pi'),
+ 'D') :
+ raise svntest.Failure
+ if check_diff_output(diff_output,
+ os.path.join('A', 'D', 'I', 'pi'),
+ 'A') :
+ raise svntest.Failure
+
+ svntest.actions.run_and_verify_svn(None, None, [],
+ 'ci', '-m', 'log msg')
+
+ # Check repos->wc after commit
+ diff_output, err_output = svntest.main.run_svn(None, 'diff', '-r', '1',
+ os.path.join('A', 'D'))
+ if check_diff_output(diff_output,
+ os.path.join('A', 'D', 'G', 'pi'),
+ 'D') :
+ raise svntest.Failure
+ if check_diff_output(diff_output,
+ os.path.join('A', 'D', 'I', 'pi'),
+ 'A') :
+ raise svntest.Failure
+
+ # Test a repos->repos diff after commit
+ diff_output, err_output = svntest.main.run_svn(None, 'diff', '-r', '1:2')
+ if check_diff_output(diff_output,
+ os.path.join('A', 'D', 'G', 'pi'),
+ 'D') :
+ raise svntest.Failure
+ if check_diff_output(diff_output,
+ os.path.join('A', 'D', 'I', 'pi'),
+ 'A') :
+ raise svntest.Failure
+
+ # Test the diff while within the moved directory
+ os.chdir(os.path.join('A','D','I'))
+
+ diff_output, err_output = svntest.main.run_svn(None, 'diff', '-r', '1')
+
+ if check_diff_output(diff_output, 'pi', 'A') :
+ raise svntest.Failure
+
+ # Test a repos->repos diff while within the moved directory
+ diff_output, err_output = svntest.main.run_svn(None, 'diff', '-r', '1:2')
+
+ if check_diff_output(diff_output, 'pi', 'A') :
+ raise svntest.Failure
+
+ os.chdir(was_cwd)
+
+
+
########################################################################
#Run the tests
@@ -1820,7 +1888,8 @@
diff_within_renamed_dir,
diff_prop_on_named_dir,
diff_keywords,
- diff_force
+ diff_force,
+ XFail(diff_renamed_dir)
]
if __name__ == '__main__':
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Wed Aug 31 14:09:09 2005