You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by br...@apache.org on 2014/01/31 08:10:39 UTC

svn commit: r1563070 - /subversion/branches/1.7.x-issue4460/subversion/tests/cmdline/diff_tests.py

Author: breser
Date: Fri Jan 31 07:10:39 2014
New Revision: 1563070

URL: http://svn.apache.org/r1563070
Log:
On the 1.7.x-issue4460 branch: Partially merge r1311747 from trunk

Didn't merge the test just the changes to make_diff_header()

Modified:
    subversion/branches/1.7.x-issue4460/subversion/tests/cmdline/diff_tests.py

Modified: subversion/branches/1.7.x-issue4460/subversion/tests/cmdline/diff_tests.py
URL: http://svn.apache.org/viewvc/subversion/branches/1.7.x-issue4460/subversion/tests/cmdline/diff_tests.py?rev=1563070&r1=1563069&r2=1563070&view=diff
==============================================================================
--- subversion/branches/1.7.x-issue4460/subversion/tests/cmdline/diff_tests.py (original)
+++ subversion/branches/1.7.x-issue4460/subversion/tests/cmdline/diff_tests.py Fri Jan 31 07:10:39 2014
@@ -45,16 +45,28 @@ Item = svntest.wc.StateItem
 ######################################################################
 # Generate expected output
 
-def make_diff_header(path, old_tag, new_tag):
+def make_diff_header(path, old_tag, new_tag, src_label=None, dst_label=None):
   """Generate the expected diff header for file PATH, with its old and new
-  versions described in parentheses by OLD_TAG and NEW_TAG. Return the header
-  as an array of newline-terminated strings."""
+  versions described in parentheses by OLD_TAG and NEW_TAG. SRC_LABEL and
+  DST_LABEL are paths or urls that are added to the diff labels if we're
+  diffing against the repository or diffing two arbitrary paths.
+  Return the header as an array of newline-terminated strings."""
+  if src_label:
+    src_label = src_label.replace('\\', '/')
+    src_label = '\t(.../' + src_label + ')'
+  else:
+    src_label = ''
+  if dst_label:
+    dst_label = dst_label.replace('\\', '/')
+    dst_label = '\t(.../' + dst_label + ')'
+  else:
+    dst_label = ''
   path_as_shown = path.replace('\\', '/')
   return [
     "Index: " + path_as_shown + "\n",
     "===================================================================\n",
-    "--- " + path_as_shown + "\t(" + old_tag + ")\n",
-    "+++ " + path_as_shown + "\t(" + new_tag + ")\n",
+    "--- " + path_as_shown + src_label + "\t(" + old_tag + ")\n",
+    "+++ " + path_as_shown + dst_label + "\t(" + new_tag + ")\n",
     ]
 
 def make_no_diff_deleted_header(path, old_tag, new_tag):