You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by rh...@apache.org on 2013/07/17 18:35:28 UTC
svn commit: r1504192 - in /subversion/trunk/subversion:
libsvn_wc/diff_editor.c tests/cmdline/diff_tests.py
Author: rhuijben
Date: Wed Jul 17 16:35:28 2013
New Revision: 1504192
URL: http://svn.apache.org/r1504192
Log:
Properly handle text diffs for missing and obstructed files in local diffs.
Before this patch these cases produced an error; a regression since 1.7.
* subversion/libsvn_wc/diff_editor.c
(svn_wc__diff_base_working_diff):
Don't look for file differences if there is no localfile.
* subversion/tests/cmdline/diff_tests.py
(diff_local_missing_obstruction): New function.
(test_list): Add diff_local_missing_obstruction.
Modified:
subversion/trunk/subversion/libsvn_wc/diff_editor.c
subversion/trunk/subversion/tests/cmdline/diff_tests.py
Modified: subversion/trunk/subversion/libsvn_wc/diff_editor.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/diff_editor.c?rev=1504192&r1=1504191&r2=1504192&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/diff_editor.c (original)
+++ subversion/trunk/subversion/libsvn_wc/diff_editor.c Wed Jul 17 16:35:28 2013
@@ -474,14 +474,18 @@ svn_wc__diff_base_working_diff(svn_wc__d
{
const svn_io_dirent2_t *dirent;
+ /* Verify truename to mimic status for iota/IOTA difference on Windows */
SVN_ERR(svn_io_stat_dirent2(&dirent, local_abspath,
- FALSE /* verify truename */,
+ TRUE /* verify truename */,
TRUE /* ingore_enoent */,
scratch_pool, scratch_pool));
- if (dirent->kind == svn_node_file
- && dirent->filesize == recorded_size
- && dirent->mtime == recorded_time)
+ /* If a file does not exist on disk (missing/obstructed) then we
+ can't provide a text diff */
+ if (dirent->kind != svn_node_file
+ || (dirent->kind == svn_node_file
+ && dirent->filesize == recorded_size
+ && dirent->mtime == recorded_time))
{
files_same = TRUE;
}
Modified: subversion/trunk/subversion/tests/cmdline/diff_tests.py
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/diff_tests.py?rev=1504192&r1=1504191&r2=1504192&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/cmdline/diff_tests.py (original)
+++ subversion/trunk/subversion/tests/cmdline/diff_tests.py Wed Jul 17 16:35:28 2013
@@ -4580,6 +4580,53 @@ def diff_missing_tree_conflict_victim(sb
expected_output = [ ]
svntest.actions.run_and_verify_svn(None, expected_output, [], 'diff', wc_dir)
+@Issue(4396)
+def diff_local_missing_obstruction(sbox):
+ "diff local missing and obstructed files"
+
+ sbox.build(read_only=True)
+ wc_dir = sbox.wc_dir
+
+ os.unlink(sbox.ospath('iota'))
+ os.unlink(sbox.ospath('A/mu'))
+ os.mkdir(sbox.ospath('A/mu'))
+
+ # Expect no output for missing and obstructed files
+ expected_output = [
+ ]
+ svntest.actions.run_and_verify_svn(None, expected_output, [], 'diff', wc_dir)
+
+ sbox.simple_propset('K', 'V', 'iota', 'A/mu')
+ sbox.simple_append('IotA', 'Content')
+
+ # But do expect a proper property diff
+ expected_output = [
+ 'Index: %s\n' % (sbox.path('A/mu'),),
+ '===================================================================\n',
+ '--- %s\t(revision 1)\n' % (sbox.path('A/mu'),),
+ '+++ %s\t(working copy)\n' % (sbox.path('A/mu'),),
+ '\n',
+ 'Property changes on: %s\n' % (sbox.path('A/mu'),),
+ '___________________________________________________________________\n',
+ 'Added: K\n',
+ '## -0,0 +1 ##\n',
+ '+V\n',
+ '\ No newline at end of property\n',
+ 'Index: %s\n' % (sbox.path('iota'),),
+ '===================================================================\n',
+ '--- %s\t(revision 1)\n' % (sbox.path('iota'),),
+ '+++ %s\t(working copy)\n' % (sbox.path('iota'),),
+ '\n',
+ 'Property changes on: %s\n' % (sbox.path('iota'),),
+ '___________________________________________________________________\n',
+ 'Added: K\n',
+ '## -0,0 +1 ##\n',
+ '+V\n',
+ '\ No newline at end of property\n',
+ ]
+ svntest.actions.run_and_verify_svn(None, expected_output, [], 'diff', wc_dir)
+
+
########################################################################
#Run the tests
@@ -4660,6 +4707,7 @@ test_list = [ None,
diff_dir_replaced_by_dir,
diff_repos_empty_file_addition,
diff_missing_tree_conflict_victim,
+ diff_local_missing_obstruction,
]
if __name__ == '__main__':