You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by ka...@apache.org on 2010/12/01 17:09:29 UTC

svn commit: r1041068 - in /subversion/trunk/subversion: libsvn_client/diff.c tests/cmdline/depth_tests.py tests/cmdline/diff_tests.py

Author: kameshj
Date: Wed Dec  1 16:09:29 2010
New Revision: 1041068

URL: http://svn.apache.org/viewvc?rev=1041068&view=rev
Log:
Fix assertion error when there is a prop diff on a dir and the diff target
is implicit current working directory or URL.

* subversion/tests/cmdline/diff_tests.py
 (diff_with_depth): Fix the expectations, not to expect ".".
 (diff_git_with_props_on_dir): New testcase that was triggering assertion
  error before this commit.
 (test_list): Add diff_git_with_props_on_dir.

* subversion/tests/cmdline/depth_tests.py
 (diff_in_depthy_wc): Fix the expectations, not to expect ".".

* subversion/libsvn_client/diff.c
 (display_prop_diffs): When path is empty let it be so.

Modified:
    subversion/trunk/subversion/libsvn_client/diff.c
    subversion/trunk/subversion/tests/cmdline/depth_tests.py
    subversion/trunk/subversion/tests/cmdline/diff_tests.py

Modified: subversion/trunk/subversion/libsvn_client/diff.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/diff.c?rev=1041068&r1=1041067&r2=1041068&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/diff.c (original)
+++ subversion/trunk/subversion/libsvn_client/diff.c Wed Dec  1 16:09:29 2010
@@ -574,10 +574,6 @@ display_prop_diffs(const apr_array_heade
   const char *path1 = apr_pstrdup(pool, orig_path1);
   const char *path2 = apr_pstrdup(pool, orig_path2);
 
-  /* If we're creating a diff on the wc root, path would be empty. */
-  if (path[0] == '\0')
-    path = apr_psprintf(pool, ".");
-
   if (use_git_diff_format)
     {
       SVN_ERR(adjust_relative_to_repos_root(&path1, path, orig_path1,

Modified: subversion/trunk/subversion/tests/cmdline/depth_tests.py
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/depth_tests.py?rev=1041068&r1=1041067&r2=1041068&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/cmdline/depth_tests.py (original)
+++ subversion/trunk/subversion/tests/cmdline/depth_tests.py Wed Dec  1 16:09:29 2010
@@ -1062,12 +1062,12 @@ def diff_in_depthy_wc(sbox):
     "@@ -1 +1 @@\n",
     "-new text\n",
     "+This is the file 'iota'.\n",
-    "Index: .\n",
+    "Index: \n",
     "===================================================================\n",
-    "--- .\t(revision 2)\n",
-    "+++ .\t(working copy)\n",
+    "--- \t(revision 2)\n",
+    "+++ \t(working copy)\n",
     "\n",
-    "Property changes on: .\n",
+    "Property changes on: \n",
     "___________________________________________________________________\n",
     "Deleted: foo\n",
     "## -1 +0,0 ##\n",

Modified: subversion/trunk/subversion/tests/cmdline/diff_tests.py
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/diff_tests.py?rev=1041068&r1=1041067&r2=1041068&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/cmdline/diff_tests.py (original)
+++ subversion/trunk/subversion/tests/cmdline/diff_tests.py Wed Dec  1 16:09:29 2010
@@ -2868,7 +2868,7 @@ def diff_with_depth(sbox):
 
   diff = [
     "\n",
-    "Property changes on: .\n",
+    "Property changes on: \n",
     "___________________________________________________________________\n",
     "Added: foo1\n",
     "## -0,0 +1 ##\n",
@@ -2892,7 +2892,7 @@ def diff_with_depth(sbox):
     "## -0,0 +1 ##\n",
     "+bar4\n"]
 
-  dot_header = make_diff_header(".", "revision 1", "working copy")
+  dot_header = make_diff_header("", "revision 1", "working copy")
   iota_header = make_diff_header('iota', "revision 1", "working copy")
   A_header = make_diff_header('A', "revision 1", "working copy")
   B_header = make_diff_header(B_path, "revision 1", "working copy")
@@ -2939,7 +2939,7 @@ def diff_with_depth(sbox):
   svntest.actions.run_and_verify_svn(None, None, [],
                                      'ci', '-m', '')
 
-  dot_header = make_diff_header(".", "revision 1", "revision 2")
+  dot_header = make_diff_header("", "revision 1", "revision 2")
   iota_header = make_diff_header('iota', "revision 1", "revision 2")
   A_header = make_diff_header('A', "revision 1", "revision 2")
   B_header = make_diff_header(B_path, "revision 1", "revision 2")
@@ -3011,12 +3011,12 @@ def diff_with_depth(sbox):
     "## -1 +1 ##\n",
     "-bar2\n",
     "+baz2\n",
-    "Index: .\n",
+    "Index: \n",
     "===================================================================\n",
-    "--- .\t(revision 2)\n",
-    "+++ .\t(working copy)\n",
+    "--- \t(revision 2)\n",
+    "+++ \t(working copy)\n",
     "\n",
-    "Property changes on: .\n",
+    "Property changes on: \n",
     "___________________________________________________________________\n",
     "Modified: foo1\n",
     "## -1 +1 ##\n",
@@ -3713,6 +3713,42 @@ def diff_git_with_props(sbox):
 
   svntest.actions.run_and_verify_svn(None, expected_output, [], 'diff', 
                                      '--git', wc_dir)
+
+def diff_git_with_props_on_dir(sbox):
+  "diff in git format showing prop changes on dir"
+  sbox.build()
+  wc_dir = sbox.wc_dir
+
+  # Now commit the local mod, creating rev 2.
+  expected_output = svntest.wc.State(wc_dir, {
+    '.' : Item(verb='Sending'),
+    })
+
+  expected_status = svntest.actions.get_virginal_state(wc_dir, 1)
+  expected_status.add({
+    '' : Item(status='  ', wc_rev=2),
+    })
+
+  svntest.main.run_svn(None, 'ps', 'a','b', wc_dir)
+  svntest.actions.run_and_verify_commit(wc_dir, expected_output,
+                                        expected_status, None, wc_dir)
+
+  was_cwd = os.getcwd()
+  os.chdir(wc_dir)
+  expected_output = make_git_diff_header("", "", "revision 1",
+                                         "revision 2",
+                                         add=False, text_changes=False) + [
+      "\n",
+      "Property changes on: \n",
+      "___________________________________________________________________\n",
+      "Added: a\n",
+      "## -0,0 +1 ##\n",
+      "+b\n",
+  ]
+
+  svntest.actions.run_and_verify_svn(None, expected_output, [], 'diff',
+                                     '-c2', '--git')
+  os.chdir(was_cwd)
 ########################################################################
 #Run the tests
 
@@ -3775,7 +3811,8 @@ test_list = [ None,
               diff_prop_missing_context,
               diff_prop_multiple_hunks,
               diff_git_empty_files,
-              diff_git_with_props,
+              diff_git_with_props, 
+              diff_git_with_props_on_dir,
               ]
 
 if __name__ == '__main__':



Re: svn commit: r1041068 - in /subversion/trunk/subversion: libsvn_client/diff.c tests/cmdline/depth_tests.py tests/cmdline/diff_tests.py

Posted by Kamesh Jayachandran <ka...@collab.net>.
On 12/01/2010 11:57 PM, Kamesh Jayachandran wrote:
>> Hi Kamesh,
>> I don't think this change in diff output is desirable.
>> In 1.6.x, you get lines like:
>>   Property changes on: .
>> in a diff. You made it print:
>>   Property changes on:
>> instead.
>> Is there a way to fix the assertion problem without changing the output?
>
> Right now away from my build area. Will get back. I need to check its usability with git too.
>
> With regards
> Kamesh Jayachandran


Fixed this in r1041839.

With regards
Kamesh Jayachandran

RE: svn commit: r1041068 - in /subversion/trunk/subversion: libsvn_client/diff.c tests/cmdline/depth_tests.py tests/cmdline/diff_tests.py

Posted by Kamesh Jayachandran <ka...@collab.net>.
>Hi Kamesh,

>I don't think this change in diff output is desirable.

>In 1.6.x, you get lines like:

>  Property changes on: .

>in a diff. You made it print:

>  Property changes on:

>instead.

>Is there a way to fix the assertion problem without changing the output?


Right now away from my build area. Will get back. I need to check its usability with git too.

With regards
Kamesh Jayachandran

Re: svn commit: r1041068 - in /subversion/trunk/subversion: libsvn_client/diff.c tests/cmdline/depth_tests.py tests/cmdline/diff_tests.py

Posted by Stefan Sperling <st...@elego.de>.
On Wed, Dec 01, 2010 at 04:09:29PM -0000, kameshj@apache.org wrote:
> Author: kameshj
> Date: Wed Dec  1 16:09:29 2010
> New Revision: 1041068
> 
> URL: http://svn.apache.org/viewvc?rev=1041068&view=rev
> Log:
> Fix assertion error when there is a prop diff on a dir and the diff target
> is implicit current working directory or URL.
> 
> * subversion/tests/cmdline/diff_tests.py
>  (diff_with_depth): Fix the expectations, not to expect ".".
>  (diff_git_with_props_on_dir): New testcase that was triggering assertion
>   error before this commit.
>  (test_list): Add diff_git_with_props_on_dir.
> 
> * subversion/tests/cmdline/depth_tests.py
>  (diff_in_depthy_wc): Fix the expectations, not to expect ".".

Hi Kamesh,

I don't think this change in diff output is desirable.

In 1.6.x, you get lines like:

  Property changes on: .

in a diff. You made it print:

  Property changes on:

instead.

Is there a way to fix the assertion problem without changing the output?

Stefan
> 
> * subversion/libsvn_client/diff.c
>  (display_prop_diffs): When path is empty let it be so.
> 
> Modified:
>     subversion/trunk/subversion/libsvn_client/diff.c
>     subversion/trunk/subversion/tests/cmdline/depth_tests.py
>     subversion/trunk/subversion/tests/cmdline/diff_tests.py
> 
> Modified: subversion/trunk/subversion/libsvn_client/diff.c
> URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/diff.c?rev=1041068&r1=1041067&r2=1041068&view=diff
> ==============================================================================
> --- subversion/trunk/subversion/libsvn_client/diff.c (original)
> +++ subversion/trunk/subversion/libsvn_client/diff.c Wed Dec  1 16:09:29 2010
> @@ -574,10 +574,6 @@ display_prop_diffs(const apr_array_heade
>    const char *path1 = apr_pstrdup(pool, orig_path1);
>    const char *path2 = apr_pstrdup(pool, orig_path2);
>  
> -  /* If we're creating a diff on the wc root, path would be empty. */
> -  if (path[0] == '\0')
> -    path = apr_psprintf(pool, ".");
> -
>    if (use_git_diff_format)
>      {
>        SVN_ERR(adjust_relative_to_repos_root(&path1, path, orig_path1,
> 
> Modified: subversion/trunk/subversion/tests/cmdline/depth_tests.py
> URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/depth_tests.py?rev=1041068&r1=1041067&r2=1041068&view=diff
> ==============================================================================
> --- subversion/trunk/subversion/tests/cmdline/depth_tests.py (original)
> +++ subversion/trunk/subversion/tests/cmdline/depth_tests.py Wed Dec  1 16:09:29 2010
> @@ -1062,12 +1062,12 @@ def diff_in_depthy_wc(sbox):
>      "@@ -1 +1 @@\n",
>      "-new text\n",
>      "+This is the file 'iota'.\n",
> -    "Index: .\n",
> +    "Index: \n",
>      "===================================================================\n",
> -    "--- .\t(revision 2)\n",
> -    "+++ .\t(working copy)\n",
> +    "--- \t(revision 2)\n",
> +    "+++ \t(working copy)\n",
>      "\n",
> -    "Property changes on: .\n",
> +    "Property changes on: \n",
>      "___________________________________________________________________\n",
>      "Deleted: foo\n",
>      "## -1 +0,0 ##\n",
> 
> Modified: subversion/trunk/subversion/tests/cmdline/diff_tests.py
> URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/diff_tests.py?rev=1041068&r1=1041067&r2=1041068&view=diff
> ==============================================================================
> --- subversion/trunk/subversion/tests/cmdline/diff_tests.py (original)
> +++ subversion/trunk/subversion/tests/cmdline/diff_tests.py Wed Dec  1 16:09:29 2010
> @@ -2868,7 +2868,7 @@ def diff_with_depth(sbox):
>  
>    diff = [
>      "\n",
> -    "Property changes on: .\n",
> +    "Property changes on: \n",
>      "___________________________________________________________________\n",
>      "Added: foo1\n",
>      "## -0,0 +1 ##\n",
> @@ -2892,7 +2892,7 @@ def diff_with_depth(sbox):
>      "## -0,0 +1 ##\n",
>      "+bar4\n"]
>  
> -  dot_header = make_diff_header(".", "revision 1", "working copy")
> +  dot_header = make_diff_header("", "revision 1", "working copy")
>    iota_header = make_diff_header('iota', "revision 1", "working copy")
>    A_header = make_diff_header('A', "revision 1", "working copy")
>    B_header = make_diff_header(B_path, "revision 1", "working copy")
> @@ -2939,7 +2939,7 @@ def diff_with_depth(sbox):
>    svntest.actions.run_and_verify_svn(None, None, [],
>                                       'ci', '-m', '')
>  
> -  dot_header = make_diff_header(".", "revision 1", "revision 2")
> +  dot_header = make_diff_header("", "revision 1", "revision 2")
>    iota_header = make_diff_header('iota', "revision 1", "revision 2")
>    A_header = make_diff_header('A', "revision 1", "revision 2")
>    B_header = make_diff_header(B_path, "revision 1", "revision 2")
> @@ -3011,12 +3011,12 @@ def diff_with_depth(sbox):
>      "## -1 +1 ##\n",
>      "-bar2\n",
>      "+baz2\n",
> -    "Index: .\n",
> +    "Index: \n",
>      "===================================================================\n",
> -    "--- .\t(revision 2)\n",
> -    "+++ .\t(working copy)\n",
> +    "--- \t(revision 2)\n",
> +    "+++ \t(working copy)\n",
>      "\n",
> -    "Property changes on: .\n",
> +    "Property changes on: \n",
>      "___________________________________________________________________\n",
>      "Modified: foo1\n",
>      "## -1 +1 ##\n",
> @@ -3713,6 +3713,42 @@ def diff_git_with_props(sbox):
>  
>    svntest.actions.run_and_verify_svn(None, expected_output, [], 'diff', 
>                                       '--git', wc_dir)
> +
> +def diff_git_with_props_on_dir(sbox):
> +  "diff in git format showing prop changes on dir"
> +  sbox.build()
> +  wc_dir = sbox.wc_dir
> +
> +  # Now commit the local mod, creating rev 2.
> +  expected_output = svntest.wc.State(wc_dir, {
> +    '.' : Item(verb='Sending'),
> +    })
> +
> +  expected_status = svntest.actions.get_virginal_state(wc_dir, 1)
> +  expected_status.add({
> +    '' : Item(status='  ', wc_rev=2),
> +    })
> +
> +  svntest.main.run_svn(None, 'ps', 'a','b', wc_dir)
> +  svntest.actions.run_and_verify_commit(wc_dir, expected_output,
> +                                        expected_status, None, wc_dir)
> +
> +  was_cwd = os.getcwd()
> +  os.chdir(wc_dir)
> +  expected_output = make_git_diff_header("", "", "revision 1",
> +                                         "revision 2",
> +                                         add=False, text_changes=False) + [
> +      "\n",
> +      "Property changes on: \n",
> +      "___________________________________________________________________\n",
> +      "Added: a\n",
> +      "## -0,0 +1 ##\n",
> +      "+b\n",
> +  ]
> +
> +  svntest.actions.run_and_verify_svn(None, expected_output, [], 'diff',
> +                                     '-c2', '--git')
> +  os.chdir(was_cwd)
>  ########################################################################
>  #Run the tests
>  
> @@ -3775,7 +3811,8 @@ test_list = [ None,
>                diff_prop_missing_context,
>                diff_prop_multiple_hunks,
>                diff_git_empty_files,
> -              diff_git_with_props,
> +              diff_git_with_props, 
> +              diff_git_with_props_on_dir,
>                ]
>  
>  if __name__ == '__main__':
>