svn commit: r1199950 - in /subversion/trunk/subversion: libsvn_client/patch.c tests/cmdline/patch_tests.py

2011-11-09 Thread dannas
Author: dannas
Date: Wed Nov  9 20:27:32 2011
New Revision: 1199950

URL: http://svn.apache.org/viewvc?rev=1199950view=rev
Log:
Fix issue #4049 - SEGV on patch that deletes and skips.

Skipped targets have not been applied to the wc. No need to process them 
any further.

* subversion/libsvn_client/patch.c
  (apply_patches): Don't send skipped targets to delete_empty_dirs().

* subversion/tests/cmdline/patch_tests.py
 (patch_delete_and_skip): New.
 (test_list): Add new test.

Suggested by: philipm
Review by: stsp

Modified:
subversion/trunk/subversion/libsvn_client/patch.c
subversion/trunk/subversion/tests/cmdline/patch_tests.py

Modified: subversion/trunk/subversion/libsvn_client/patch.c
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/patch.c?rev=1199950r1=1199949r2=1199950view=diff
==
--- subversion/trunk/subversion/libsvn_client/patch.c (original)
+++ subversion/trunk/subversion/libsvn_client/patch.c Wed Nov  9 20:27:32 2011
@@ -2730,6 +2730,7 @@ delete_empty_dirs(apr_array_header_t *ta
 SVN_ERR(ctx-cancel_func(ctx-cancel_baton));
 
   target_info = APR_ARRAY_IDX(targets_info, i, patch_target_info_t *);
+
   parent = svn_dirent_dirname(target_info-local_abspath, iterpool);
 
   if (apr_hash_get(non_empty_dirs, parent, APR_HASH_KEY_STRING))
@@ -2915,11 +2916,12 @@ apply_patches(void *baton,
   target_info-local_abspath = apr_pstrdup(scratch_pool,
target-local_abspath);
   target_info-deleted = target-deleted;
-  APR_ARRAY_PUSH(targets_info,
- patch_target_info_t *) = target_info;
 
   if (! target-skipped)
 {
+  APR_ARRAY_PUSH(targets_info,
+ patch_target_info_t *) = target_info;
+
   if (target-has_text_changes
   || target-added
   || target-deleted)

Modified: subversion/trunk/subversion/tests/cmdline/patch_tests.py
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/patch_tests.py?rev=1199950r1=1199949r2=1199950view=diff
==
--- subversion/trunk/subversion/tests/cmdline/patch_tests.py (original)
+++ subversion/trunk/subversion/tests/cmdline/patch_tests.py Wed Nov  9 
20:27:32 2011
@@ -3913,6 +3913,84 @@ def patch_dev_null(sbox):
1, # check-props
1) # dry-run
 
+@Issue(4049)
+def patch_delete_and_skip(sbox):
+  patch that deletes and skips
+
+  sbox.build()
+  wc_dir = sbox.wc_dir
+
+  patch_file_path = make_patch_path(sbox)
+
+  os.chdir(wc_dir)
+
+  # We need to use abspaths to trigger the segmentation fault.
+  abs = os.path.abspath('.')
+  if sys.platform == 'win32':
+  abs = abs.replace(\\, /)
+
+  outside_wc = os.path.join(os.pardir, 'X')
+  if sys.platform == 'win32':
+  outside_wc = outside_wc.replace(\\, /)
+
+  unidiff_patch = [
+Index: %s/A/B/E/alpha\n % abs,
+===\n,
+--- %s/A/B/E/alpha\t(revision 1)\n % abs,
++++ %s/A/B/E/alpha\t(working copy)\n % abs,
+@@ -1 +0,0 @@\n,
+-This is the file 'alpha'.\n,
+Index: %s/A/B/E/beta\n % abs,
+===\n,
+--- %s/A/B/E/beta\t(revision 1)\n % abs,
++++ %s/A/B/E/beta\t(working copy)\n % abs,
+@@ -1 +0,0 @@\n,
+-This is the file 'beta'.\n,
+Index: %s/A/B/E/out-of-reach\n % abs,
+===\n,
+--- %s/iota\t(revision 1)\n % outside_wc,
++++ %s/iota\t(working copy)\n % outside_wc,
+\n,
+Property changes on: iota\n,
+___\n,
+Added: propname\n,
+## -0,0 +1 ##\n,
++propvalue\n,
+  ]
+
+  svntest.main.file_write(patch_file_path, ''.join(unidiff_patch))
+
+  skipped_path = os.path.join(os.pardir, 'X', 'iota')
+  expected_output = [
+'D %s\n' % os.path.join('A', 'B', 'E', 'alpha'),
+'D %s\n' % os.path.join('A', 'B', 'E', 'beta'),
+'Skipped missing target: \'%s\'\n' % skipped_path,
+'D %s\n' % os.path.join('A', 'B', 'E'),
+'Summary of conflicts:\n',
+'  Skipped paths: 1\n'
+  ]
+
+  expected_disk = svntest.main.greek_state.copy()
+  expected_disk.remove('A/B/E/alpha')
+  expected_disk.remove('A/B/E/beta')
+  expected_disk.remove('A/B/E')
+
+  expected_status = svntest.actions.get_virginal_state('.', 1)
+  expected_status.tweak('A/B/E', status='D ')
+  expected_status.tweak('A/B/E/alpha', status='D ')
+  expected_status.tweak('A/B/E/beta', status='D ')
+
+  expected_skip = wc.State('', {skipped_path: Item

svn commit: r1085788 - /subversion/trunk/subversion/libsvn_diff/parse-diff.c

2011-03-26 Thread dannas
Author: dannas
Date: Sat Mar 26 19:14:04 2011
New Revision: 1085788

URL: http://svn.apache.org/viewvc?rev=1085788view=rev
Log:
Tighten scope of a variable.

* subversion/libsvn_diff/parse-diff.c
  (svn_diff_parse_next_patch): Tighten scope of VALID_HEADER_LINE.

Suggested by: danielsh

Modified:
subversion/trunk/subversion/libsvn_diff/parse-diff.c

Modified: subversion/trunk/subversion/libsvn_diff/parse-diff.c
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_diff/parse-diff.c?rev=1085788r1=1085787r2=1085788view=diff
==
--- subversion/trunk/subversion/libsvn_diff/parse-diff.c (original)
+++ subversion/trunk/subversion/libsvn_diff/parse-diff.c Sat Mar 26 19:14:04 
2011
@@ -1286,7 +1286,6 @@ svn_diff_parse_next_patch(svn_patch_t **
 {
   apr_off_t pos, last_line;
   svn_boolean_t eof;
-  svn_boolean_t valid_header_line = FALSE;
   svn_boolean_t line_after_tree_header_read = FALSE;
   apr_pool_t *iterpool;
   enum parse_state state = state_start;
@@ -1307,6 +1306,7 @@ svn_diff_parse_next_patch(svn_patch_t **
   do
 {
   svn_stringbuf_t *line;
+  svn_boolean_t valid_header_line = FALSE;
   int i;
 
   svn_pool_clear(iterpool);
@@ -1324,8 +1324,6 @@ svn_diff_parse_next_patch(svn_patch_t **
iterpool));
 }
 
-  valid_header_line = FALSE;
-
   /* Run the state machine. */
   for (i = 0; i  (sizeof(transitions) / sizeof(transitions[0])); i++)
 {




svn commit: r1084099 - /subversion/trunk/subversion/libsvn_client/diff.c

2011-03-22 Thread dannas
Author: dannas
Date: Tue Mar 22 08:34:56 2011
New Revision: 1084099

URL: http://svn.apache.org/viewvc?rev=1084099view=rev
Log:
Remove obsolute '###' comment. The function does print git headers for
renames - the problem is that the caller can't identify renames.

* subversion/libsvn_client/diff.c
  (print_git_diff_header): Remove '###' comment.

Modified:
subversion/trunk/subversion/libsvn_client/diff.c

Modified: subversion/trunk/subversion/libsvn_client/diff.c
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/diff.c?rev=1084099r1=1084098r2=1084099view=diff
==
--- subversion/trunk/subversion/libsvn_client/diff.c (original)
+++ subversion/trunk/subversion/libsvn_client/diff.c Tue Mar 22 08:34:56 2011
@@ -521,8 +521,6 @@ print_git_diff_header(svn_stream_t *os,
rev2, scratch_pool);
 }
 
-  /* ### Print git headers for renames, too, in the future. */
-
   return SVN_NO_ERROR;
 }
 




svn commit: r1084138 - in /subversion/trunk/subversion: libsvn_diff/parse-diff.c tests/libsvn_diff/parse-diff-test.c

2011-03-22 Thread dannas
Author: dannas
Date: Tue Mar 22 11:19:44 2011
New Revision: 1084138

URL: http://svn.apache.org/viewvc?rev=1084138view=rev
Log:
Fix issue #3809 - 'svn patch' accepts invalid git diff headers.

* subversion/libsvn_diff/parse-diff.c
  (svn_diff_parse_next_patch): Disallow non-header lines in the header.

* subversion/tests/libsvn_diff/parse-diff-test.c
  (bad_git_diff_header): Remove sentence that says that the test is
failing.
  (test_funcs): Remove XFAIL marker.

Modified:
subversion/trunk/subversion/libsvn_diff/parse-diff.c
subversion/trunk/subversion/tests/libsvn_diff/parse-diff-test.c

Modified: subversion/trunk/subversion/libsvn_diff/parse-diff.c
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_diff/parse-diff.c?rev=1084138r1=1084137r2=1084138view=diff
==
--- subversion/trunk/subversion/libsvn_diff/parse-diff.c (original)
+++ subversion/trunk/subversion/libsvn_diff/parse-diff.c Tue Mar 22 11:19:44 
2011
@@ -1286,6 +1286,7 @@ svn_diff_parse_next_patch(svn_patch_t **
 {
   apr_off_t pos, last_line;
   svn_boolean_t eof;
+  svn_boolean_t valid_header_line = FALSE;
   svn_boolean_t line_after_tree_header_read = FALSE;
   apr_pool_t *iterpool;
   enum parse_state state = state_start;
@@ -1323,6 +1324,8 @@ svn_diff_parse_next_patch(svn_patch_t **
iterpool));
 }
 
+  valid_header_line = FALSE;
+
   /* Run the state machine. */
   for (i = 0; i  (sizeof(transitions) / sizeof(transitions[0])); i++)
 {
@@ -1332,6 +1335,7 @@ svn_diff_parse_next_patch(svn_patch_t **
 {
   SVN_ERR(transitions[i].fn(state, line-data, *patch,
 result_pool, iterpool));
+  valid_header_line = TRUE;
   break;
 }
 }
@@ -1352,7 +1356,19 @@ svn_diff_parse_next_patch(svn_patch_t **
   break;
 }
   else if (state == state_git_tree_seen)
-line_after_tree_header_read = TRUE;
+{
+  line_after_tree_header_read = TRUE;
+}
+  else if (! valid_header_line  state != state_start)
+{
+  /* We've encountered an invalid diff header. 
+   *
+   * Rewind to the start of the line just read - it may be a new
+   * header that begins there. */
+  SVN_ERR(svn_io_file_seek(patch_file-apr_file, APR_SET, last_line,
+   scratch_pool));
+  state = state_start;
+}
 
 }
   while (! eof);

Modified: subversion/trunk/subversion/tests/libsvn_diff/parse-diff-test.c
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/libsvn_diff/parse-diff-test.c?rev=1084138r1=1084137r2=1084138view=diff
==
--- subversion/trunk/subversion/tests/libsvn_diff/parse-diff-test.c (original)
+++ subversion/trunk/subversion/tests/libsvn_diff/parse-diff-test.c Tue Mar 22 
11:19:44 2011
@@ -120,9 +120,8 @@ static const char *git_tree_and_text_uni
   NL;
 
   /* Only the last git diff header is valid. The other ones either misses a
-   * path element or has noise between lines that must be continous.  The
-   * test test_bad_git_diff_headers currently fails because the headers with
-   * random noise are tolerated.  See issue #3809. */
+   * path element or has noise between lines that must be continous. See
+   * issue #3809. */
 static const char *bad_git_diff_header =
   Index: iota.copied  NL
   === NL
@@ -925,7 +924,7 @@ struct svn_test_descriptor_t test_funcs[
 test git unidiff parsing),
 SVN_TEST_PASS2(test_parse_git_tree_and_text_diff,
test git unidiff parsing of tree and text changes),
-SVN_TEST_XFAIL2(test_bad_git_diff_headers,
+SVN_TEST_PASS2(test_bad_git_diff_headers,
 test badly formatted git diff headers),
 SVN_TEST_PASS2(test_parse_property_diff,
test property unidiff parsing),




svn commit: r1084312 - /subversion/trunk/subversion/libsvn_client/patch.c

2011-03-22 Thread dannas
Author: dannas
Date: Tue Mar 22 19:34:36 2011
New Revision: 1084312

URL: http://svn.apache.org/viewvc?rev=1084312view=rev
Log:
Remove a tiny bit of code duplication.

* subversion/libsvn_client/patch.c
  (reject_hunk): Print the hunk headers in one statement and use
variables for what varies.

Suggested by: stsp

Modified:
subversion/trunk/subversion/libsvn_client/patch.c

Modified: subversion/trunk/subversion/libsvn_client/patch.c
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/patch.c?rev=1084312r1=1084311r2=1084312view=diff
==
--- subversion/trunk/subversion/libsvn_client/patch.c (original)
+++ subversion/trunk/subversion/libsvn_client/patch.c Tue Mar 22 19:34:36 2011
@@ -1308,6 +1308,9 @@ reject_hunk(patch_target_t *target, targ
   const char *hunk_header;
   apr_size_t len;
   svn_boolean_t eof;
+  static const char * const text_atat = @@;
+  static const char * const prop_atat = ##;
+  const char *atat;
   apr_pool_t *iterpool;
 
   if (prop_name)
@@ -1320,23 +1323,21 @@ reject_hunk(patch_target_t *target, targ
   len = strlen(prop_header);
 
   SVN_ERR(svn_stream_write(content_info-reject, prop_header, len));
-
-  /* ### What about just setting a variable to either @@ or ##,
-   * ### and merging with the else clause below? */
-  hunk_header = apr_psprintf(pool, ## -%lu,%lu +%lu,%lu ##%s,
- svn_diff_hunk_get_original_start(hunk),
- svn_diff_hunk_get_original_length(hunk),
- svn_diff_hunk_get_modified_start(hunk),
- svn_diff_hunk_get_modified_length(hunk),
- APR_EOL_STR);
+  atat = prop_atat;
 }
   else
-hunk_header = apr_psprintf(pool, @@ -%lu,%lu +%lu,%lu @@%s,
-   svn_diff_hunk_get_original_start(hunk),
-   svn_diff_hunk_get_original_length(hunk),
-   svn_diff_hunk_get_modified_start(hunk),
-   svn_diff_hunk_get_modified_length(hunk),
-   APR_EOL_STR);
+{
+  atat = text_atat;
+}
+
+  hunk_header = apr_psprintf(pool, %s -%lu,%lu +%lu,%lu %s%s,
+ atat,
+ svn_diff_hunk_get_original_start(hunk),
+ svn_diff_hunk_get_original_length(hunk),
+ svn_diff_hunk_get_modified_start(hunk),
+ svn_diff_hunk_get_modified_length(hunk),
+ atat,
+ APR_EOL_STR);
   len = strlen(hunk_header);
   SVN_ERR(svn_stream_write(content_info-reject, hunk_header, len));
 




svn commit: r1080958 - in /subversion/trunk/subversion/libsvn_client: changelist.c merge.c

2011-03-12 Thread dannas
Author: dannas
Date: Sat Mar 12 17:55:08 2011
New Revision: 1080958

URL: http://svn.apache.org/viewvc?rev=1080958view=rev
Log:
Use the correct name for the svn_wc__node_walk_children() callback.
It was changed in r879333.

* subversion/libsvn_client/merge.c
  (get_mergeinfo_paths_cb): Adjust doc comment.

* subversion/libsvn_client/changelist.c
  (set_node_changelist): Adjust doc comment.

Modified:
subversion/trunk/subversion/libsvn_client/changelist.c
subversion/trunk/subversion/libsvn_client/merge.c

Modified: subversion/trunk/subversion/libsvn_client/changelist.c
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/changelist.c?rev=1080958r1=1080957r2=1080958view=diff
==
--- subversion/trunk/subversion/libsvn_client/changelist.c (original)
+++ subversion/trunk/subversion/libsvn_client/changelist.c Sat Mar 12 17:55:08 
2011
@@ -50,10 +50,10 @@ struct set_cl_fn_baton
 };
 
 
-/* This function -- which implements the 'found_entry' vtable member
-   of svn_wc__node_walk_callbacks_t -- associates LOCAL_ABSPATH
-   with a new changelist (passed along in BATON-changelist), so long
-   as LOCAL_ABSPATH is deemed a valid target of that association.  */
+/* This function -- which implements svn_wc__node_found_func_t -- associates
+   LOCAL_ABSPATH with a new changelist (passed along in BATON-changelist),
+   so long as LOCAL_ABSPATH is deemed a valid target of that association.
+ */
 static svn_error_t *
 set_node_changelist(const char *local_abspath,
 svn_node_kind_t kind,

Modified: subversion/trunk/subversion/libsvn_client/merge.c
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/merge.c?rev=1080958r1=1080957r2=1080958view=diff
==
--- subversion/trunk/subversion/libsvn_client/merge.c (original)
+++ subversion/trunk/subversion/libsvn_client/merge.c Sat Mar 12 17:55:08 2011
@@ -10278,8 +10278,7 @@ struct get_subtree_mergeinfo_walk_baton
   svn_client_ctx_t *ctx;
 };
 
-/* svn_wc__node_walk_callbacks_t found_node() callback for
-   get_mergeinfo_paths().
+/* svn_wc__node_found_func_t callback for get_mergeinfo_paths().
 
Given the working copy path LOCAL_ABSPATH, and WALK_BATON,
where WALK_BATON is of type get_subtree_mergeinfo_walk_baton *:




svn commit: r1063413 - /subversion/trunk/COMMITTERS

2011-01-25 Thread dannas
Author: dannas
Date: Tue Jan 25 19:29:32 2011
New Revision: 1063413

URL: http://svn.apache.org/viewvc?rev=1063413view=rev
Log:
* COMMITTERS: Change my email address.

Modified:
subversion/trunk/COMMITTERS

Modified: subversion/trunk/COMMITTERS
URL: 
http://svn.apache.org/viewvc/subversion/trunk/COMMITTERS?rev=1063413r1=1063412r2=1063413view=diff
==
--- subversion/trunk/COMMITTERS [UTF-8] (original)
+++ subversion/trunk/COMMITTERS [UTF-8] Tue Jan 25 19:29:32 2011
@@ -54,7 +54,7 @@ Blanket commit access:
  neels   Neels J. Hofmeyr ne...@elego.de
  jwhitlock   Jeremy Whitlock jcscoob...@gmail.com
sbutler   Stephen Butler sbut...@elego.de
-dannas   Daniel Näslund dan...@elego.de
+dannas   Daniel Näslund dan...@dannas.name
stefan2   Stefan Fuhrmann stefanfuhrm...@alice-dsl.de
 
 [[END ACTIVE FULL COMMITTERS.  LEAVE THIS LINE HERE; SCRIPTS LOOK FOR IT.]]




svn commit: r1034139 - in /subversion/trunk/subversion: libsvn_client/patch.c tests/cmdline/patch_tests.py

2010-11-11 Thread dannas
Author: dannas
Date: Thu Nov 11 21:21:16 2010
New Revision: 1034139

URL: http://svn.apache.org/viewvc?rev=1034139view=rev
Log:
Add support for handling symlinks in 'svn patch'.

* subversion/libsvn_client_patch.c
  (patch_target_t): Add 'is_special' field.
  (apply_one_patch): Record the possible presence of a svn:special 
property.
  (install_patched_target): Install symlinks.

* subversion/tests/cmdline/patch_tests.py
  (patch_add_symlink): New.

Modified:
subversion/trunk/subversion/libsvn_client/patch.c
subversion/trunk/subversion/tests/cmdline/patch_tests.py

Modified: subversion/trunk/subversion/libsvn_client/patch.c
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/patch.c?rev=1034139r1=1034138r2=1034139view=diff
==
--- subversion/trunk/subversion/libsvn_client/patch.c (original)
+++ subversion/trunk/subversion/libsvn_client/patch.c Thu Nov 11 21:21:16 2010
@@ -203,6 +203,9 @@ typedef struct patch_target_t {
   /* True if the patch changed any of the properties of the target. */
   svn_boolean_t has_prop_changes;
 
+  /* True if the patch contained a svn:special property. */
+  svn_boolean_t is_special;
+
   /* All the information that is specific to the content of the target. */
   target_content_info_t *content_info;
 
@@ -1736,6 +1739,9 @@ apply_one_patch(patch_target_t **patch_t
   prop_name = svn__apr_hash_index_key(hash_index);
   prop_patch = svn__apr_hash_index_val(hash_index);
 
+  if (! strcmp(prop_name, SVN_PROP_SPECIAL))
+target-is_special = TRUE;
+
   /* We'll store matched hunks in prop_content_info. */
   prop_target = apr_hash_get(target-prop_targets, prop_name, 
  APR_HASH_KEY_STRING);
@@ -2105,9 +2111,33 @@ install_patched_target(patch_target_t *t
 
   if (! dry_run  ! target-skipped)
 {
-  /* Copy the patched file on top of the target file. */
-  SVN_ERR(svn_io_copy_file(target-patched_path,
-   target-local_abspath, FALSE, pool));
+  if (target-is_special)
+{
+  svn_stream_t *stream;
+  svn_stream_t *patched_stream;
+  apr_file_t *file;
+
+  SVN_ERR(svn_io_file_open(file, target-patched_path,
+   APR_READ | APR_BINARY, APR_OS_DEFAULT,
+   pool));
+
+  patched_stream = svn_stream_from_aprfile2(file, FALSE /* disown 
*/,
+pool);
+  SVN_ERR(svn_subst_create_specialfile(stream, 
+   target-local_abspath,
+   pool, pool));
+  SVN_ERR(svn_stream_copy3(patched_stream, stream, 
+   NULL, /* cancel_func */ 
+   NULL, /* cancel_baton */
+   pool));
+}
+  else
+{
+  /* Copy the patched file on top of the target file. */
+  SVN_ERR(svn_io_copy_file(target-patched_path,
+   target-local_abspath, FALSE, pool));
+}
+
   if (target-added || target-replaced)
 {
   /* The target file didn't exist previously,

Modified: subversion/trunk/subversion/tests/cmdline/patch_tests.py
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/patch_tests.py?rev=1034139r1=1034138r2=1034139view=diff
==
--- subversion/trunk/subversion/tests/cmdline/patch_tests.py (original)
+++ subversion/trunk/subversion/tests/cmdline/patch_tests.py Thu Nov 11 
21:21:16 2010
@@ -3424,6 +3424,56 @@ def patch_set_prop_no_eol(sbox):
   patch doesn't append newline to properties
   return patch_one_property(sbox, False)
 
+# Regression test for issue #3697
+def patch_add_symlink(sbox):
+  patch that adds a symlink
+
+  sbox.build()
+  wc_dir = sbox.wc_dir
+
+  patch_file_path = make_patch_path(sbox)
+
+  # Apply patch
+
+  unidiff_patch = [
+Index: iota_symlink\n,
+===\n,
+--- iota_symlink\t(revision 0)\n,
++++ iota_symlink\t(working copy)\n,
+@@ -0,0 +1 @@\n,
++link iota\n,
+\n,
+Property changes on: iota_symlink\n,
+---\n,
+Added: svn:special\n,
+## -0,0 +1 ##\n,
++*\n,
+  ]
+
+  svntest.main.file_write(patch_file_path, ''.join(unidiff_patch))
+
+  expected_output = [
+'A %s\n' % os.path.join(wc_dir, 'iota_symlink'),
+  ]
+
+  expected_disk = svntest.main.greek_state.copy()
+  expected_disk.add({'iota_symlink': Item(contents=This is the file 
'iota'.\n

svn commit: r1023339 - /subversion/trunk/subversion/tests/libsvn_diff/parse-diff-test.c

2010-10-16 Thread dannas
Author: dannas
Date: Sat Oct 16 17:38:52 2010
New Revision: 1023339

URL: http://svn.apache.org/viewvc?rev=1023339view=rev
Log:
Refactor the C-unit tests for parsing diffs.

* subversion/tests/libsvn_diff/parse-diff-test.c
  (...): Use SVN_TEST_STRING_ASSERT() when comparing strings instead
of SVN_TEST_ASSERT(! strcmp(...). This change makes the code more
readable and gives a better error message.

Modified:
subversion/trunk/subversion/tests/libsvn_diff/parse-diff-test.c

Modified: subversion/trunk/subversion/tests/libsvn_diff/parse-diff-test.c
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/libsvn_diff/parse-diff-test.c?rev=1023339r1=1023338r2=1023339view=diff
==
--- subversion/trunk/subversion/tests/libsvn_diff/parse-diff-test.c (original)
+++ subversion/trunk/subversion/tests/libsvn_diff/parse-diff-test.c Sat Oct 16 
17:38:52 2010
@@ -301,10 +301,7 @@ check_content(svn_diff_hunk_t *hunk, svn
 SVN_TEST_ASSERT(exp_eof == hunk_eof);
 if (exp_eof)
   break;
-if (strcmp(exp_buf-data, hunk_buf-data))
-  return svn_error_createf(SVN_ERR_TEST_FAILED, NULL,
-   Expected '%s' but was '%s', exp_buf-data,
-   hunk_buf-data);
+SVN_TEST_STRING_ASSERT(exp_buf-data, hunk_buf-data);
   }
 
   SVN_TEST_ASSERT(hunk_buf-len == 0);
@@ -345,8 +342,8 @@ test_parse_unidiff(apr_pool_t *pool)
 ignore_whitespace, iterpool, 
 iterpool));
   SVN_TEST_ASSERT(patch);
-  SVN_TEST_ASSERT(! strcmp(patch-old_filename, A/C/gamma));
-  SVN_TEST_ASSERT(! strcmp(patch-new_filename, A/C/gamma));
+  SVN_TEST_STRING_ASSERT(patch-old_filename, A/C/gamma);
+  SVN_TEST_STRING_ASSERT(patch-new_filename, A/C/gamma);
   SVN_TEST_ASSERT(patch-hunks-nelts == 1);
 
   hunk = APR_ARRAY_IDX(patch-hunks, 0, svn_diff_hunk_t *);
@@ -365,13 +362,13 @@ test_parse_unidiff(apr_pool_t *pool)
   SVN_TEST_ASSERT(patch);
   if (reverse)
 {
-  SVN_TEST_ASSERT(! strcmp(patch-new_filename, A/D/gamma.orig));
-  SVN_TEST_ASSERT(! strcmp(patch-old_filename, A/D/gamma));
+  SVN_TEST_STRING_ASSERT(patch-new_filename, A/D/gamma.orig);
+  SVN_TEST_STRING_ASSERT(patch-old_filename, A/D/gamma);
 }
   else
 {
-  SVN_TEST_ASSERT(! strcmp(patch-old_filename, A/D/gamma.orig));
-  SVN_TEST_ASSERT(! strcmp(patch-new_filename, A/D/gamma));
+  SVN_TEST_STRING_ASSERT(patch-old_filename, A/D/gamma.orig);
+  SVN_TEST_STRING_ASSERT(patch-new_filename, A/D/gamma);
 }
   SVN_TEST_ASSERT(patch-hunks-nelts == 1);
 
@@ -409,8 +406,8 @@ test_parse_git_diff(apr_pool_t *pool)
 FALSE, /* ignore_whitespace */ 
 pool, pool));
   SVN_TEST_ASSERT(patch);
-  SVN_TEST_ASSERT(! strcmp(patch-old_filename, A/mu));
-  SVN_TEST_ASSERT(! strcmp(patch-new_filename, A/mu));
+  SVN_TEST_STRING_ASSERT(patch-old_filename, A/mu);
+  SVN_TEST_STRING_ASSERT(patch-new_filename, A/mu);
   SVN_TEST_ASSERT(patch-operation == svn_diff_op_deleted);
   SVN_TEST_ASSERT(patch-hunks-nelts == 0);
 
@@ -420,8 +417,8 @@ test_parse_git_diff(apr_pool_t *pool)
 FALSE, /* ignore_whitespace */ 
 pool, pool));
   SVN_TEST_ASSERT(patch);
-  SVN_TEST_ASSERT(! strcmp(patch-old_filename, A/C/gamma));
-  SVN_TEST_ASSERT(! strcmp(patch-new_filename, A/C/gamma));
+  SVN_TEST_STRING_ASSERT(patch-old_filename, A/C/gamma);
+  SVN_TEST_STRING_ASSERT(patch-new_filename, A/C/gamma);
   SVN_TEST_ASSERT(patch-operation == svn_diff_op_modified);
   SVN_TEST_ASSERT(patch-hunks-nelts == 1);
   
@@ -443,8 +440,8 @@ test_parse_git_diff(apr_pool_t *pool)
 pool, pool));
 
   SVN_TEST_ASSERT(patch);
-  SVN_TEST_ASSERT(! strcmp(patch-old_filename, iota));
-  SVN_TEST_ASSERT(! strcmp(patch-new_filename, iota.copied));
+  SVN_TEST_STRING_ASSERT(patch-old_filename, iota);
+  SVN_TEST_STRING_ASSERT(patch-new_filename, iota.copied);
   SVN_TEST_ASSERT(patch-operation == svn_diff_op_copied);
   SVN_TEST_ASSERT(patch-hunks-nelts == 0);
 
@@ -455,8 +452,8 @@ test_parse_git_diff(apr_pool_t *pool)
 pool, pool));
 
   SVN_TEST_ASSERT(patch);
-  SVN_TEST_ASSERT(! strcmp(patch-old_filename, new));
-  SVN_TEST_ASSERT(! strcmp(patch-new_filename, new));
+  SVN_TEST_STRING_ASSERT(patch-old_filename, new);
+  SVN_TEST_STRING_ASSERT(patch-new_filename, new);
   SVN_TEST_ASSERT(patch-operation == svn_diff_op_added);
   SVN_TEST_ASSERT(patch-hunks-nelts == 0);
 
@@ -482,8 +479,8 @@ test_parse_git_tree_and_text_diff(apr_po
 FALSE, /* ignore_whitespace */ 
 pool, pool));
   SVN_TEST_ASSERT(patch

svn commit: r995194 - /subversion/trunk/subversion/libsvn_client/patch.c

2010-09-08 Thread dannas
Author: dannas
Date: Wed Sep  8 18:58:29 2010
New Revision: 995194

URL: http://svn.apache.org/viewvc?rev=995194view=rev
Log:
In the patch code, remove some unnecessary intermediate variables.

* subversion/libsvn_client/patch.c
  (apply_one_patch): Use 'prop_patch_target_t' variables directly
instead of introducing intermediate variables to hold some
members.

Suggested by: stsp

Modified:
subversion/trunk/subversion/libsvn_client/patch.c

Modified: subversion/trunk/subversion/libsvn_client/patch.c
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/patch.c?rev=995194r1=995193r2=995194view=diff
==
--- subversion/trunk/subversion/libsvn_client/patch.c (original)
+++ subversion/trunk/subversion/libsvn_client/patch.c Wed Sep  8 18:58:29 2010
@@ -1721,16 +1721,13 @@ apply_one_patch(patch_target_t **patch_t
   svn_prop_patch_t *prop_patch;
   const char *prop_name;
   prop_patch_target_t *prop_target;
-  target_content_info_t *prop_content_info;
 
   prop_name = svn__apr_hash_index_key(hash_index);
   prop_patch = svn__apr_hash_index_val(hash_index);
 
-  /* We'll store matched hunks in prop_content_info.
-   * ### Just use prop_target-content_info? */
+  /* We'll store matched hunks in prop_content_info. */
   prop_target = apr_hash_get(target-prop_targets, prop_name, 
  APR_HASH_KEY_STRING);
-  prop_content_info = prop_target-content_info;
 
   for (i = 0; i  prop_patch-hunks-nelts; i++)
 {
@@ -1749,7 +1746,8 @@ apply_one_patch(patch_target_t **patch_t
* If no match is found initially, try with fuzz. */
   do
 {
-  SVN_ERR(get_hunk_info(hi, target, prop_content_info, hunk, fuzz,
+  SVN_ERR(get_hunk_info(hi, target, prop_target-content_info, 
+hunk, fuzz,
 ignore_whitespace,
 TRUE /* is_prop_hunk */,
 cancel_func, cancel_baton,
@@ -1758,7 +1756,7 @@ apply_one_patch(patch_target_t **patch_t
 }
   while (hi-rejected  fuzz = MAX_FUZZ  ! hi-already_applied);
 
-  APR_ARRAY_PUSH(prop_content_info-hunks, hunk_info_t *) = hi;
+  APR_ARRAY_PUSH(prop_target-content_info-hunks, hunk_info_t *) = hi;
 }
 }
 
@@ -1768,40 +1766,36 @@ apply_one_patch(patch_target_t **patch_t
hash_index = apr_hash_next(hash_index))
 {
   prop_patch_target_t *prop_target;
-  target_content_info_t *prop_content_info;
-  const char *prop_patched_path;
 
   prop_target = svn__apr_hash_index_val(hash_index);
-  /* ### Just use prop_target-content_info? */
-  prop_content_info = prop_target-content_info;
-  /* ### Just use prop_target-patched_path? */
-  prop_patched_path = prop_target-patched_path;
 
-  for (i = 0; i  prop_content_info-hunks-nelts; i++)
+  for (i = 0; i  prop_target-content_info-hunks-nelts; i++)
 {
   hunk_info_t *hi;
 
   svn_pool_clear(iterpool);
 
-  hi = APR_ARRAY_IDX(prop_content_info-hunks, i, hunk_info_t *);
+  hi = APR_ARRAY_IDX(prop_target-content_info-hunks, i, 
+ hunk_info_t *);
   if (hi-already_applied)
 continue;
   else if (hi-rejected)
-SVN_ERR(reject_hunk(target, prop_content_info, hi,
+SVN_ERR(reject_hunk(target, prop_target-content_info, hi,
 prop_target-name,
 iterpool));
   else
-SVN_ERR(apply_hunk(target, prop_content_info, hi, 
+SVN_ERR(apply_hunk(target, prop_target-content_info, hi, 
prop_target-name,
iterpool));
 }
 
-if (prop_content_info-stream)
+if (prop_target-content_info-stream)
   {
 /* Copy any remaining lines to target. */
-SVN_ERR(copy_lines_to_target(prop_content_info, 0,
- prop_patched_path, scratch_pool));
-if (! prop_content_info-eof)
+SVN_ERR(copy_lines_to_target(prop_target-content_info, 0,
+ prop_target-patched_path, 
+ scratch_pool));
+if (! prop_target-content_info-eof)
   {
 /* We could not copy the entire target property to the
  * temporary file, and would truncate the target if we




svn commit: r995215 - /subversion/trunk/subversion/libsvn_client/patch.c

2010-09-08 Thread dannas
Author: dannas
Date: Wed Sep  8 19:29:11 2010
New Revision: 995215

URL: http://svn.apache.org/viewvc?rev=995215view=rev
Log:
* subversion/libsvn_client/patch.c
  (apply_one_patch): Remove a question with an associated answer from 
the code.

Modified:
subversion/trunk/subversion/libsvn_client/patch.c

Modified: subversion/trunk/subversion/libsvn_client/patch.c
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/patch.c?rev=995215r1=995214r2=995215view=diff
==
--- subversion/trunk/subversion/libsvn_client/patch.c (original)
+++ subversion/trunk/subversion/libsvn_client/patch.c Wed Sep  8 19:29:11 2010
@@ -1838,15 +1838,7 @@ apply_one_patch(patch_target_t **patch_t
   {
 /* We could not copy the entire target property to the
  * temporary file, and would truncate the target if we
- * copied the temporary file on top of it. Skip this target. 
- *
- * ### dannas: Do we really want to skip an entire target
- * ### if one of the properties does not apply cleanly,
- * ### e.g. both text changes and all prop changes will not be
- * ### installed.
- * ### stsp: This is a should never happen situation.
- * ### It means we've run out of disk space or something
- * ### like that, so skipping is appropriate. */
+ * copied the temporary file on top of it. Skip this target.  
*/
 target-skipped = TRUE;
   }
   }




svn commit: r993504 - /subversion/trunk/subversion/tests/cmdline/patch_tests.py

2010-09-07 Thread dannas
Author: dannas
Date: Tue Sep  7 19:49:02 2010
New Revision: 993504

URL: http://svn.apache.org/viewvc?rev=993504view=rev
Log:
Add patch test for adding empty files.

Such files can only be applied if the diff uses the git extensions to
the unidiff format.

* subversion/tests/cmdline/patch_tests.py
  (patch_git_add_file): New.
  (test_list): Add patch_git_add_file.

Modified:
subversion/trunk/subversion/tests/cmdline/patch_tests.py

Modified: subversion/trunk/subversion/tests/cmdline/patch_tests.py
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/patch_tests.py?rev=993504r1=993503r2=993504view=diff
==
--- subversion/trunk/subversion/tests/cmdline/patch_tests.py (original)
+++ subversion/trunk/subversion/tests/cmdline/patch_tests.py Tue Sep  7 
19:49:02 2010
@@ -2976,6 +2976,43 @@ def patch_prop_with_fuzz(sbox):
1, # check-props
1) # dry-run
 
+def patch_git_add_file(sbox):
+  patch that contains empty files
+
+  sbox.build()
+  wc_dir = sbox.wc_dir
+  patch_file_path = make_patch_path(sbox)
+
+  new_path = os.path.join(wc_dir, 'new')
+
+  unidiff_patch = [
+Index: new\n,
+===\n,
+diff --git a/new b/new\n,
+new file mode 10644\n,
+  ]
+
+  svntest.main.file_write(patch_file_path, ''.join(unidiff_patch))
+
+  expected_output = [
+'A %s\n' % os.path.join(wc_dir, 'new'),
+  ]
+  expected_disk = svntest.main.greek_state.copy()
+  expected_disk.add({'new' : Item(contents=)})
+
+  expected_status = svntest.actions.get_virginal_state(wc_dir, 1)
+  expected_status.add({'new' : Item(status='A ', wc_rev=0)})
+
+  expected_skip = wc.State('', { })
+
+  svntest.actions.run_and_verify_patch(wc_dir, 
os.path.abspath(patch_file_path),
+   expected_output,
+   expected_disk,
+   expected_status,
+   expected_skip,
+   None, # expected err
+   1, # check-props
+   1) # dry-run
 
 #Run the tests
 
@@ -3005,6 +3042,7 @@ test_list = [ None,
   patch_add_path_with_props,
   patch_prop_offset,
   patch_prop_with_fuzz,
+  patch_git_add_file,
 ]
 
 if __name__ == '__main__':




svn commit: r991459 - in /subversion/trunk/subversion: libsvn_diff/parse-diff.c tests/libsvn_diff/parse-diff-test.c

2010-09-01 Thread dannas
Author: dannas
Date: Wed Sep  1 07:44:13 2010
New Revision: 991459

URL: http://svn.apache.org/viewvc?rev=991459view=rev
Log:
Fix the diff parser to look for the correct first line of a git diff.

The change that is beeing applied is s/git --diff/diff --git/.

* subversion/libsvn_diff/parse-diff.c
  (parse_next_hunk,
   git_start,
   svn_diff_parse_next_patch): Check for 'diff --git' as first line of a 
git diff header.

* subversion/libsvn_diff/parse-diff-test.c
  (git_unidiff,
   git_tree_and_text_unidiff,
   bad_git_diff_header,
   path_with_spaces_unidiff): Use 'diff --git as first line of git
diff headers.

Found by: stsp

Modified:
subversion/trunk/subversion/libsvn_diff/parse-diff.c
subversion/trunk/subversion/tests/libsvn_diff/parse-diff-test.c

Modified: subversion/trunk/subversion/libsvn_diff/parse-diff.c
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_diff/parse-diff.c?rev=991459r1=991458r2=991459view=diff
==
--- subversion/trunk/subversion/libsvn_diff/parse-diff.c (original)
+++ subversion/trunk/subversion/libsvn_diff/parse-diff.c Wed Sep  1 07:44:13 
2010
@@ -709,7 +709,7 @@ parse_next_hunk(svn_diff_hunk_t **hunk,
   *prop_operation = svn_diff_op_modified;
 }
   else if (starts_with(line-data, minus)
-   || starts_with(line-data, git --diff ))
+   || starts_with(line-data, diff --git ))
 /* This could be a header of another patch. Bail out. */
 break;
 }
@@ -905,8 +905,7 @@ git_start(enum parse_state *new_state, c
* such substitution then the whole pathname is put in double quotes.
*/
 
-  /* Our line should look like this: 'git --diff a/path b/path'. 
-   * ### Not diff --git a/path b/path ?
+  /* Our line should look like this: 'diff --git a/path b/path'. 
*
* If we find any deviations from that format, we return with state reset
* to start.
@@ -942,9 +941,9 @@ git_start(enum parse_state *new_state, c
   /* By now, we know that we have a line on the form '--git diff a/.+ b/.+'
* We only need the filenames when we have deleted or added empty
* files. In those cases the old_path and new_path is identical on the
-   * '--git diff' line.  For all other cases we fetch the filenames from
+   * 'diff --git' line.  For all other cases we fetch the filenames from
* other header lines. */ 
-  old_path_start = line + strlen(--git diff a/);
+  old_path_start = line + strlen(diff --git a/);
   new_path_end = line + strlen(line);
   new_path_start = old_path_start;
 
@@ -1165,8 +1164,7 @@ svn_diff_parse_next_patch(svn_patch_t **
 {
   {--- ,  state_start,diff_minus},
   {+++ ,  state_minus_seen,   diff_plus},
-  /* ### Not diff --git? */
-  {git --diff,state_start,git_start},
+  {diff --git,state_start,git_start},
   {--- a/,state_git_diff_seen,git_minus},
   {--- a/,state_git_tree_seen,git_minus},
   {--- /dev/null, state_git_tree_seen,git_minus},

Modified: subversion/trunk/subversion/tests/libsvn_diff/parse-diff-test.c
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/libsvn_diff/parse-diff-test.c?rev=991459r1=991458r2=991459view=diff
==
--- subversion/trunk/subversion/tests/libsvn_diff/parse-diff-test.c (original)
+++ subversion/trunk/subversion/tests/libsvn_diff/parse-diff-test.c Wed Sep  1 
07:44:13 2010
@@ -59,11 +59,11 @@ static const char *unidiff =
 static const char *git_unidiff =
   Index: A/mu (deleted)   NL
   === NL
-  git --diff a/A/mu b/A/muNL
+  diff --git a/A/mu b/A/muNL
   deleted file mode 100644NL
   Index: A/C/gammaNL
   === NL
-  git --diff a/A/C/gamma b/A/C/gamma  NL
+  diff --git a/A/C/gamma b/A/C/gamma  NL
   --- a/A/C/gamma\t(revision 2)   NL
   +++ b/A/C/gamma\t(working copy) NL
   @@ -1 +1,2 @@   NL
@@ -71,19 +71,19 @@ static const char *git_unidiff =
   +some more bytes to 'gamma' NL
   Index: iota NL
   === NL
-  git --diff a/iota b/iota.copied NL
+  diff --git a/iota b/iota.copied

svn commit: r990772 - /subversion/trunk/subversion/tests/cmdline/diff_tests.py

2010-08-30 Thread dannas
Author: dannas
Date: Mon Aug 30 11:22:47 2010
New Revision: 990772

URL: http://svn.apache.org/viewvc?rev=990772view=rev
Log:
Adjust diff test for URL-WC to include copied paths.

Since the server does not send copyfrom args for diff
operations we do not yet handle copied paths.

* subversion/tests/cmdline/diff_tests.py
  (diff_git_format_url_wc): Add copied paths.
  (test_list): Mark diff_git_format_url_wc() as XFailing.

Modified:
subversion/trunk/subversion/tests/cmdline/diff_tests.py

Modified: subversion/trunk/subversion/tests/cmdline/diff_tests.py
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/diff_tests.py?rev=990772r1=990771r2=990772view=diff
==
--- subversion/trunk/subversion/tests/cmdline/diff_tests.py (original)
+++ subversion/trunk/subversion/tests/cmdline/diff_tests.py Mon Aug 30 11:22:47 
2010
@@ -3420,17 +3420,37 @@ def diff_git_format_url_wc(sbox):
   iota_path = os.path.join(wc_dir, 'iota')
   mu_path = os.path.join(wc_dir, 'A', 'mu')
   new_path = os.path.join(wc_dir, 'new')
+  lambda_path = os.path.join(wc_dir, 'A', 'B', 'lambda')
+  lambda_copied_path = os.path.join(wc_dir, 'A', 'B', 'lambda_copied')
+  alpha_path = os.path.join(wc_dir, 'A', 'B', 'E', 'alpha')
+  alpha_copied_path = os.path.join(wc_dir, 'A', 'B', 'E', 'alpha_copied')
+
   svntest.main.file_append(iota_path, Changed 'iota'.\n)
   svntest.main.file_append(new_path, This is the file 'new'.\n)
   svntest.main.run_svn(None, 'add', new_path)
   svntest.main.run_svn(None, 'rm', mu_path)
+  svntest.main.run_svn(None, 'cp', lambda_path, lambda_copied_path)
+  svntest.main.run_svn(None, 'cp', alpha_path, alpha_copied_path)
+  svntest.main.file_append(alpha_copied_path, This is a copy of 'alpha'.\n)
 
   ### We're not testing copied or moved paths
 
   svntest.main.run_svn(None, 'commit', '-m', 'Committing changes', wc_dir)
   svntest.main.run_svn(None, 'up', wc_dir)
 
-  expected_output = make_git_diff_header(new_path, new, revision 0,
+  expected_output = make_git_diff_header(lambda_copied_path,
+ A/B/lambda_copied,
+ revision 1, working copy,
+ copyfrom_path=A/B/lambda, cp=True,
+ text_changes=False) \
+  + make_git_diff_header(alpha_copied_path, A/B/E/alpha_copied,
+ revision 0, working copy,
+ copyfrom_path=A/B/E/alpha, cp=True,
+ text_changes=True) + [
+@@ -1 +1,2 @@\n,
+ This is the file 'alpha'.\n,
++This is a copy of 'alpha'.\n,
+  ] + make_git_diff_header(new_path, new, revision 0,
  revision 2, add=True) + [
 @@ -0,0 +1 @@\n,
 +This is the file 'new'.\n,
@@ -3760,7 +3780,7 @@ test_list = [ None,
   XFail(diff_url_against_local_mods),
   XFail(diff_preexisting_rev_against_local_add),
   diff_git_format_wc_wc,
-  diff_git_format_url_wc,
+  XFail(diff_git_format_url_wc),
   diff_git_format_url_url,
   diff_prop_missing_context,
   diff_prop_multiple_hunks,




svn commit: r990774 - /subversion/trunk/subversion/tests/cmdline/diff_tests.py

2010-08-30 Thread dannas
Author: dannas
Date: Mon Aug 30 11:32:12 2010
New Revision: 990774

URL: http://svn.apache.org/viewvc?rev=990774view=rev
Log:
Adjust diff test for URL-URL to include copied paths.

Since the server does not send copyfrom args for diff
operations we do not yet handle copied paths.

* subversion/tests/cmdline/diff_tests.py
  (diff_git_format_url_wc): Remove TODO about to test for copied paths.
We do that.
  (diff_git_format_url_url): Start testing copied paths.
  (test_list): Mark diff_git_format_url_url() as XFailing.

Modified:
subversion/trunk/subversion/tests/cmdline/diff_tests.py

Modified: subversion/trunk/subversion/tests/cmdline/diff_tests.py
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/diff_tests.py?rev=990774r1=990773r2=990774view=diff
==
--- subversion/trunk/subversion/tests/cmdline/diff_tests.py (original)
+++ subversion/trunk/subversion/tests/cmdline/diff_tests.py Mon Aug 30 11:32:12 
2010
@@ -3433,7 +3433,7 @@ def diff_git_format_url_wc(sbox):
   svntest.main.run_svn(None, 'cp', alpha_path, alpha_copied_path)
   svntest.main.file_append(alpha_copied_path, This is a copy of 'alpha'.\n)
 
-  ### We're not testing copied or moved paths
+  ### We're not testing moved paths
 
   svntest.main.run_svn(None, 'commit', '-m', 'Committing changes', wc_dir)
   svntest.main.run_svn(None, 'up', wc_dir)
@@ -3478,18 +3478,38 @@ def diff_git_format_url_url(sbox):
   iota_path = os.path.join(wc_dir, 'iota')
   mu_path = os.path.join(wc_dir, 'A', 'mu')
   new_path = os.path.join(wc_dir, 'new')
+  lambda_path = os.path.join(wc_dir, 'A', 'B', 'lambda')
+  lambda_copied_path = os.path.join(wc_dir, 'A', 'B', 'lambda_copied')
+  alpha_path = os.path.join(wc_dir, 'A', 'B', 'E', 'alpha')
+  alpha_copied_path = os.path.join(wc_dir, 'A', 'B', 'E', 'alpha_copied')
+
   svntest.main.file_append(iota_path, Changed 'iota'.\n)
   svntest.main.file_append(new_path, This is the file 'new'.\n)
   svntest.main.run_svn(None, 'add', new_path)
   svntest.main.run_svn(None, 'rm', mu_path)
+  svntest.main.run_svn(None, 'cp', lambda_path, lambda_copied_path)
+  svntest.main.run_svn(None, 'cp', alpha_path, alpha_copied_path)
+  svntest.main.file_append(alpha_copied_path, This is a copy of 'alpha'.\n)
 
-  ### We're not testing copied or moved paths. When we do, we will not be
-  ### able to identify them as copies/moves until we have editor-v2.
+  ### We do not test moved paths. We propably won't be able to track those
+  ### until we have editor-v2.
 
   svntest.main.run_svn(None, 'commit', '-m', 'Committing changes', wc_dir)
   svntest.main.run_svn(None, 'up', wc_dir)
 
-  expected_output = make_git_diff_header(A/mu, A/mu, revision 1, 
+  expected_output = make_git_diff_header(lambda_copied_path,
+ A/B/lambda_copied,
+ revision 1, revision 2,
+ copyfrom_path=A/B/lambda, cp=True,
+ text_changes=False) \
+  + make_git_diff_header(alpha_copied_path, A/B/E/alpha_copied,
+ revision 1, revision 2,
+ copyfrom_path=A/B/E/alpha, cp=True,
+ text_changes=True) + [
+@@ -1 +1,2 @@\n,
+ This is the file 'alpha'.\n,
++This is a copy of 'alpha'.\n,
+  ] +  make_git_diff_header(A/mu, A/mu, revision 1, 
  revision 2, 
  delete=True) + [
 @@ -1 +0,0 @@\n,
@@ -3781,7 +3801,7 @@ test_list = [ None,
   XFail(diff_preexisting_rev_against_local_add),
   diff_git_format_wc_wc,
   XFail(diff_git_format_url_wc),
-  diff_git_format_url_url,
+  XFail(diff_git_format_url_url),
   diff_prop_missing_context,
   diff_prop_multiple_hunks,
   diff_git_empty_files,




svn commit: r990790 - in /subversion/trunk/subversion: include/ libsvn_client/ libsvn_ra/ libsvn_ra_local/ libsvn_ra_neon/ libsvn_ra_serf/ libsvn_ra_svn/ libsvn_wc/ svnserve/ tests/cmdline/

2010-08-30 Thread dannas
Author: dannas
Date: Mon Aug 30 12:54:46 2010
New Revision: 990790

URL: http://svn.apache.org/viewvc?rev=990790view=rev
Log:
Make the diff editor able to receive copyfrom information. Involves
passing down a 'send_copyfrom_args' to all RA implemtations.

The copyfrom information is needed when creating diffs with the git 
unidiff extension for copied paths.

Note that this commit merely allows the copyfrom args to be passed to
the client. They copyfrom information is not yet stored and used.

* subversion/libsvn_ra/ra_loader.c
  (svn_ra_do_diff4): New.
  (svn_ra_do_diff3): Move from here ..

* subversion/libsvn_ra/deprecated.c
  (svn_ra_do_diff3): .. To here.
  (svn_ra_do_diff2): Call svn_ra_do_diff3() instead of the vtable
callback since the signature has changed.

* subversion/libsvn_ra/wrapper_template.h
  (compat_do_diff): Track the new 'send_copyfrom_args' parameter.

* subversion/libsvn_ra/ra_loader.h
  (svn_ra__vtable_t): Add 'send_copyfrom_args' parameter.

* subversion/libsvn_ra_local/ra_plugin.c
  (svn_ra_local__do_diff): Add 'send_copyfrom_args' parameter.

* subversion/tests/cmdline/diff_tests.py
  (test_list): Mark diff_backward_repos_wc_copy() as XFailing.
The tested code currently does not handle copied paths
with no text changes. Will be fixed in a follow-up.

* subversion/libsvn_ra_svn/protocol
  (...) Update the diff command description.

* subversion/libsvn_ra_svn/client.c
  (ra_svn_diff): Add 'send_copyfrom_args' to the command to be written.

* subversion/include/svn_ra.h
  (svn_ra_do_diff4): New.
  (svn_ra_do_diff3): Deprecate.

* subversion/libsvn_wc/diff.c
  (add_file): Add TODO about recording the copyfrom info and checking
that the copyfrom revision is within the span of the diff operation.

* subversion/libsvn_client/repos_diff.c
  (add_file): Add TODO about recording the copyfrom info and checking
that the copyfrom revision is within the span of the diff operation.

* subversion/libsvn_client/diff.c
  (diff_repos_repos,
   diff_repos_wc,
   diff_summarize_repos_repos): Replace svn_ra_do_diff3() with
svn_ra_do_diff4().

* subversion/libsvn_ra_neon/ra_neon.h
  (svn_ra_neon__do_diff): Add 'send_copyfrom_args' parameter.

* subversion/libsvn_ra_neon/fetch.c
  (svn_ra_neon__do_diff): Add 'send_copyfrom_args' parameter.

* subversion/libsvn_ra_serf/update.c
  (svn_ra_serf__do_diff): Add 'send_copyfrom_args' parameter.

* subversion/libsvn_ra_serf/ra_serf.h
  (svn_ra_serf__do_diff): Add 'send_copyfrom_args' parameter.

* subversion/svnserve/serve.c
  (diff): Parse the parameters for send_copyfrom_param.


Modified:
subversion/trunk/subversion/include/svn_ra.h
subversion/trunk/subversion/libsvn_client/diff.c
subversion/trunk/subversion/libsvn_client/repos_diff.c
subversion/trunk/subversion/libsvn_ra/deprecated.c
subversion/trunk/subversion/libsvn_ra/ra_loader.c
subversion/trunk/subversion/libsvn_ra/ra_loader.h
subversion/trunk/subversion/libsvn_ra/wrapper_template.h
subversion/trunk/subversion/libsvn_ra_local/ra_plugin.c
subversion/trunk/subversion/libsvn_ra_neon/fetch.c
subversion/trunk/subversion/libsvn_ra_neon/ra_neon.h
subversion/trunk/subversion/libsvn_ra_serf/ra_serf.h
subversion/trunk/subversion/libsvn_ra_serf/update.c
subversion/trunk/subversion/libsvn_ra_svn/client.c
subversion/trunk/subversion/libsvn_ra_svn/protocol
subversion/trunk/subversion/libsvn_wc/diff.c
subversion/trunk/subversion/svnserve/serve.c
subversion/trunk/subversion/tests/cmdline/diff_tests.py

Modified: subversion/trunk/subversion/include/svn_ra.h
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/include/svn_ra.h?rev=990790r1=990789r2=990790view=diff
==
--- subversion/trunk/subversion/include/svn_ra.h (original)
+++ subversion/trunk/subversion/include/svn_ra.h Mon Aug 30 12:54:46 2010
@@ -1291,9 +1291,31 @@ svn_ra_do_status(svn_ra_session_t *sessi
  * needed, and sending too much data back, a pre-1.5 'recurse'
  * directive may be sent to the server, based on @a depth.
  *
- * @since New in 1.5.
+ * @since New in 1.7.
  */
 svn_error_t *
+svn_ra_do_diff4(svn_ra_session_t *session,
+const svn_ra_reporter3_t **reporter,
+void **report_baton,
+svn_revnum_t revision,
+const char *diff_target,
+svn_depth_t depth,
+svn_boolean_t send_copyfrom_args,
+svn_boolean_t ignore_ancestry,
+svn_boolean_t text_deltas,
+const char *versus_url,
+const svn_delta_editor_t *diff_editor,
+void *diff_baton,
+apr_pool_t *pool);
+
+/**
+ * Similar to svn_ra_do_diff4(), but with @c send_copyfrom_args set to
+ * FALSE.
+ *
+ * @deprecated Provided for compatibility with the 1.5 API.
+ */
+SVN_DEPRECATED
+svn_error_t *
 svn_ra_do_diff3(svn_ra_session_t *session

svn commit: r990804 - /subversion/trunk/subversion/tests/cmdline/diff_tests.py

2010-08-30 Thread dannas
Author: dannas
Date: Mon Aug 30 13:48:18 2010
New Revision: 990804

URL: http://svn.apache.org/viewvc?rev=990804view=rev
Log:
Follow-up to r990790.

Skip a diff test unless we're using ra_neon. For some reason,
ra_local and ra_svn does not call apply_textdelta() for copied
paths with no text changes while ra_neon does.

* subversion/tests/cmdline/diff_tests.py
  (test_list): Mark diff_backward_repos_wc_copy() with SkipUnless.

Modified:
subversion/trunk/subversion/tests/cmdline/diff_tests.py

Modified: subversion/trunk/subversion/tests/cmdline/diff_tests.py
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/diff_tests.py?rev=990804r1=990803r2=990804view=diff
==
--- subversion/trunk/subversion/tests/cmdline/diff_tests.py (original)
+++ subversion/trunk/subversion/tests/cmdline/diff_tests.py Mon Aug 30 13:48:18 
2010
@@ -33,6 +33,7 @@ import svntest
 
 # (abbreviation)
 Skip = svntest.testcase.Skip
+SkipUnless = svntest.testcase.SkipUnless
 XFail = svntest.testcase.XFail
 Item = svntest.wc.StateItem
 
@@ -3792,7 +3793,8 @@ test_list = [ None,
   XFail(diff_in_renamed_folder),
   diff_with_depth,
   diff_ignore_eolstyle_empty_lines,
-  XFail(diff_backward_repos_wc_copy),
+  SkipUnless(diff_backward_repos_wc_copy,
+ svntest.main.is_ra_type_dav_neon),
   diff_summarize_xml,
   diff_file_depth_empty,
   diff_wrong_extension_type,




svn commit: r990826 - in /subversion/trunk/subversion: include/ libsvn_client/ libsvn_ra/ libsvn_ra_local/ libsvn_ra_neon/ libsvn_ra_serf/ libsvn_ra_svn/ libsvn_wc/ svnserve/ tests/cmdline/

2010-08-30 Thread dannas
Author: dannas
Date: Mon Aug 30 15:46:37 2010
New Revision: 990826

URL: http://svn.apache.org/viewvc?rev=990826view=rev
Log:
Revert r990790 and r990804. Make the diff editor able to receive 
copyfrom info

It turns out that determing copyfrom information is more involved
than I first anticipated. We first need a proper definition of
what kind of information the server should send.

Modified:
subversion/trunk/subversion/include/svn_ra.h
subversion/trunk/subversion/libsvn_client/diff.c
subversion/trunk/subversion/libsvn_client/repos_diff.c
subversion/trunk/subversion/libsvn_ra/deprecated.c
subversion/trunk/subversion/libsvn_ra/ra_loader.c
subversion/trunk/subversion/libsvn_ra/ra_loader.h
subversion/trunk/subversion/libsvn_ra/wrapper_template.h
subversion/trunk/subversion/libsvn_ra_local/ra_plugin.c
subversion/trunk/subversion/libsvn_ra_neon/fetch.c
subversion/trunk/subversion/libsvn_ra_neon/ra_neon.h
subversion/trunk/subversion/libsvn_ra_serf/ra_serf.h
subversion/trunk/subversion/libsvn_ra_serf/update.c
subversion/trunk/subversion/libsvn_ra_svn/client.c
subversion/trunk/subversion/libsvn_ra_svn/protocol
subversion/trunk/subversion/libsvn_wc/diff.c
subversion/trunk/subversion/svnserve/serve.c
subversion/trunk/subversion/tests/cmdline/diff_tests.py

Modified: subversion/trunk/subversion/include/svn_ra.h
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/include/svn_ra.h?rev=990826r1=990825r2=990826view=diff
==
--- subversion/trunk/subversion/include/svn_ra.h (original)
+++ subversion/trunk/subversion/include/svn_ra.h Mon Aug 30 15:46:37 2010
@@ -1291,30 +1291,8 @@ svn_ra_do_status(svn_ra_session_t *sessi
  * needed, and sending too much data back, a pre-1.5 'recurse'
  * directive may be sent to the server, based on @a depth.
  *
- * @since New in 1.7.
- */
-svn_error_t *
-svn_ra_do_diff4(svn_ra_session_t *session,
-const svn_ra_reporter3_t **reporter,
-void **report_baton,
-svn_revnum_t revision,
-const char *diff_target,
-svn_depth_t depth,
-svn_boolean_t send_copyfrom_args,
-svn_boolean_t ignore_ancestry,
-svn_boolean_t text_deltas,
-const char *versus_url,
-const svn_delta_editor_t *diff_editor,
-void *diff_baton,
-apr_pool_t *pool);
-
-/**
- * Similar to svn_ra_do_diff4(), but with @c send_copyfrom_args set to
- * FALSE.
- *
- * @deprecated Provided for compatibility with the 1.5 API.
+ * @since New in 1.5.
  */
-SVN_DEPRECATED
 svn_error_t *
 svn_ra_do_diff3(svn_ra_session_t *session,
 const svn_ra_reporter3_t **reporter,

Modified: subversion/trunk/subversion/libsvn_client/diff.c
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/diff.c?rev=990826r1=990825r2=990826view=diff
==
--- subversion/trunk/subversion/libsvn_client/diff.c (original)
+++ subversion/trunk/subversion/libsvn_client/diff.c Mon Aug 30 15:46:37 2010
@@ -1737,10 +1737,9 @@ diff_repos_repos(const svn_wc_diff_callb
diff_editor, diff_edit_baton, pool));
 
   /* We want to switch our txn into URL2 */
-  SVN_ERR(svn_ra_do_diff4
+  SVN_ERR(svn_ra_do_diff3
   (ra_session, reporter, reporter_baton, rev2, target1,
-   depth, TRUE /* send_copyfrom_args */,
-   ignore_ancestry, TRUE,
+   depth, ignore_ancestry, TRUE,
url2, diff_editor, diff_edit_baton, pool));
 
   /* Drive the reporter; do the diff. */
@@ -1879,12 +1878,11 @@ diff_repos_wc(const char *path1,
   else
 callback_baton-revnum2 = rev;
 
-  SVN_ERR(svn_ra_do_diff4(ra_session,
+  SVN_ERR(svn_ra_do_diff3(ra_session,
   reporter, reporter_baton,
   rev,
   target ? svn_path_uri_decode(target, pool) : NULL,
   depth,
-  TRUE, /* send_copyfrom_args */
   ignore_ancestry,
   TRUE,  /* text_deltas */
   url1,
@@ -2022,10 +2020,9 @@ diff_summarize_repos_repos(svn_client_di
ctx-cancel_baton, diff_editor, diff_edit_baton, pool));
 
   /* We want to switch our txn into URL2 */
-  SVN_ERR(svn_ra_do_diff4
+  SVN_ERR(svn_ra_do_diff3
   (ra_session, reporter, reporter_baton, rev2, target1,
-   depth, TRUE /* send_copyfrom_args */, 
-   ignore_ancestry,
+   depth, ignore_ancestry,
FALSE /* do not create text delta */, url2, diff_editor,
diff_edit_baton, pool));
 

Modified: subversion/trunk/subversion/libsvn_client/repos_diff.c
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/repos_diff.c?rev=990826r1

svn propchange: r990772 - svn:log

2010-08-30 Thread dannas
Author: dannas
Revision: 990772
Modified property: svn:log

Modified: svn:log at Mon Aug 30 15:52:27 2010
--
--- svn:log (original)
+++ svn:log Mon Aug 30 15:52:27 2010
@@ -6,3 +6,5 @@ operations we do not yet handle copied p
 * subversion/tests/cmdline/diff_tests.py
   (diff_git_format_url_wc): Add copied paths.
   (test_list): Mark diff_git_format_url_wc() as XFailing.
+
+[Note from the future: This commit was reverted in r990830]



svn propchange: r990774 - svn:log

2010-08-30 Thread dannas
Author: dannas
Revision: 990774
Modified property: svn:log

Modified: svn:log at Mon Aug 30 15:53:14 2010
--
--- svn:log (original)
+++ svn:log Mon Aug 30 15:53:14 2010
@@ -8,3 +8,5 @@ operations we do not yet handle copied p
 We do that.
   (diff_git_format_url_url): Start testing copied paths.
   (test_list): Mark diff_git_format_url_url() as XFailing.
+
+[Note from the future: This commit was reverted in r990830]



svn propchange: r990790 - svn:log

2010-08-30 Thread dannas
Author: dannas
Revision: 990790
Modified property: svn:log

Modified: svn:log at Mon Aug 30 15:54:30 2010
--
--- svn:log (original)
+++ svn:log Mon Aug 30 15:54:30 2010
@@ -1,3 +1,5 @@
+[Note from the future: This commit was reverted in r990826]
+
 Make the diff editor able to receive copyfrom information. Involves
 passing down a 'send_copyfrom_args' to all RA implemtations.
 



svn propchange: r990804 - svn:log

2010-08-30 Thread dannas
Author: dannas
Revision: 990804
Modified property: svn:log

Modified: svn:log at Mon Aug 30 15:55:39 2010
--
--- svn:log (original)
+++ svn:log Mon Aug 30 15:55:39 2010
@@ -1,3 +1,5 @@
+[ Note from the future: This commit was reverted in r990826 ]
+
 Follow-up to r990790.
 
 Skip a diff test unless we're using ra_neon. For some reason,



svn commit: r985621 - /subversion/trunk/subversion/tests/cmdline/diff_tests.py

2010-08-15 Thread dannas
Author: dannas
Date: Sun Aug 15 07:20:21 2010
New Revision: 985621

URL: http://svn.apache.org/viewvc?rev=985621view=rev
Log:
Make a wc-wc diff test include a copied path. 

Currently we don't handle copied paths for wc-wc diffs unless the 
--show-copies-as-adds flag is specified. The idea is that copied
paths should always show up in the diff when we use the git diff
format.

* subversion/tests/cmdline/diff_tests.py
  (diff_git_format_wc_wc): Add copied path.
  (test_list): Mark diff_git_format_wc_wc() as XFailing.

Modified:
subversion/trunk/subversion/tests/cmdline/diff_tests.py

Modified: subversion/trunk/subversion/tests/cmdline/diff_tests.py
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/diff_tests.py?rev=985621r1=985620r2=985621view=diff
==
--- subversion/trunk/subversion/tests/cmdline/diff_tests.py (original)
+++ subversion/trunk/subversion/tests/cmdline/diff_tests.py Sun Aug 15 07:20:21 
2010
@@ -3365,12 +3365,16 @@ def diff_git_format_wc_wc(sbox):
   iota_path = os.path.join(wc_dir, 'iota')
   mu_path = os.path.join(wc_dir, 'A', 'mu')
   new_path = os.path.join(wc_dir, 'new')
+  lambda_path = os.path.join(wc_dir, 'A', 'B', 'lambda')
+  lambda_copied_path = os.path.join(wc_dir, 'A', 'B', 'lambda_copied')
+
   svntest.main.file_append(iota_path, Changed 'iota'.\n)
   svntest.main.file_append(new_path, This is the file 'new'.\n)
   svntest.main.run_svn(None, 'add', new_path)
   svntest.main.run_svn(None, 'rm', mu_path)
+  svntest.main.run_svn(None, 'cp', lambda_path, lambda_copied_path)
 
-  ### We're not testing copied or moved paths
+  ### We're not testing moved paths
 
   expected_output = make_git_diff_header(mu_path, revision 1, 
  working copy, 
@@ -3386,7 +3390,8 @@ def diff_git_format_wc_wc(sbox):
 @@ -1 +1,2 @@\n,
  This is the file 'iota'.\n,
 +Changed 'iota'.\n,
-  ]
+  ] + make_git_diff_header(lambda_copied_path, revision 1,
+   working copy, copyfrom=lambda_path)
 
   svntest.actions.run_and_verify_svn(None, expected_output, [], 'diff', 
  '--git-diff', wc_dir)
@@ -3696,7 +3701,7 @@ test_list = [ None,
   diff_external_diffcmd,
   XFail(diff_url_against_local_mods),
   XFail(diff_preexisting_rev_against_local_add),
-  diff_git_format_wc_wc,
+  XFail(diff_git_format_wc_wc),
   diff_git_format_url_wc,
   diff_git_format_url_url,
   diff_prop_missing_context,




svn commit: r982527 - in /subversion/trunk/subversion: libsvn_diff/parse-diff.c tests/libsvn_diff/parse-diff-test.c

2010-08-05 Thread dannas
Author: dannas
Date: Thu Aug  5 09:56:19 2010
New Revision: 982527

URL: http://svn.apache.org/viewvc?rev=982527view=rev
Log:
Adjust the parser to match aginst lines beginning with 'rename {from/to}' 
instead of
'moved {from,to}'. Using 'moved' was plain wrong and was a mistake caused by 
sloppiness.

* subversion/libsvn_diff/parse-diff.c
  (svn_diff_parse_next_patch): Adjust the parser.

* subversion/tests/libsvn_diff/parse-diff-test.c
  (git_tree_and_text_unidiff): Adjust test data.

Modified:
subversion/trunk/subversion/libsvn_diff/parse-diff.c
subversion/trunk/subversion/tests/libsvn_diff/parse-diff-test.c

Modified: subversion/trunk/subversion/libsvn_diff/parse-diff.c
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_diff/parse-diff.c?rev=982527r1=982526r2=982527view=diff
==
--- subversion/trunk/subversion/libsvn_diff/parse-diff.c (original)
+++ subversion/trunk/subversion/libsvn_diff/parse-diff.c Thu Aug  5 09:56:19 
2010
@@ -1110,8 +1110,8 @@ svn_diff_parse_next_patch(svn_patch_t **
   {--- a/,state_git_diff_seen,git_minus},
   {--- a/,state_git_tree_seen,git_minus},
   {+++ b/,state_git_minus_seen,   git_plus},
-  {move from ,state_git_diff_seen,git_move_from},
-  {move to ,  state_move_from_seen,   git_move_to},
+  {rename from ,  state_git_diff_seen,git_move_from},
+  {rename to ,state_move_from_seen,   git_move_to},
   {copy from ,state_git_diff_seen,git_copy_from},
   {copy to ,  state_copy_from_seen,   git_copy_to},
   {new file , state_git_diff_seen,git_new_file},

Modified: subversion/trunk/subversion/tests/libsvn_diff/parse-diff-test.c
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/libsvn_diff/parse-diff-test.c?rev=982527r1=982526r2=982527view=diff
==
--- subversion/trunk/subversion/tests/libsvn_diff/parse-diff-test.c (original)
+++ subversion/trunk/subversion/tests/libsvn_diff/parse-diff-test.c Thu Aug  5 
09:56:19 2010
@@ -92,8 +92,8 @@ static const char *git_tree_and_text_uni
   Index: A/mu.moved   NL
   === NL
   git --diff a/A/mu b/A/mu.moved  NL
-  move from A/mu  NL
-  move to A/mu.moved  NL
+  rename from A/muNL
+  rename to A/mu.movedNL
   @@ -1 +1,2 @@   NL
This is the file 'mu'. NL
   +some more bytes to 'mu'NL




svn commit: r982534 - in /subversion/trunk/subversion: libsvn_diff/parse-diff.c tests/libsvn_diff/parse-diff-test.c

2010-08-05 Thread dannas
Author: dannas
Date: Thu Aug  5 10:24:23 2010
New Revision: 982534

URL: http://svn.apache.org/viewvc?rev=982534view=rev
Log:
Make the diff parser able to handle paths with spaces in the 
--git diff a/path b/path line. At the same time start
recording path information from other header fields. 

We only need the filenames from the --git diff line if we're
dealing with added or deleted empty files. In those cases, the 
paths should be identical.

The git_start() function probably needs some adjusting but it passes
the tests so I'm committing it. :).

* subversion/libsvn_diff/parse-diff.c
  (git_start): First check that we have a header line on the form 
--git diff a/.+ b/.+. Then grab the old and new filename if
they are the same.
  (git_minus,
   git_plus,
   git_move_from,
   git_move_to,
   git_copy_from,
   git_copy_to): Start grabbing filenames.

* subversion/tests/libsvn_diff/parse-diff-test.c
  (test_funcs): Remove XFail marker for test_git_diffs_with_spaces_diff.

Modified:
subversion/trunk/subversion/libsvn_diff/parse-diff.c
subversion/trunk/subversion/tests/libsvn_diff/parse-diff-test.c

Modified: subversion/trunk/subversion/libsvn_diff/parse-diff.c
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_diff/parse-diff.c?rev=982534r1=982533r2=982534view=diff
==
--- subversion/trunk/subversion/libsvn_diff/parse-diff.c (original)
+++ subversion/trunk/subversion/libsvn_diff/parse-diff.c Thu Aug  5 10:24:23 
2010
@@ -881,10 +881,12 @@ static svn_error_t *
 git_start(enum parse_state *new_state, const char *line, svn_patch_t *patch,
   apr_pool_t *result_pool, apr_pool_t *scratch_pool)
 {
-  const char *old_path;
-  const char *new_path;
-  char *end_old_path;
-  char *slash;
+  const char *old_path_start;
+  char *old_path_end;
+  const char *new_path_start;
+  const char *new_path_end;
+  char *new_path_marker;
+  const char *old_path_marker;
 
   /* ### Add handling of escaped paths
* http://www.kernel.org/pub/software/scm/git/docs/git-diff.html: 
@@ -897,59 +899,79 @@ git_start(enum parse_state *new_state, c
   /* Our line should look like this: 'git --diff a/path b/path'. 
* If we find any deviations from that format, we return with state reset
* to start.
-   *
-   * ### We can't handle paths with spaces!
*/
-  slash = strchr(line, '/');
+  old_path_marker = strstr(line,  a/);
 
-  if (! slash)
+  if (! old_path_marker)
 {
   *new_state = state_start;
   return SVN_NO_ERROR;
 }
 
-  old_path = slash + 1;
-
-  if (! *old_path)
+  if (! *(old_path_marker + 3))
 {
   *new_state = state_start;
   return SVN_NO_ERROR;
 }
 
-  end_old_path = strchr(old_path, ' ');
+  new_path_marker = strstr(old_path_marker,  b/);
 
-  if (end_old_path)
-*end_old_path = '\0';
-  else
+  if (! new_path_marker)
 {
   *new_state = state_start;
   return SVN_NO_ERROR;
 }
 
-  /* The new path begins after the first slash after the old path. */
-  slash = strchr(end_old_path + 1, '/');
-
-  if (! slash)
+  if (! *(new_path_marker + 3))
 {
   *new_state = state_start;
   return SVN_NO_ERROR;
 }
 
-  /* The path starts after the slash */
-  new_path = slash + 1;
+  /* By now, we know that we have a line on the form '--git diff a/.+ b/.+'
+   * We only need the filenames when we have deleted or added empty
+   * files. In those cases the old_path and new_path is identical on the
+   * '--git diff' line.  For all other cases we fetch the filenames from
+   * other header lines. */ 
+  old_path_start = line + strlen(--git diff a/);
+  new_path_end = line + strlen(line);
+  new_path_start = old_path_start;
+
+  while (TRUE)
+{
+  int len_old;
+  int len_new;
+
+  new_path_marker = strstr(new_path_start,  b/);
+
+  /* No new path marker, bail out. */
+  if (! new_path_marker)
+break;
+
+  old_path_end = new_path_marker;
+  new_path_start = new_path_marker + strlen( b/);
+
+  /* No path after the marker. */
+  if (! *new_path_start)
+break;
+
+  len_old = old_path_end - old_path_start;
+  len_new = new_path_end - new_path_start;
+
+  /* Are the paths before and after the  b/ marker the same? */
+  if (len_old == len_new
+   ! strncmp(old_path_start, new_path_start, len_old))
+{
+  *old_path_end = '\0';
+  SVN_ERR(grab_filename(patch-old_filename, old_path_start,
+result_pool, scratch_pool));
 
-  if (! *new_path)
-{
-  *new_state = state_start;
-  return SVN_NO_ERROR;
+  SVN_ERR(grab_filename(patch-new_filename, new_path_start,
+result_pool, scratch_pool));
+  break;
+}
 }
 
-  SVN_ERR(grab_filename(patch-old_filename, old_path,
-result_pool, scratch_pool));
-
-  SVN_ERR(grab_filename(patch-new_filename

svn commit: r982563 - /subversion/trunk/subversion/libsvn_diff/parse-diff.c

2010-08-05 Thread dannas
Author: dannas
Date: Thu Aug  5 12:10:52 2010
New Revision: 982563

URL: http://svn.apache.org/viewvc?rev=982563view=rev
Log:
Follow-up to r982534. Remove obsolute TODO's.

We're not going to do any checks to compare the paths found 
on the '--git diff a/old_path b/new_path' line with paths found 
in subsequent lines.  I haven't come up with a way to handle 
paths with spaces in the git diff line unless old_path and 
new_path are the same which is only guarenteed for added and
deleted empty paths.

* subversion/libsvn_diff/parse-diff.c
  (git_minus,
   git_plus,
   git_move_from,
   git_move_to,
   git_copy_from,
   git_copy_to,
   svn_diff_parse_next_patch): Remove obsolute TODO's.

Modified:
subversion/trunk/subversion/libsvn_diff/parse-diff.c

Modified: subversion/trunk/subversion/libsvn_diff/parse-diff.c
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_diff/parse-diff.c?rev=982563r1=982562r2=982563view=diff
==
--- subversion/trunk/subversion/libsvn_diff/parse-diff.c (original)
+++ subversion/trunk/subversion/libsvn_diff/parse-diff.c Thu Aug  5 12:10:52 
2010
@@ -985,8 +985,6 @@ static svn_error_t *
 git_minus(enum parse_state *new_state, const char *line, svn_patch_t *patch,
   apr_pool_t *result_pool, apr_pool_t *scratch_pool)
 {
-  /* ### Check that the path is consistent with the 'git --diff ' line. */
-
   /* If we can find a tab, it separates the filename from
* the rest of the line which we can discard. */
   char *tab = strchr(line, '\t');
@@ -1006,8 +1004,6 @@ static svn_error_t *
 git_plus(enum parse_state *new_state, const char *line, svn_patch_t *patch,
   apr_pool_t *result_pool, apr_pool_t *scratch_pool)
 {
-  /* ### Check that the path is consistent with the 'git --diff ' line. */
-
   /* If we can find a tab, it separates the filename from
* the rest of the line which we can discard. */
   char *tab = strchr(line, '\t');
@@ -1027,8 +1023,6 @@ static svn_error_t *
 git_move_from(enum parse_state *new_state, const char *line, svn_patch_t 
*patch,
   apr_pool_t *result_pool, apr_pool_t *scratch_pool)
 {
-  /* ### Check that the path is consistent with the 'git --diff ' line. */
-
   SVN_ERR(grab_filename(patch-old_filename, line + strlen(rename from ),
 result_pool, scratch_pool));
 
@@ -1041,8 +1035,6 @@ static svn_error_t *
 git_move_to(enum parse_state *new_state, const char *line, svn_patch_t *patch,
 apr_pool_t *result_pool, apr_pool_t *scratch_pool)
 {
-  /* ### Check that the path is consistent with the 'git --diff ' line. */
-
   SVN_ERR(grab_filename(patch-new_filename, line + strlen(rename to ),
 result_pool, scratch_pool));
 
@@ -1057,8 +1049,6 @@ static svn_error_t *
 git_copy_from(enum parse_state *new_state, const char *line, svn_patch_t 
*patch,
   apr_pool_t *result_pool, apr_pool_t *scratch_pool)
 {
-  /* ### Check that the path is consistent with the 'git --diff ' line. */
-
   SVN_ERR(grab_filename(patch-old_filename, line + strlen(copy from ),
 result_pool, scratch_pool));
 
@@ -1071,8 +1061,6 @@ static svn_error_t *
 git_copy_to(enum parse_state *new_state, const char *line, svn_patch_t *patch,
 apr_pool_t *result_pool, apr_pool_t *scratch_pool)
 {
-  /* ### Check that the path is consistent with the 'git --diff ' line. */
-
   SVN_ERR(grab_filename(patch-new_filename, line + strlen(copy to ),
 result_pool, scratch_pool));
 
@@ -1149,11 +1137,6 @@ svn_diff_parse_next_patch(svn_patch_t **
 
   enum parse_state state = state_start;
 
-  /* ### dannas: As I've understood the git diff format, the first line
-   * ### contains both paths and the paths in the headers that follow are only
-   * ### there to ensure that the path is valid. Not sure though, the
-   * ### research continues... */
-
   /* Our table consisting of:
* Expected Input Required state  Function to call */
   struct transition transitions[] = 




svn commit: r982582 - /subversion/trunk/subversion/tests/libsvn_diff/parse-diff-test.c

2010-08-05 Thread dannas
Author: dannas
Date: Thu Aug  5 12:41:51 2010
New Revision: 982582

URL: http://svn.apache.org/viewvc?rev=982582view=rev
Log:
Adjust a C-unit test for parsing git diffs to have  b/ as part of 
the paths.

The diff-parser searches for  b/ to find the start of old_path.

* subversion/tests/libsvn_diff/parse-diff-tests.c
  (git_diff_with_spaces_diff,
   test_git_diffs_with_spaces_diff): See above.

Modified:
subversion/trunk/subversion/tests/libsvn_diff/parse-diff-test.c

Modified: subversion/trunk/subversion/tests/libsvn_diff/parse-diff-test.c
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/libsvn_diff/parse-diff-test.c?rev=982582r1=982581r2=982582view=diff
==
--- subversion/trunk/subversion/tests/libsvn_diff/parse-diff-test.c (original)
+++ subversion/trunk/subversion/tests/libsvn_diff/parse-diff-test.c Thu Aug  5 
12:41:51 2010
@@ -220,9 +220,9 @@ static const char *bad_git_diff_header =
   new file mode 100644NL
   git --diff a/path one 1 b/path one 1NL
   new file mode 100644NL
-  git --diff a/dir/b/path b/dir/b/pathNL
+  git --diff a/dir/ b/path b/dir/ b/path  NL
   new file mode 100644NL
-  git --diff a/b/path 1 b/b/path 1NL
+  git --diff a/ b/path 1 b/ b/path 1  NL
   new file mode 100644NL;
 
 
@@ -834,8 +834,9 @@ test_git_diffs_with_spaces_diff(apr_pool
 FALSE, /* ignore_whitespace */ 
 pool, pool));
   SVN_TEST_ASSERT(patch);
-  SVN_TEST_ASSERT(! strcmp(patch-old_filename, dir/b/path));
-  SVN_TEST_ASSERT(! strcmp(patch-new_filename, dir/b/path));
+  SVN_DBG((%s\n, patch-old_filename));
+  SVN_TEST_ASSERT(! strcmp(patch-old_filename, dir/ b/path));
+  SVN_TEST_ASSERT(! strcmp(patch-new_filename, dir/ b/path));
   SVN_TEST_ASSERT(patch-operation == svn_diff_op_added);
   SVN_TEST_ASSERT(patch-hunks-nelts == 0);
 
@@ -844,8 +845,8 @@ test_git_diffs_with_spaces_diff(apr_pool
 FALSE, /* ignore_whitespace */ 
 pool, pool));
   SVN_TEST_ASSERT(patch);
-  SVN_TEST_ASSERT(! strcmp(patch-old_filename, b/path 1));
-  SVN_TEST_ASSERT(! strcmp(patch-new_filename, b/path 1));
+  SVN_TEST_ASSERT(! strcmp(patch-old_filename,  b/path 1));
+  SVN_TEST_ASSERT(! strcmp(patch-new_filename,  b/path 1));
   SVN_TEST_ASSERT(patch-operation == svn_diff_op_added);
   SVN_TEST_ASSERT(patch-hunks-nelts == 0);
 




svn commit: r982706 - /subversion/trunk/subversion/tests/libsvn_diff/parse-diff-test.c

2010-08-05 Thread dannas
Author: dannas
Date: Thu Aug  5 17:44:01 2010
New Revision: 982706

URL: http://svn.apache.org/viewvc?rev=982706view=rev
Log:
* subversion/tests/libsvn_diff/parse-diff-tests.c
  (test_git_diffs_with_spaces_diff): Follow-up to r982582. Remove a
dangling debug statement.

Found by: pburba

Modified:
subversion/trunk/subversion/tests/libsvn_diff/parse-diff-test.c

Modified: subversion/trunk/subversion/tests/libsvn_diff/parse-diff-test.c
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/libsvn_diff/parse-diff-test.c?rev=982706r1=982705r2=982706view=diff
==
--- subversion/trunk/subversion/tests/libsvn_diff/parse-diff-test.c (original)
+++ subversion/trunk/subversion/tests/libsvn_diff/parse-diff-test.c Thu Aug  5 
17:44:01 2010
@@ -834,7 +834,6 @@ test_git_diffs_with_spaces_diff(apr_pool
 FALSE, /* ignore_whitespace */ 
 pool, pool));
   SVN_TEST_ASSERT(patch);
-  SVN_DBG((%s\n, patch-old_filename));
   SVN_TEST_ASSERT(! strcmp(patch-old_filename, dir/ b/path));
   SVN_TEST_ASSERT(! strcmp(patch-new_filename, dir/ b/path));
   SVN_TEST_ASSERT(patch-operation == svn_diff_op_added);




svn commit: r982717 - /subversion/trunk/subversion/tests/libsvn_diff/parse-diff-test.c

2010-08-05 Thread dannas
Author: dannas
Date: Thu Aug  5 18:07:26 2010
New Revision: 982717

URL: http://svn.apache.org/viewvc?rev=982717view=rev
Log:
* subversion/tests/libsvn_diff/parse-diff-tests.c
  (git_tree_and_text_unidiff): Add '---' and '+++' lines to the input
patch. For patches with text changes, we should always have those 
headers.

Modified:
subversion/trunk/subversion/tests/libsvn_diff/parse-diff-test.c

Modified: subversion/trunk/subversion/tests/libsvn_diff/parse-diff-test.c
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/libsvn_diff/parse-diff-test.c?rev=982717r1=982716r2=982717view=diff
==
--- subversion/trunk/subversion/tests/libsvn_diff/parse-diff-test.c (original)
+++ subversion/trunk/subversion/tests/libsvn_diff/parse-diff-test.c Thu Aug  5 
18:07:26 2010
@@ -86,6 +86,8 @@ static const char *git_tree_and_text_uni
   git --diff a/iota b/iota.copied NL
   copy from iota  NL
   copy to iota.copied NL
+  --- a/iota\t(revision 2)NL
+  +++ b/iota.copied\t(working copy)   NL
   @@ -1 +1,2 @@   NL
This is the file 'iota'.   NL
   +some more bytes to 'iota'  NL
@@ -94,6 +96,8 @@ static const char *git_tree_and_text_uni
   git --diff a/A/mu b/A/mu.moved  NL
   rename from A/muNL
   rename to A/mu.movedNL
+  --- a/A/mu\t(revision 2)NL
+  +++ b/A/mu.moved\t(working copy)NL
   @@ -1 +1,2 @@   NL
This is the file 'mu'. NL
   +some more bytes to 'mu'NL




svn commit: r982726 - /subversion/trunk/subversion/tests/libsvn_diff/parse-diff-test.c

2010-08-05 Thread dannas
Author: dannas
Date: Thu Aug  5 18:33:51 2010
New Revision: 982726

URL: http://svn.apache.org/viewvc?rev=982726view=rev
Log:
Adjust a C-unit test for parsing git diffs to include added and deleted 
paths.

Currently the parser does not handle paths without a leading a/ or b/, i.e.
/dev/null that is used for added and deleted paths does not work.

* subversion/libsvn_diff/parse-diff-test.c
  (git_tree_and_text_unidiff): Add an added and a deleted file to the patch
data.
  (test_parse_git_tree_and_text_diff): Add checks for the new files.
  (test_funcs): Mark test_parse_git_tree_and_text_diff() as XFailing.

Modified:
subversion/trunk/subversion/tests/libsvn_diff/parse-diff-test.c

Modified: subversion/trunk/subversion/tests/libsvn_diff/parse-diff-test.c
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/libsvn_diff/parse-diff-test.c?rev=982726r1=982725r2=982726view=diff
==
--- subversion/trunk/subversion/tests/libsvn_diff/parse-diff-test.c (original)
+++ subversion/trunk/subversion/tests/libsvn_diff/parse-diff-test.c Thu Aug  5 
18:33:51 2010
@@ -101,6 +101,22 @@ static const char *git_tree_and_text_uni
   @@ -1 +1,2 @@   NL
This is the file 'mu'. NL
   +some more bytes to 'mu'NL
+  Index: new  NL
+  === NL
+  git --diff a/new b/new  NL
+  new file mode 100644NL
+  --- /dev/null\t(revision 0) NL
+  +++ b/new\t(working copy)   NL
+  @@ -0,0 +1 @@   NL
+  +This is the file 'new'.NL
+  Index: A/B/lambda   NL
+  === NL
+  git --diff a/A/B/lambda b/A/B/lambdaNL
+  deleted file mode 100644NL
+  --- a/A/B/lambda\t(revision 2)  NL
+  +++ /dev/null\t(working copy)   NL
+  @@ -1 +0,0 @@   NL
+  -This is the file 'labmda'. NL
   NL;
 
   /* Only the last git diff header is valid. The other ones either misses a
@@ -504,6 +520,45 @@ test_parse_git_tree_and_text_diff(apr_po
 some more bytes to 'mu' NL,
 pool));
 
+  SVN_ERR(svn_diff_parse_next_patch(patch, patch_file, 
+FALSE, /* reverse */
+FALSE, /* ignore_whitespace */ 
+pool, pool));
+  SVN_TEST_ASSERT(patch);
+  SVN_TEST_ASSERT(! strcmp(patch-old_filename, /dev/null));
+  SVN_TEST_ASSERT(! strcmp(patch-new_filename, new));
+  SVN_TEST_ASSERT(patch-operation == svn_diff_op_added);
+  SVN_TEST_ASSERT(patch-hunks-nelts == 1);
+  
+  hunk = APR_ARRAY_IDX(patch-hunks, 0, svn_hunk_t *);
+
+  SVN_ERR(check_content(hunk, TRUE,
+,
+pool));
+
+  SVN_ERR(check_content(hunk, FALSE,
+This is the file 'new'. NL,
+pool));
+
+  SVN_ERR(svn_diff_parse_next_patch(patch, patch_file, 
+FALSE, /* reverse */
+FALSE, /* ignore_whitespace */ 
+pool, pool));
+  SVN_TEST_ASSERT(patch);
+  SVN_TEST_ASSERT(! strcmp(patch-old_filename, A/B/lambda));
+  SVN_TEST_ASSERT(! strcmp(patch-new_filename, /dev/null));
+  SVN_TEST_ASSERT(patch-operation == svn_diff_op_deleted);
+  SVN_TEST_ASSERT(patch-hunks-nelts == 1);
+  
+  hunk = APR_ARRAY_IDX(patch-hunks, 0, svn_hunk_t *);
+
+  SVN_ERR(check_content(hunk, TRUE,
+This is the file 'lambda'. NL,
+pool));
+
+  SVN_ERR(check_content(hunk, FALSE,
+,
+pool));
   return SVN_NO_ERROR;
 }
 
@@ -864,7 +919,7 @@ struct svn_test_descriptor_t test_funcs[
test unidiff parsing),
 SVN_TEST_PASS2(test_parse_git_diff,
 test git unidiff parsing),
-SVN_TEST_PASS2(test_parse_git_tree_and_text_diff,
+SVN_TEST_XFAIL2(test_parse_git_tree_and_text_diff,
 test git unidiff parsing of tree and text changes),
 SVN_TEST_XFAIL2(test_bad_git_diff_headers,
 test badly formatted git diff headers),




svn commit: r982259 - /subversion/trunk/subversion/tests/cmdline/diff_tests.py

2010-08-04 Thread dannas
Author: dannas
Date: Wed Aug  4 14:11:50 2010
New Revision: 982259

URL: http://svn.apache.org/viewvc?rev=982259view=rev
Log:
Add XFailing diff test for creating git diffs with added and deleted
empty files. The git diff format only displays '---' and '+++' lines
if we have text changes. Currently it works for added paths but not
deleted ones.

* subversion/tests/cmdline/diff_tests.py
  (make_git_diff_header): Add new parameter 'text_changes' defaulting to 
True.  Only print '---' and '+++' lines if we have text changes. 
  (diff_git_empty_files): New.
  (test_list): Add diff_git_empty_files().

Modified:
subversion/trunk/subversion/tests/cmdline/diff_tests.py

Modified: subversion/trunk/subversion/tests/cmdline/diff_tests.py
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/diff_tests.py?rev=982259r1=982258r2=982259view=diff
==
--- subversion/trunk/subversion/tests/cmdline/diff_tests.py (original)
+++ subversion/trunk/subversion/tests/cmdline/diff_tests.py Wed Aug  4 14:11:50 
2010
@@ -53,8 +53,8 @@ def make_diff_header(path, old_tag, new_
 ]
 
 def make_git_diff_header(path, old_tag, new_tag, add=False, src_label=None,
- dst_label=None, delete=False, cp=False, mv=False, 
- copyfrom=None):
+ dst_label=None, delete=False, text_changes=True,
+ cp=False, mv=False, copyfrom=None):
Generate the expected 'git diff' header for file PATH, with its old
   and new 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
@@ -78,31 +78,42 @@ def make_git_diff_header(path, old_tag, 
 dst_label = ''
 
   if add:
-return [
+output = [
   Index:  + path_as_shown + \n,
   ===\n,
   diff --git a/ + path_as_shown +  b/ + path_as_shown + \n,
   new file mode 10644\n,
-  --- /dev/null\t( + old_tag + )\n,
-  +++ b/ + path_as_shown + dst_label + \t( + new_tag + )\n,
 ]
+if text_changes:
+  output.extend([
+--- /dev/null\t( + old_tag + )\n,
++++ b/ + path_as_shown + dst_label + \t( + new_tag + )\n
+  ])
   elif delete:
-return [
+output = [
   Index:  + path_as_shown + \n,
   ===\n,
   diff --git a/ + path_as_shown +  b/ + path_as_shown + \n,
   deleted file mode 10644\n,
-  --- a/ + path_as_shown + src_label + \t( + old_tag + )\n,
-  +++ /dev/null\t( + new_tag + )\n,
 ]
+if text_changes:
+  output.extend([
+--- a/ + path_as_shown + src_label + \t( + old_tag + )\n,
++++ /dev/null\t( + new_tag + )\n
+  ])
   elif cp:
-return [
+output = [
   Index:  + path_as_shown + \n,
   ===\n,
   diff --git a/ + copyfrom_as_shown +  b/ + path_as_shown + \n,
   copy from  + copyfrom_as_shown + \n,
   copy to  + path_as_shown + \n,
 ]
+if text_changes:
+  output.extend([
+--- a/ + copyfrom_as_shown + src_label + \t( + old_tag + )\n,
++++ b/ + path_as_shown + \t( + new_tag + )\n
+  ])
   elif mv:
 return [
   Index:  + path_as_shown + \n,
@@ -111,14 +122,20 @@ def make_git_diff_header(path, old_tag, 
   rename from  + copyfrom_as_shown + \n,
   rename to  + path_as_shown + \n,
 ]
+if text_changes:
+  output.extend([
+--- a/ + copyfrom_as_shown + src_label + \t( + old_tag + )\n,
++++ b/ + path_as_shown + \t( + new_tag + )\n
+  ])
   else:
-return [
+output = [
   Index:  + path_as_shown + \n,
   ===\n,
   diff --git a/ + path_as_shown +  b/ + path_as_shown + \n,
   --- a/ + path_as_shown + src_label + \t( + old_tag + )\n,
   +++ b/ + path_as_shown + dst_label + \t( + new_tag + )\n,
 ]
+  return output
 
 
 ##
@@ -3499,6 +3516,40 @@ def diff_prop_multiple_hunks(sbox):
 
   svntest.actions.run_and_verify_svn(None, expected_output, [],
  'diff', iota_path)
+def diff_git_empty_files(sbox):
+  create a diff in git format for empty files
+  sbox.build()
+  wc_dir = sbox.wc_dir
+  iota_path = os.path.join(wc_dir, 'iota')
+  new_path = os.path.join(wc_dir, 'new')
+  svntest.main.file_write(iota_path, )
+
+  # Now commit the local mod, creating rev 2.
+  expected_output = svntest.wc.State(wc_dir, {
+'iota' : Item(verb='Sending'),
+})
+
+  expected_status = svntest.actions.get_virginal_state(wc_dir, 1)
+  expected_status.add({
+'iota' : Item(status='  ', wc_rev=2),
+})
+
+  svntest.actions.run_and_verify_commit(wc_dir, expected_output

svn commit: r982295 - /subversion/trunk/subversion/tests/libsvn_diff/parse-diff-test.c

2010-08-04 Thread dannas
Author: dannas
Date: Wed Aug  4 15:19:40 2010
New Revision: 982295

URL: http://svn.apache.org/viewvc?rev=982295view=rev
Log:
Add XFailing test for parsing git diffs with spaces in the paths.

Note that we only need to parse the '--git diff a/path b/path' line
for added and deleted empty files. In all other cases we have other
header lines to obtain the information from.

* subversion/tests/libsvn_diff/parse-diff-test.c
  (path_with_spaces_unidiff): New unidiff test data.
  (test_git_diffs_with_spaces_diff): New.
  (test_funcs): Add test_git_diffs_with_spaces_diff() as XFailing.

Modified:
subversion/trunk/subversion/tests/libsvn_diff/parse-diff-test.c

Modified: subversion/trunk/subversion/tests/libsvn_diff/parse-diff-test.c
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/libsvn_diff/parse-diff-test.c?rev=982295r1=982294r2=982295view=diff
==
--- subversion/trunk/subversion/tests/libsvn_diff/parse-diff-test.c (original)
+++ subversion/trunk/subversion/tests/libsvn_diff/parse-diff-test.c Wed Aug  4 
15:19:40 2010
@@ -214,6 +214,17 @@ static const char *bad_git_diff_header =
   +## -1,2 +1,4 ##NL
   NL;
 
+  /* A unidiff containing paths with spaces. */
+  static const char *path_with_spaces_unidiff =
+  git --diff a/path 1 b/path 1NL
+  new file mode 100644NL
+  git --diff a/path one 1 b/path one 1NL
+  new file mode 100644NL
+  git --diff a/dir/b/path b/dir/b/pathNL
+  new file mode 100644NL
+  git --diff a/b/path 1 b/b/path 1NL
+  new file mode 100644NL;
+
 
 /* Create a PATCH_FILE with name FNAME containing the contents of DIFF. */
 static svn_error_t *
@@ -788,6 +799,58 @@ test_parse_diff_symbols_in_prop_unidiff(
   return SVN_NO_ERROR;
 }
 
+static svn_error_t *
+test_git_diffs_with_spaces_diff(apr_pool_t *pool)
+{
+  apr_file_t *patch_file;
+  svn_patch_t *patch;
+  const char *fname = test_git_diffs_with_spaces_diff.patch;
+
+  SVN_ERR(create_patch_file(patch_file, fname, path_with_spaces_unidiff,
+pool));
+
+  SVN_ERR(svn_diff_parse_next_patch(patch, patch_file, 
+FALSE, /* reverse */
+FALSE, /* ignore_whitespace */ 
+pool, pool));
+  SVN_TEST_ASSERT(patch);
+  SVN_TEST_ASSERT(! strcmp(patch-old_filename, path 1));
+  SVN_TEST_ASSERT(! strcmp(patch-new_filename, path 1));
+  SVN_TEST_ASSERT(patch-operation == svn_diff_op_added);
+  SVN_TEST_ASSERT(patch-hunks-nelts == 0);
+  
+  SVN_ERR(svn_diff_parse_next_patch(patch, patch_file, 
+FALSE, /* reverse */
+FALSE, /* ignore_whitespace */ 
+pool, pool));
+  SVN_TEST_ASSERT(patch);
+  SVN_TEST_ASSERT(! strcmp(patch-old_filename, path one 1));
+  SVN_TEST_ASSERT(! strcmp(patch-new_filename, path one 1));
+  SVN_TEST_ASSERT(patch-operation == svn_diff_op_added);
+  SVN_TEST_ASSERT(patch-hunks-nelts == 0);
+
+  SVN_ERR(svn_diff_parse_next_patch(patch, patch_file, 
+FALSE, /* reverse */
+FALSE, /* ignore_whitespace */ 
+pool, pool));
+  SVN_TEST_ASSERT(patch);
+  SVN_TEST_ASSERT(! strcmp(patch-old_filename, dir/b/path));
+  SVN_TEST_ASSERT(! strcmp(patch-new_filename, dir/b/path));
+  SVN_TEST_ASSERT(patch-operation == svn_diff_op_added);
+  SVN_TEST_ASSERT(patch-hunks-nelts == 0);
+
+  SVN_ERR(svn_diff_parse_next_patch(patch, patch_file, 
+FALSE, /* reverse */
+FALSE, /* ignore_whitespace */ 
+pool, pool));
+  SVN_TEST_ASSERT(patch);
+  SVN_TEST_ASSERT(! strcmp(patch-old_filename, b/path 1));
+  SVN_TEST_ASSERT(! strcmp(patch-new_filename, b/path 1));
+  SVN_TEST_ASSERT(patch-operation == svn_diff_op_added);
+  SVN_TEST_ASSERT(patch-hunks-nelts == 0);
+
+  return SVN_NO_ERROR;
+}
 /* == 
*/
 
 struct svn_test_descriptor_t test_funcs[] =
@@ -807,5 +870,7 @@ struct svn_test_descriptor_t test_funcs[
test property and text unidiff parsing),
 SVN_TEST_PASS2(test_parse_diff_symbols_in_prop_unidiff,
test property diffs with odd symbols),
+SVN_TEST_XFAIL2(test_git_diffs_with_spaces_diff,
+   test git diffs with spaces in paths

svn commit: r981826 - /subversion/trunk/subversion/libsvn_client/patch.c

2010-08-03 Thread dannas
Author: dannas
Date: Tue Aug  3 11:36:08 2010
New Revision: 981826

URL: http://svn.apache.org/viewvc?rev=981826view=rev
Log:
Make 'svn patch' able to handle added files with properties.

Added dirs with properties does not work yet, though.

* subversion/libsvn_client/patch.c
  (init_prop_target): Allow the target to be non-existing.

Modified:
subversion/trunk/subversion/libsvn_client/patch.c

Modified: subversion/trunk/subversion/libsvn_client/patch.c
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/patch.c?rev=981826r1=981825r2=981826view=diff
==
--- subversion/trunk/subversion/libsvn_client/patch.c (original)
+++ subversion/trunk/subversion/libsvn_client/patch.c Tue Aug  3 11:36:08 2010
@@ -477,7 +477,7 @@ init_prop_target(prop_patch_target_t **p
   target_content_info_t *content_info; 
   const svn_string_t *value;
   const char *patched_path;
-
+  svn_error_t *err;
 
   content_info = apr_pcalloc(result_pool, sizeof(*content_info));
 
@@ -496,8 +496,18 @@ init_prop_target(prop_patch_target_t **p
   new_prop_target-operation = operation;
   new_prop_target-content_info = content_info;
 
-  SVN_ERR(svn_wc_prop_get2(value, wc_ctx, local_abspath, prop_name, 
-   result_pool, scratch_pool));
+  err = svn_wc_prop_get2(value, wc_ctx, local_abspath, prop_name, 
+   result_pool, scratch_pool);
+  if (err)
+{
+  if (err-apr_err == SVN_ERR_WC_PATH_NOT_FOUND)
+{
+  svn_error_clear(err);
+  value = NULL;
+}
+  else
+return svn_error_return(err);
+}
 
   if (value)
 {




svn commit: r981878 - /subversion/trunk/subversion/tests/cmdline/patch_tests.py

2010-08-03 Thread dannas
Author: dannas
Date: Tue Aug  3 13:48:54 2010
New Revision: 981878

URL: http://svn.apache.org/viewvc?rev=981878view=rev
Log:
Add testcases involving 'svn patch' trying to add files to dirs that are 
locally deleted. 

Currently we allow the deleted dirs to be replaced. But if the deleted dir
is the direct parent we get:

  Can't add 'path' to parent dir scheduled for deletion.

The idea is that all targets that have parent dirs scheduled for deletion 
should be skipped.

* subversion/tests/cmdline/patch_tests.py
  (patch_add_new_dir): Add testcases for adding files to parent dirs
that are locally deleted.
  (test_list): Mark patch_add_new_dir() as XFail.

Modified:
subversion/trunk/subversion/tests/cmdline/patch_tests.py

Modified: subversion/trunk/subversion/tests/cmdline/patch_tests.py
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/patch_tests.py?rev=981878r1=981877r2=981878view=diff
==
--- subversion/trunk/subversion/tests/cmdline/patch_tests.py (original)
+++ subversion/trunk/subversion/tests/cmdline/patch_tests.py Tue Aug  3 
13:48:54 2010
@@ -935,9 +935,10 @@ def patch_add_new_dir(sbox):
   patch_file_path = make_patch_path(sbox)
 
   # The first diff is adding 'new' with two missing dirs. The second is
-  # adding 'new' with one missing dir to a 'A' that is locally deleted
-  # (should be skipped). The third is adding 'new' with a directory that
-  # is unversioned (should be skipped as well).
+  # adding 'new' with one missing dir to a 'A/B/E' that is locally deleted
+  # (should be skipped). The third is adding 'new' to 'A/C' that is locally
+  # deleted (should be skipped too). The fourth is adding 'new' with a
+  # directory that is unversioned (should be skipped as well).
   unidiff_patch = [
 Index: new\n,
 ===\n,
@@ -947,8 +948,14 @@ def patch_add_new_dir(sbox):
 +new\n,
 Index: new\n,
 ===\n,
---- A/C/Y/new\t(revision 0)\n,
-+++ A/C/Y/new\t(revision 0)\n,
+--- A/B/E/Y/new\t(revision 0)\n,
++++ A/B/E/Y/new\t(revision 0)\n,
+@@ -0,0 +1 @@\n,
++new\n,
+Index: new\n,
+===\n,
+--- A/C/new\t(revision 0)\n,
++++ A/C/new\t(revision 0)\n,
 @@ -0,0 +1 @@\n,
 +new\n,
 Index: new\n,
@@ -960,22 +967,25 @@ def patch_add_new_dir(sbox):
   ]
 
   C_path = os.path.join(wc_dir, 'A', 'C')
+  E_path = os.path.join(wc_dir, 'A', 'B', 'E')
   svntest.actions.run_and_verify_svn(Deleting C failed, None, [],
  'rm', C_path)
+  svntest.actions.run_and_verify_svn(Deleting E failed, None, [],
+ 'rm', E_path)
   svntest.main.file_write(patch_file_path, ''.join(unidiff_patch))
 
-  A_C_Y_new_path = os.path.join(wc_dir, 'A', 'C', 'Y', 'new')
+  A_B_E_Y_new_path = os.path.join(wc_dir, 'A', 'B', 'E', 'Y', 'new')
+  A_C_new_path = os.path.join(wc_dir, 'A', 'C', 'new')
   A_Z_new_path = os.path.join(wc_dir, 'A', 'Z', 'new')
   expected_output = [
 'A %s\n' % os.path.join(wc_dir, 'X'),
 'A %s\n' % os.path.join(wc_dir, 'X', 'Y'),
 'A %s\n' % os.path.join(wc_dir, 'X', 'Y', 'new'),
-'A %s\n' % os.path.join(wc_dir, 'A', 'C'),
-'A %s\n' % os.path.join(wc_dir, 'A', 'C', 'Y'),
-'A %s\n' % os.path.join(wc_dir, 'A', 'C', 'Y', 'new'),
 'Skipped missing target: \'%s\'\n' % A_Z_new_path,
+'Skipped missing target: \'%s\'\n' % A_B_E_Y_new_path,
+'Skipped missing target: \'%s\'\n' % A_C_new_path,
 'Summary of conflicts:\n',
-'  Skipped paths: 1\n',
+'  Skipped paths: 3\n',
   ]
 
   # Create the unversioned obstructing directory
@@ -984,8 +994,6 @@ def patch_add_new_dir(sbox):
   expected_disk = svntest.main.greek_state.copy()
   expected_disk.add({
'X/Y/new'   : Item(contents='new\n'),
-   'A/C/Y/new' : Item(contents='new\n'),
-   'A/Z'   : Item(),
   })
 
   expected_status = svntest.actions.get_virginal_state(wc_dir, 1)
@@ -993,12 +1001,11 @@ def patch_add_new_dir(sbox):
'X' : Item(status='A ', wc_rev=0),
'X/Y'   : Item(status='A ', wc_rev=0),
'X/Y/new'   : Item(status='A ', wc_rev=0),
-   'A/C'   : Item(status='R ', wc_rev=1),
-   'A/C/Y' : Item(status='A ', wc_rev=0),
-   'A/C/Y/new' : Item(status='A ', wc_rev=0),
   })
 
-  expected_skip = wc.State('', {A_Z_new_path : Item() })
+  expected_skip = wc.State('', {A_Z_new_path : Item(),
+A_B_E_Y_new_path : Item(),
+A_C_new_path : Item()})
 
   svntest.actions.run_and_verify_patch(wc_dir,
os.path.abspath(patch_file_path),
@@ -2965,7 +2972,7

svn commit: r981418 - /subversion/trunk/subversion/libsvn_client/patch.c

2010-08-02 Thread dannas
Author: dannas
Date: Mon Aug  2 08:44:52 2010
New Revision: 981418

URL: http://svn.apache.org/viewvc?rev=981418view=rev
Log:
Make 'svn patch' able to apply properties on the wc root dir.

* subversion/libsvn_client/patch.c
  (patch_target_t): Constify field 'local_abspath'.
  (resolve_target_path): Allow 'path_from_patchfile' to be  when we're
only dealing with properties for that path.

Modified:
subversion/trunk/subversion/libsvn_client/patch.c

Modified: subversion/trunk/subversion/libsvn_client/patch.c
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/patch.c?rev=981418r1=981417r2=981418view=diff
==
--- subversion/trunk/subversion/libsvn_client/patch.c (original)
+++ subversion/trunk/subversion/libsvn_client/patch.c Mon Aug  2 08:44:52 2010
@@ -145,7 +145,7 @@ typedef struct patch_target_t {
   /* The absolute path of the target on the filesystem.
* Any symlinks the path from the patch file may contain are resolved.
* Is not always known, so it may be NULL. */
-  char *local_abspath;
+  const char *local_abspath;
 
   /* The target file, read-only, seekable. This is NULL in case the target
* file did not exist prior to patch application. */
@@ -337,12 +337,17 @@ resolve_target_path(patch_target_t *targ
 apr_pool_t *scratch_pool)
 {
   const char *stripped_path;
+  char *full_path;
   svn_wc_status3_t *status;
   svn_error_t *err;
 
   target-canon_path_from_patchfile = svn_dirent_internal_style(
 path_from_patchfile, result_pool);
-  if (target-canon_path_from_patchfile[0] == '\0')
+
+  /* We allow properties to be set on the wc root dir.
+   * ### Do we need to check for empty paths here, shouldn't the parser
+   * ### guarentee that the paths returned are non-empty? */
+  if (! prop_changes_only  target-canon_path_from_patchfile[0] == '\0')
 {
   /* An empty patch target path? What gives? Skip this. */
   target-skipped = TRUE;
@@ -362,7 +367,6 @@ resolve_target_path(patch_target_t *targ
   target-local_relpath = svn_dirent_is_child(local_abspath, stripped_path,
   result_pool);
 
-  /* ### We need to allow setting props on the wc root dir */
   if (! target-local_relpath)
 {
   /* The target path is either outside of the working copy
@@ -380,7 +384,7 @@ resolve_target_path(patch_target_t *targ
 
   /* Make sure the path is secure to use. We want the target to be inside
* of the working copy and not be fooled by symlinks it might contain. */
-  if (! svn_dirent_is_under_root(target-local_abspath, local_abspath,
+  if (! svn_dirent_is_under_root(full_path, local_abspath,
  target-local_relpath, result_pool))
 {
   /* The target path is outside of the working copy. Skip it. */
@@ -389,6 +393,14 @@ resolve_target_path(patch_target_t *targ
   return SVN_NO_ERROR;
 }
 
+  target-local_abspath = full_path;
+
+  /* ### Joining a path with  in svn_dirent_is_under_root() creates a
+   * ### non-canonicalized path. Until that behaviour is fixed, we do an
+   * ### extra canonicalization step. */
+  target-local_abspath = svn_dirent_canonicalize( target-local_abspath,
+   result_pool);
+
   /* Skip things we should not be messing with. */
   err = svn_wc_status3(status, wc_ctx, target-local_abspath,
result_pool, scratch_pool);




svn commit: r981426 - /subversion/trunk/subversion/include/svn_dirent_uri.h

2010-08-02 Thread dannas
Author: dannas
Date: Mon Aug  2 09:14:44 2010
New Revision: 981426

URL: http://svn.apache.org/viewvc?rev=981426view=rev
Log:
* subversion/include/svn_dirent_uri.h
  (svn_dirent_is_under_root): Add todo about 'full_path' not beeing 
canonicalized when joining 'base_path' with .

Modified:
subversion/trunk/subversion/include/svn_dirent_uri.h

Modified: subversion/trunk/subversion/include/svn_dirent_uri.h
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/include/svn_dirent_uri.h?rev=981426r1=981425r2=981426view=diff
==
--- subversion/trunk/subversion/include/svn_dirent_uri.h (original)
+++ subversion/trunk/subversion/include/svn_dirent_uri.h Mon Aug  2 09:14:44 
2010
@@ -773,6 +773,9 @@ svn_uri_condense_targets(const char **pc
  * Note: Use of this function is strongly encouraged. Do not roll your own.
  * (http://cve.mitre.org/cgi-bin/cvename.cgi?name=2007-3846)
  *
+ * ### @todo If path is , then full_path will have a trailing '/' and thus
+ * not be canonicalized.
+ *
  * @since New in 1.7.
  */
 svn_boolean_t




svn commit: r981483 - /subversion/trunk/subversion/libsvn_diff/diff_memory.c

2010-08-02 Thread dannas
Author: dannas
Date: Mon Aug  2 12:27:07 2010
New Revision: 981483

URL: http://svn.apache.org/viewvc?rev=981483view=rev
Log:
Follow-up to r981462. Adjust the logic to handle the case when we're
dealing with the first hunk.

* subversion/libsvn_diff/diff_memory.c
  (output_unified_diff_modified): Don't adjust the start of the original
lines if we're dealing with the first hunk.

Modified:
subversion/trunk/subversion/libsvn_diff/diff_memory.c

Modified: subversion/trunk/subversion/libsvn_diff/diff_memory.c
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_diff/diff_memory.c?rev=981483r1=981482r2=981483view=diff
==
--- subversion/trunk/subversion/libsvn_diff/diff_memory.c (original)
+++ subversion/trunk/subversion/libsvn_diff/diff_memory.c Mon Aug  2 12:27:07 
2010
@@ -519,9 +519,12 @@ output_unified_diff_modified(void *baton
   targ_orig = (targ_orig  0) ? 0 : targ_orig;
   targ_mod = modified_start;
 
+  /* If the changed ranges are far enough apart (no overlapping or
+   * connecting context), flush the current hunk. */
   if (btn-next_token + SVN_DIFF__UNIFIED_CONTEXT_SIZE  targ_orig)
 SVN_ERR(output_unified_flush_hunk(btn, btn-hunk_delimiter));
-  else
+  /* Adjust offset if it's not the first hunk. */
+  else if (btn-hunk_length[0] != 0)
 targ_orig = btn-next_token;
 
   if (btn-hunk_length[0] == 0




svn commit: r981520 - in /subversion/trunk/subversion: libsvn_client/patch.c tests/cmdline/patch_tests.py

2010-08-02 Thread dannas
Author: dannas
Date: Mon Aug  2 14:24:04 2010
New Revision: 981520

URL: http://svn.apache.org/viewvc?rev=981520view=rev
Log:
Don't notify on the hunk level for added and deleted props.

This conforms with the way we handle text hunks.

* subversion/libsvn_client/patch.c
  (send_patch_notification): See above.

* subversion/tests/cmdline/patch_tests.py
  (test_list): Remove XFail marker for patch_with_properties.

Modified:
subversion/trunk/subversion/libsvn_client/patch.c
subversion/trunk/subversion/tests/cmdline/patch_tests.py

Modified: subversion/trunk/subversion/libsvn_client/patch.c
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/patch.c?rev=981520r1=981519r2=981520view=diff
==
--- subversion/trunk/subversion/libsvn_client/patch.c (original)
+++ subversion/trunk/subversion/libsvn_client/patch.c Mon Aug  2 14:24:04 2010
@@ -1567,8 +1567,12 @@ send_patch_notification(const patch_targ
 
   hi = APR_ARRAY_IDX(prop_target-content_info-hunks, i,
  hunk_info_t *);
-  SVN_ERR(send_hunk_notification(hi, target, prop_target-name, 
- ctx, iterpool));
+
+  /* Don't notify on the hunk level for added or deleted props. */
+  if (prop_target-operation != svn_diff_op_added 
+  prop_target-operation != svn_diff_op_deleted)
+SVN_ERR(send_hunk_notification(hi, target, prop_target-name, 
+   ctx, iterpool));
 }
 }
   svn_pool_destroy(iterpool);

Modified: subversion/trunk/subversion/tests/cmdline/patch_tests.py
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/patch_tests.py?rev=981520r1=981519r2=981520view=diff
==
--- subversion/trunk/subversion/tests/cmdline/patch_tests.py (original)
+++ subversion/trunk/subversion/tests/cmdline/patch_tests.py Mon Aug  2 
14:24:04 2010
@@ -2977,7 +2977,7 @@ test_list = [ None,
   patch_with_ignore_whitespace,
   patch_replace_locally_deleted_file,
   patch_no_eol_at_eof,
-  XFail(patch_with_properties),
+  patch_with_properties,
   patch_same_twice,
   XFail(patch_dir_properties),
   XFail(patch_add_path_with_props),




svn commit: r980665 - /subversion/trunk/subversion/tests/cmdline/patch_tests.py

2010-07-30 Thread dannas
Author: dannas
Date: Fri Jul 30 07:09:57 2010
New Revision: 980665

URL: http://svn.apache.org/viewvc?rev=980665view=rev
Log:
Add a test for applying patches with offset searching.

The test is a copy-paste of the existing patch_test nr 3,
patch_offset(), adjusted to use properties instead of text.

* subversion/tests/cmdline/patch_tests.py
  (patch_prop_offset): New
  (test_list): Add the new test.

Modified:
subversion/trunk/subversion/tests/cmdline/patch_tests.py

Modified: subversion/trunk/subversion/tests/cmdline/patch_tests.py
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/patch_tests.py?rev=980665r1=980664r2=980665view=diff
==
--- subversion/trunk/subversion/tests/cmdline/patch_tests.py (original)
+++ subversion/trunk/subversion/tests/cmdline/patch_tests.py Fri Jul 30 
07:09:57 2010
@@ -2598,6 +2598,219 @@ def patch_add_path_with_props(sbox):
1, # check-props
1) # dry-run
 
+def patch_prop_offset(sbox):
+  property patch with offset searching
+
+  sbox.build()
+  wc_dir = sbox.wc_dir
+
+  patch_file_path = make_patch_path(sbox)
+  iota_path = os.path.join(wc_dir, 'iota')
+
+  prop1_content = ''.join([
+Dear internet user,\n,
+# The missing line here will cause the first hunk to match early
+We wish to congratulate you over your email success in our computer\n,
+Balloting. This is a Millennium Scientific Electronic Computer Draw\n,
+in which email addresses were used. All participants were selected\n,
+through a computer ballot system drawn from over 100,000 company\n,
+and 50,000,000 individual email addresses from all over the world.\n,
+\n,
+Your email address drew and have won the sum of  750,000 Euros\n,
+( Seven Hundred and Fifty Thousand Euros) in cash credited to\n,
+file with\n,
+REFERENCE NUMBER: ESP/WIN/008/05/10/MA;\n,
+These extra lines will cause the second hunk to match late\n,
+These extra lines will cause the second hunk to match late\n,
+These extra lines will cause the second hunk to match late\n,
+These extra lines will cause the second hunk to match late\n,
+These extra lines will cause the second hunk to match late\n,
+WINNING NUMBER : 14-17-24-34-37-45-16\n,
+BATCH NUMBERS :\n,
+EULO/1007/444/606/08;\n,
+SERIAL NUMBER: 45327\n,
+and PROMOTION DATE: 13th June. 2009\n,
+\n,
+To claim your winning prize, you are to contact the appointed\n,
+agent below as soon as possible for the immediate release of your\n,
+winnings with the below details.\n,
+\n,
+Again, we wish to congratulate you over your email success in our\n
+computer Balloting.\n,
+  ])
+
+  # prop2's content will make both a late and early match possible.
+  # The hunk to be applied is replicated here for reference:
+  # ## -5,6 +5,7 ##
+  #  property
+  #  property
+  #  property
+  # +x
+  #  property
+  #  property
+  #  property
+  #
+  # This hunk wants to be applied at line 5, but that isn't
+  # possible because line 8 (zzz) does not match property.
+  # The early match happens at line 2 (offset 3 = 5 - 2).
+  # The late match happens at line 9 (offset 4 = 9 - 5).
+  # Subversion will pick the early match in this case because it
+  # is closer to line 5.
+  prop2_content = ''.join([
+property\n,
+property\n,
+property\n,
+property\n,
+property\n,
+property\n,
+property\n,
+zzz\n,
+property\n,
+property\n,
+property\n,
+property\n,
+property\n,
+property\n,
+property\n
+  ])
+
+  # Set iota prop contents
+  svntest.main.run_svn(None, 'propset', 'prop1', prop1_content,
+   iota_path)
+  svntest.main.run_svn(None, 'propset', 'prop2', prop2_content,
+   iota_path)
+  expected_output = svntest.wc.State(wc_dir, {
+'iota'   : Item(verb='Sending'),
+})
+  expected_status = svntest.actions.get_virginal_state(wc_dir, 1)
+  expected_status.tweak('iota', wc_rev=2)
+  svntest.actions.run_and_verify_commit(wc_dir, expected_output,
+expected_status, None, wc_dir)
+
+  # Apply patch
+
+  unidiff_patch = [
+Index: iota\n,
+===\n,
+--- iota  (revision XYZ)\n,
++++ iota  (working copy)\n,
+\n,
+Property changes on: iota\n,
+---\n,
+Modified: prop1\n,
+## -6,6 +6,9 ##\n,
+ through a computer ballot system drawn from over 100,000 company\n,
+ and 50,000,000 individual email addresses from all over the world.\n,
+ \n,
++It is a promotional program aimed at encouraging internet users;\n,
++therefore you do not need to buy ticket to enter for it.\n,
++\n,
+ Your email address

svn propchange: r980665 - svn:log

2010-07-30 Thread dannas
Author: dannas
Revision: 980665
Modified property: svn:log

Modified: svn:log at Fri Jul 30 07:11:40 2010
--
--- svn:log (original)
+++ svn:log Fri Jul 30 07:11:40 2010
@@ -1,4 +1,4 @@
-Add a test for applying patches with offset searching.
+Add a test for applying property patches with offset searching.
 
 The test is a copy-paste of the existing patch_test nr 3,
 patch_offset(), adjusted to use properties instead of text.



svn commit: r980668 - /subversion/trunk/subversion/tests/cmdline/patch_tests.py

2010-07-30 Thread dannas
Author: dannas
Date: Fri Jul 30 07:31:54 2010
New Revision: 980668

URL: http://svn.apache.org/viewvc?rev=980668view=rev
Log:
Add a test for applying property patches with fuzz.

The test is a copy-paste of the existing patch_test nr 11, 
patch_fuzz(), adjusted to use properties instead of text.

* subversion/tests/cmdline/patch_tests.py
  (patch_prop_fuzz): New
  (test_list): Add the new test.

Modified:
subversion/trunk/subversion/tests/cmdline/patch_tests.py

Modified: subversion/trunk/subversion/tests/cmdline/patch_tests.py
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/patch_tests.py?rev=980668r1=980667r2=980668view=diff
==
--- subversion/trunk/subversion/tests/cmdline/patch_tests.py (original)
+++ subversion/trunk/subversion/tests/cmdline/patch_tests.py Fri Jul 30 
07:31:54 2010
@@ -2811,6 +2811,149 @@ def patch_prop_offset(sbox):
1, # check-props
1) # dry-run
 
+def patch_prop_with_fuzz(sbox):
+  property patch with fuzz
+
+  sbox.build()
+  wc_dir = sbox.wc_dir
+  patch_file_path = make_patch_path(sbox)
+
+  mu_path = os.path.join(wc_dir, 'A', 'mu')
+
+  # We have replaced a couple of lines to cause fuzz. Those lines contains
+  # the word fuzz
+  prop_contents = ''.join([
+Line replaced for fuzz = 1\n,
+\n,
+We wish to congratulate you over your email success in our computer\n,
+Balloting. This is a Millennium Scientific Electronic Computer Draw\n,
+in which email addresses were used. All participants were selected\n,
+through a computer ballot system drawn from over 100,000 company\n,
+and 50,000,000 individual email addresses from all over the world.\n,
+Line replaced for fuzz = 2 with only the second context line changed\n,
+Your email address drew and have won the sum of  750,000 Euros\n,
+( Seven Hundred and Fifty Thousand Euros) in cash credited to\n,
+file with\n,
+REFERENCE NUMBER: ESP/WIN/008/05/10/MA;\n,
+WINNING NUMBER : 14-17-24-34-37-45-16\n,
+BATCH NUMBERS :\n,
+EULO/1007/444/606/08;\n,
+SERIAL NUMBER: 45327\n,
+and PROMOTION DATE: 13th June. 2009\n,
+\n,
+This line is inserted to cause an offset of +1\n,
+To claim your winning prize, you are to contact the appointed\n,
+agent below as soon as possible for the immediate release of your\n,
+winnings with the below details.\n,
+\n,
+Line replaced for fuzz = 2\n,
+Line replaced for fuzz = 2\n,
+  ])
+
+  # Set mu prop contents
+  svntest.main.run_svn(None, 'propset', 'prop', prop_contents,
+   mu_path)
+  expected_output = svntest.wc.State(wc_dir, {
+'A/mu'   : Item(verb='Sending'),
+})
+  expected_status = svntest.actions.get_virginal_state(wc_dir, 1)
+  expected_status.tweak('A/mu', wc_rev=2)
+  svntest.actions.run_and_verify_commit(wc_dir, expected_output,
+  expected_status, None, wc_dir)
+
+  unidiff_patch = [
+Index: mu\n,
+===\n,
+--- A/mu\t(revision 0)\n,
++++ A/mu\t(revision 0)\n,
+\n,
+Property changes on: mu\n,
+Modified: prop\n,
+## -1,6 +1,7 ##\n,
+ Dear internet user,\n,
+ \n,
+ We wish to congratulate you over your email success in our computer\n,
++A new line here\n,
+ Balloting. This is a Millennium Scientific Electronic Computer Draw\n,
+ in which email addresses were used. All participants were selected\n,
+ through a computer ballot system drawn from over 100,000 company\n,
+## -7,7 +8,9 ##\n,
+ and 50,000,000 individual email addresses from all over the world.\n,
+ \n,
+ Your email address drew and have won the sum of  750,000 Euros\n,
++Another new line\n,
+ ( Seven Hundred and Fifty Thousand Euros) in cash credited to\n,
++A third new line\n,
+ file with\n,
+REFERENCE NUMBER: ESP/WIN/008/05/10/MA;\n,
+WINNING NUMBER : 14-17-24-34-37-45-16\n,
+## -19,6 +20,7 ##\n,
+ To claim your winning prize, you are to contact the appointed\n,
+ agent below as soon as possible for the immediate release of your\n,
+ winnings with the below details.\n,
++A fourth new line\n,
+ \n,
+ Again, we wish to congratulate you over your email success in our\n
+ computer Balloting. [No trailing newline here]
+  ]
+
+  svntest.main.file_write(patch_file_path, ''.join(unidiff_patch))
+
+  prop_contents = ''.join([
+Line replaced for fuzz = 1\n,
+\n,
+We wish to congratulate you over your email success in our computer\n,
+A new line here\n,
+Balloting. This is a Millennium Scientific Electronic Computer Draw\n,
+in which email addresses were used. All participants were selected\n,
+through a computer ballot system drawn from over 100,000 company

svn commit: r980670 - /subversion/trunk/subversion/libsvn_client/patch.c

2010-07-30 Thread dannas
Author: dannas
Date: Fri Jul 30 07:52:49 2010
New Revision: 980670

URL: http://svn.apache.org/viewvc?rev=980670view=rev
Log:
Follow-up to r980427. Remove TODO about adding property hunk 
notifications. We now have those working. 

The other notifications types involves the whole target and 
should not change from the current behaviour.

* subversion/libsvn_client/patch.c
  (send_patch_notification): Remove comment.

Modified:
subversion/trunk/subversion/libsvn_client/patch.c

Modified: subversion/trunk/subversion/libsvn_client/patch.c
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/patch.c?rev=980670r1=980669r2=980670view=diff
==
--- subversion/trunk/subversion/libsvn_client/patch.c (original)
+++ subversion/trunk/subversion/libsvn_client/patch.c Fri Jul 30 07:52:49 2010
@@ -1472,9 +1472,6 @@ send_patch_notification(const patch_targ
   else if (target-has_text_changes)
 notify-content_state = svn_wc_notify_state_changed;
 
-  /* ### We need to decide on how we want prop notifications to work. 
-   * ### At the moment we're not reporting property hunks and what about
-   * ### added paths with props and paths scheduled for deletion? */
   if (target-had_prop_rejects)
 notify-prop_state = svn_wc_notify_state_conflicted;
   else if (target-has_prop_changes)




svn commit: r980679 - /subversion/trunk/subversion/libsvn_client/patch.c

2010-07-30 Thread dannas
Author: dannas
Date: Fri Jul 30 08:44:39 2010
New Revision: 980679

URL: http://svn.apache.org/viewvc?rev=980679view=rev
Log:
Move the hunk notifications parts to it's own function for code reuse and
readability.

* subversion/libsvn_client/patch.c
  (send_patch_notification): Move the hunk notifications from here ..
  (send_hunk_notification): .. To here. New.

Modified:
subversion/trunk/subversion/libsvn_client/patch.c

Modified: subversion/trunk/subversion/libsvn_client/patch.c
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/patch.c?rev=980679r1=980678r2=980679view=diff
==
--- subversion/trunk/subversion/libsvn_client/patch.c (original)
+++ subversion/trunk/subversion/libsvn_client/patch.c Fri Jul 30 08:44:39 2010
@@ -1426,6 +1426,47 @@ apply_hunk(patch_target_t *target, targe
   return SVN_NO_ERROR;
 }
 
+/* Use client context CTX to send a suitable notification for hunk HI,
+ * using TARGET to determine the path. If the hunk is a property hunk,
+ * PROP_NAME is set, else NULL. Use POOL for temporary allocations. */
+static svn_error_t *
+send_hunk_notification(const hunk_info_t *hi, 
+   const patch_target_t *target, 
+   const char *prop_name, 
+   const svn_client_ctx_t *ctx,
+   apr_pool_t *pool)
+{
+  svn_wc_notify_t *notify;
+  svn_wc_notify_action_t action;
+
+  if (hi-already_applied)
+action = svn_wc_notify_patch_hunk_already_applied;
+  else if (hi-rejected)
+action = svn_wc_notify_patch_rejected_hunk;
+  else
+action = svn_wc_notify_patch_applied_hunk;
+
+  notify = svn_wc_create_notify(target-local_abspath
+? target-local_abspath
+: target-local_relpath,
+action, pool);
+  notify-hunk_original_start =
+svn_diff_hunk_get_original_start(hi-hunk);
+  notify-hunk_original_length =
+svn_diff_hunk_get_original_length(hi-hunk);
+  notify-hunk_modified_start =
+svn_diff_hunk_get_modified_start(hi-hunk);
+  notify-hunk_modified_length =
+svn_diff_hunk_get_modified_length(hi-hunk);
+  notify-hunk_matched_line = hi-matched_line;
+  notify-hunk_fuzz = hi-fuzz;
+  notify-prop_name = prop_name;
+
+  (*ctx-notify_func2)(ctx-notify_baton2, notify, pool);
+
+  return SVN_NO_ERROR;
+}
+
 /* Use client context CTX to send a suitable notification for a patch TARGET.
  * Use POOL for temporary allocations. */
 static svn_error_t *
@@ -1489,36 +1530,14 @@ send_patch_notification(const patch_targ
   iterpool = svn_pool_create(pool);
   for (i = 0; i  target-content_info-hunks-nelts; i++)
 {
-  hunk_info_t *hi;
+  const hunk_info_t *hi;
 
   svn_pool_clear(iterpool);
 
   hi = APR_ARRAY_IDX(target-content_info-hunks, i, hunk_info_t *);
 
-  if (hi-already_applied)
-action = svn_wc_notify_patch_hunk_already_applied;
-  else if (hi-rejected)
-action = svn_wc_notify_patch_rejected_hunk;
-  else
-action = svn_wc_notify_patch_applied_hunk;
-
-  notify = svn_wc_create_notify(target-local_abspath
-? target-local_abspath
-: target-local_relpath,
-action, pool);
-  notify-hunk_original_start =
-svn_diff_hunk_get_original_start(hi-hunk);
-  notify-hunk_original_length =
-svn_diff_hunk_get_original_length(hi-hunk);
-  notify-hunk_modified_start =
-svn_diff_hunk_get_modified_start(hi-hunk);
-  notify-hunk_modified_length =
-svn_diff_hunk_get_modified_length(hi-hunk);
-  notify-hunk_matched_line = hi-matched_line;
-  notify-hunk_fuzz = hi-fuzz;
-  notify-prop_name = NULL;
-
-  (*ctx-notify_func2)(ctx-notify_baton2, notify, pool);
+  SVN_ERR(send_hunk_notification(hi, target, NULL /* prop_name */, 
+ ctx, iterpool));
 }
 
   for (hash_index = apr_hash_first(pool, target-prop_targets);
@@ -1531,37 +1550,14 @@ send_patch_notification(const patch_targ
 
   for (i = 0; i  prop_target-content_info-hunks-nelts; i++)
 {
-  hunk_info_t *hi;
+  const hunk_info_t *hi;
 
   svn_pool_clear(iterpool);
 
   hi = APR_ARRAY_IDX(prop_target-content_info-hunks, i,
  hunk_info_t *);
-
-  if (hi-already_applied)
-action = svn_wc_notify_patch_hunk_already_applied;
-  else if (hi-rejected)
-action = svn_wc_notify_patch_rejected_hunk;
-  else
-action = svn_wc_notify_patch_applied_hunk;
-
-  notify = svn_wc_create_notify(target

svn commit: r980730 - in /subversion/trunk/subversion: libsvn_diff/diff_memory.c tests/cmdline/diff_tests.py

2010-07-30 Thread dannas
Author: dannas
Date: Fri Jul 30 10:52:41 2010
New Revision: 980730

URL: http://svn.apache.org/viewvc?rev=980730view=rev
Log:
Make 'svn diff' print the correct hunk delimiters for all property hunks. At
the same time, adjust expected paths for an earlier XFailing test.

Previously, only the last hunk would have '##' delimiters.

* subversion/libsvn_diff/diff_memory.c
  (unified_output_baton_t): Add field 'hunk_delimiter'
  (output_unified_diff_modified): Call output_unfied_flush_hunk() with
the hunk_delimiter from the baton.
  (svn_diff_mem_string_output_unified2): Initialize 'btn-hunk_delimiter'.

* subversion/tests/cmdline/diff_tests.py
  (diff_prop_multiple_hunks): Adjust expected paths.
  (test_list): Remove XFail for diff_prop_multiple_hunks().

Modified:
subversion/trunk/subversion/libsvn_diff/diff_memory.c
subversion/trunk/subversion/tests/cmdline/diff_tests.py

Modified: subversion/trunk/subversion/libsvn_diff/diff_memory.c
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_diff/diff_memory.c?rev=980730r1=980729r2=980730view=diff
==
--- subversion/trunk/subversion/libsvn_diff/diff_memory.c (original)
+++ subversion/trunk/subversion/libsvn_diff/diff_memory.c Fri Jul 30 10:52:41 
2010
@@ -353,6 +353,10 @@ typedef struct unified_output_baton_t
   apr_off_t hunk_length[2]; /* 0 == original; 1 == modified */
   apr_off_t hunk_start[2];  /* 0 == original; 1 == modified */
 
+  /* The delimiters of the hunk header, '@@' for text hunks and '##' for
+   * property hunks. */
+  const char *hunk_delimiter;
+
   /* Pool for allocation of temporary memory in the callbacks
  Should be cleared on entry of each iteration of a callback */
   apr_pool_t *pool;
@@ -516,7 +520,7 @@ output_unified_diff_modified(void *baton
   targ_mod = modified_start;
 
   if (btn-next_token + SVN_DIFF__UNIFIED_CONTEXT_SIZE  targ_orig)
-SVN_ERR(output_unified_flush_hunk(btn, NULL));
+SVN_ERR(output_unified_flush_hunk(btn, btn-hunk_delimiter));
 
   if (btn-hunk_length[0] == 0
btn-hunk_length[1] == 0)
@@ -569,6 +573,7 @@ svn_diff_mem_string_output_unified2(svn_
   baton.pool = svn_pool_create(pool);
   baton.header_encoding = header_encoding;
   baton.hunk = svn_stringbuf_create(, pool);
+  baton.hunk_delimiter = hunk_delimiter;
 
   SVN_ERR(svn_utf_cstring_from_utf8_ex2
   ((baton.prefix_str[unified_output_context]),  ,

Modified: subversion/trunk/subversion/tests/cmdline/diff_tests.py
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/diff_tests.py?rev=980730r1=980729r2=980730view=diff
==
--- subversion/trunk/subversion/tests/cmdline/diff_tests.py (original)
+++ subversion/trunk/subversion/tests/cmdline/diff_tests.py Fri Jul 30 10:52:41 
2010
@@ -3475,12 +3475,12 @@ def diff_prop_multiple_hunks(sbox):
   svntest.main.run_svn(None,
propset, prop, prop_val, iota_path)
   expected_output = [
-Index: iota\n,
+Index: %s\n % iota_path,
 ===\n,
---- iota\t(revision 2)\n,
-+++ iota\t(working copy)\n,
+--- %s\t(revision 2)\n % iota_path,
++++ %s\t(working copy)\n % iota_path,
 \n,
-Property changes on: iota\n,
+Property changes on: %s\n % iota_path,
 ___\n,
 Modified: prop\n,
 ## -1,6 +1,7 ##\n,
@@ -3564,7 +3564,7 @@ test_list = [ None,
   diff_git_format_url_wc,
   diff_git_format_url_url,
   XFail(diff_prop_missing_context),
-  XFail(diff_prop_multiple_hunks),
+  diff_prop_multiple_hunks,
   ]
 
 if __name__ == '__main__':




svn commit: r980744 - /subversion/trunk/subversion/tests/cmdline/diff_tests.py

2010-07-30 Thread dannas
Author: dannas
Date: Fri Jul 30 11:51:08 2010
New Revision: 980744

URL: http://svn.apache.org/viewvc?rev=980744view=rev
Log:
Follow-up to r980730. Fix Windows failure due to wrong path separators.

* subversion/tests/cmdline/diff_tests.py
  (diff_prop_multiple_hunks): Use make_diff_header() that replaces all
platform specific separators with '/' that is used consistently in
the diff format.

Modified:
subversion/trunk/subversion/tests/cmdline/diff_tests.py

Modified: subversion/trunk/subversion/tests/cmdline/diff_tests.py
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/diff_tests.py?rev=980744r1=980743r2=980744view=diff
==
--- subversion/trunk/subversion/tests/cmdline/diff_tests.py (original)
+++ subversion/trunk/subversion/tests/cmdline/diff_tests.py Fri Jul 30 11:51:08 
2010
@@ -3474,13 +3474,10 @@ def diff_prop_multiple_hunks(sbox):
  ])
   svntest.main.run_svn(None,
propset, prop, prop_val, iota_path)
-  expected_output = [
-Index: %s\n % iota_path,
-===\n,
---- %s\t(revision 2)\n % iota_path,
-+++ %s\t(working copy)\n % iota_path,
+  expected_output = make_diff_header(iota_path, 'revision 2', 
+ 'working copy') + [
 \n,
-Property changes on: %s\n % iota_path,
+Property changes on: %s\n % iota_path.replace('\\', '/'),
 ___\n,
 Modified: prop\n,
 ## -1,6 +1,7 ##\n,




svn commit: r980745 - /subversion/trunk/subversion/libsvn_wc/wc_db.c

2010-07-30 Thread dannas
Author: dannas
Date: Fri Jul 30 12:00:49 2010
New Revision: 980745

URL: http://svn.apache.org/viewvc?rev=980745view=rev
Log:
Fix GCC warning about 'enumeration value not handled' by adding a
default statemnt that does nothing.

* subversion/libsvn_wc/wc_db.c
  (svn_wc__db_wclock_release): Add 'default' statement.

Modified:
subversion/trunk/subversion/libsvn_wc/wc_db.c

Modified: subversion/trunk/subversion/libsvn_wc/wc_db.c
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/wc_db.c?rev=980745r1=980744r2=980745view=diff
==
--- subversion/trunk/subversion/libsvn_wc/wc_db.c (original)
+++ subversion/trunk/subversion/libsvn_wc/wc_db.c Fri Jul 30 12:00:49 2010
@@ -8375,6 +8375,8 @@ svn_wc__db_wclock_release(svn_wc__db_t *
 case svn_wc__db_status_obstructed_delete:
   return SVN_NO_ERROR; /* Administrative area missing
   - Lock gone */
+default:
+  break;
   }
   SVN_ERR_ASSERT(*local_relpath == '\0');
 }




svn commit: r980335 - /subversion/trunk/subversion/tests/cmdline/diff_tests.py

2010-07-29 Thread dannas
Author: dannas
Date: Thu Jul 29 06:52:55 2010
New Revision: 980335

URL: http://svn.apache.org/viewvc?rev=980335view=rev
Log:
Add XFailing test for creating a property diff with multiple hunks.

At the moment, only the last hunk of a property diff has the right
hunk header '## -a,b +b,c ##'. The previous ones have '@@ -a,b +b,c @@'.

* subversion/tests/cmdline/diff_tests.py
  (diff_prop_multiple_hunks): New.
  (test_list): Add the new test and mark it with XFail.

Modified:
subversion/trunk/subversion/tests/cmdline/diff_tests.py

Modified: subversion/trunk/subversion/tests/cmdline/diff_tests.py
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/diff_tests.py?rev=980335r1=980334r2=980335view=diff
==
--- subversion/trunk/subversion/tests/cmdline/diff_tests.py (original)
+++ subversion/trunk/subversion/tests/cmdline/diff_tests.py Thu Jul 29 06:52:55 
2010
@@ -3423,6 +3423,86 @@ def diff_prop_missing_context(sbox):
   svntest.actions.run_and_verify_svn(None, expected_output, [],
  'diff', iota_path)
 
+def diff_prop_multiple_hunks(sbox):
+  diff for property with multiple hunks
+  sbox.build()
+  wc_dir = sbox.wc_dir
+
+  iota_path = os.path.join(wc_dir, 'iota')
+  prop_val = .join([
+   line 1\n,
+   line 2\n,
+   line 3\n,
+   line 4\n,
+   line 5\n,
+   line 6\n,
+   line 7\n,
+   line 8\n,
+   line 9\n,
+   line 10\n,
+   line 11\n,
+   line 12\n,
+   line 13\n,
+ ])
+  svntest.main.run_svn(None,
+   propset, prop, prop_val, iota_path)
+
+  expected_output = svntest.wc.State(wc_dir, {
+  'iota': Item(verb='Sending'),
+  })
+  expected_status = svntest.actions.get_virginal_state(wc_dir, 1)
+  expected_status.tweak('iota', wc_rev=2)
+  svntest.actions.run_and_verify_commit(wc_dir, expected_output,
+expected_status, None, wc_dir)
+
+  prop_val = .join([
+   line 1\n,
+   line 2\n,
+   line 3\n,
+   Add a line here\n,
+   line 4\n,
+   line 5\n,
+   line 6\n,
+   line 7\n,
+   line 8\n,
+   line 9\n,
+   line 10\n,
+   And add a line here\n,
+   line 11\n,
+   line 12\n,
+   line 13\n,
+ ])
+  svntest.main.run_svn(None,
+   propset, prop, prop_val, iota_path)
+  expected_output = [
+Index: iota\n,
+===\n,
+--- iota\t(revision 2)\n,
++++ iota\t(working copy)\n,
+\n,
+Property changes on: iota\n,
+___\n,
+Modified: prop\n,
+## -1,6 +1,7 ##\n,
+ line 1\n,
+ line 2\n,
+ line 3\n,
++Add a line here\n,
+ line 4\n,
+ line 5\n,
+ line 6\n,
+## -8,6 +9,7 ##\n,
+ line 8\n,
+ line 9\n,
+ line 10\n,
++And add a line here\n,
+ line 11\n,
+ line 12\n,
+ line 13\n,
+  ]
+
+  svntest.actions.run_and_verify_svn(None, expected_output, [],
+ 'diff', iota_path)
 
 
 #Run the tests
@@ -3484,6 +3564,7 @@ test_list = [ None,
   diff_git_format_url_wc,
   diff_git_format_url_url,
   XFail(diff_prop_missing_context),
+  XFail(diff_prop_multiple_hunks),
   ]
 
 if __name__ == '__main__':




svn commit: r980373 - in /subversion/trunk/subversion: libsvn_client/patch.c svn/notify.c

2010-07-29 Thread dannas
Author: dannas
Date: Thu Jul 29 09:13:41 2010
New Revision: 980373

URL: http://svn.apache.org/viewvc?rev=980373view=rev
Log:
Make 'svn patch' report conflicts for prop targets. At the same time 
start printing rejected property hunks to the reject stream.

Note that we do not yet give notifications on the hunk level for 
properties.

* subversion/svn/notify.c
  (notify): Print ' C' for paths with prop conflicts.

* subversion/libsvn_client/patch.c
  (patch_target_t): Add field 'had_prop_rejects' to make it possible to
distinguish between prop and text conflicts.
  (reject_hunk): Replace parameter 'is_prop_hunk' with 'prop_name' 
since we need the property name when printing prop hunks. Use '##'
instead of '@@' for property hunks.
  (apply_hunk): Replace parameter 'is_prop_hunk' with 'prop_name'
since reject_hunk() may be called from here.
  (send_patch_notification): Start notifying about prop conflicts.
  (apply_one_patch): Update caller of reject_hunk() and apply_hunk().
  (write_out_rejected_hunks): Start writing rejected prop hunks.

Modified:
subversion/trunk/subversion/libsvn_client/patch.c
subversion/trunk/subversion/svn/notify.c

Modified: subversion/trunk/subversion/libsvn_client/patch.c
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/patch.c?rev=980373r1=980372r2=980373view=diff
==
--- subversion/trunk/subversion/libsvn_client/patch.c (original)
+++ subversion/trunk/subversion/libsvn_client/patch.c Thu Jul 29 09:13:41 2010
@@ -176,6 +176,9 @@ typedef struct patch_target_t {
   /* True if at least one hunk was rejected. */
   svn_boolean_t had_rejects;
 
+  /* True if atleast one property hunk was rejected. */
+  svn_boolean_t had_prop_rejects;
+
   /* True if the target file had local modifications before the
* patch was applied to it. */
   svn_boolean_t local_mods;
@@ -1271,19 +1274,38 @@ copy_lines_to_target(target_content_info
  * Do temporary allocations in POOL. */
 static svn_error_t *
 reject_hunk(patch_target_t *target, target_content_info_t *content_info, 
-hunk_info_t *hi, svn_boolean_t is_prop_hunk,  apr_pool_t *pool)
+hunk_info_t *hi, const char *prop_name, apr_pool_t *pool)
 {
   const char *hunk_header;
   apr_size_t len;
   svn_boolean_t eof;
   apr_pool_t *iterpool;
 
-  hunk_header = apr_psprintf(pool, @@ -%lu,%lu +%lu,%lu @@%s,
- svn_diff_hunk_get_original_start(hi-hunk),
- svn_diff_hunk_get_original_length(hi-hunk),
- svn_diff_hunk_get_modified_start(hi-hunk),
- svn_diff_hunk_get_modified_length(hi-hunk),
- APR_EOL_STR);
+  if (prop_name)
+{
+  const char *prop_header;
+
+  /* ### Print 'Added', 'Deleted' or 'Modified' instead of 'Propperty'.
+   */
+  prop_header = apr_psprintf(pool, Property: %s\n, prop_name);
+  len = strlen(prop_header);
+
+  SVN_ERR(svn_stream_write(content_info-reject, prop_header, len));
+
+  hunk_header = apr_psprintf(pool, ## -%lu,%lu +%lu,%lu ##%s,
+ svn_diff_hunk_get_original_start(hi-hunk),
+ svn_diff_hunk_get_original_length(hi-hunk),
+ svn_diff_hunk_get_modified_start(hi-hunk),
+ svn_diff_hunk_get_modified_length(hi-hunk),
+ APR_EOL_STR);
+}
+  else
+hunk_header = apr_psprintf(pool, @@ -%lu,%lu +%lu,%lu @@%s,
+   svn_diff_hunk_get_original_start(hi-hunk),
+   svn_diff_hunk_get_original_length(hi-hunk),
+   svn_diff_hunk_get_modified_start(hi-hunk),
+   svn_diff_hunk_get_modified_length(hi-hunk),
+   APR_EOL_STR);
   len = strlen(hunk_header);
   SVN_ERR(svn_stream_write(content_info-reject, hunk_header, len));
 
@@ -1311,9 +1333,9 @@ reject_hunk(patch_target_t *target, targ
   while (! eof);
   svn_pool_destroy(iterpool);
 
-  /* ### had_rejects is used for notification. We haven't yet turned on
-   * ### notification for properties. */
-  if (! is_prop_hunk)
+  if (prop_name)
+target-had_prop_rejects = TRUE;
+  else
 target-had_rejects = TRUE;
 
   return SVN_NO_ERROR;
@@ -1323,7 +1345,7 @@ reject_hunk(patch_target_t *target, targ
  * stream of CONTENT_INFO. Do temporary allocations in POOL. */
 static svn_error_t *
 apply_hunk(patch_target_t *target, target_content_info_t *content_info,  
-   hunk_info_t *hi, svn_boolean_t is_prop_hunk, apr_pool_t *pool)
+   hunk_info_t *hi, const char *prop_name, apr_pool_t *pool)
 {
   svn_linenum_t lines_read;
   svn_boolean_t eof;
@@ -1331,7 +1353,7 @@ apply_hunk(patch_target_t *target, targe
 
   /* ### Is there a cleaner way to describe if we have

svn commit: r980427 - in /subversion/trunk/subversion: include/svn_wc.h libsvn_client/patch.c svn/notify.c tests/cmdline/patch_tests.py

2010-07-29 Thread dannas
Author: dannas
Date: Thu Jul 29 12:43:56 2010
New Revision: 980427

URL: http://svn.apache.org/viewvc?rev=980427view=rev
Log:
Make 'svn patch' do notifications for property hunks.

We use the same notification actions as for text hunks but replace
the headers to look like:
  '## -1,6 +1,7 ##'
instead of:
  '@@ -1,6 +1,7 @@'

Note that we don't specify what property a hunk belongs to (that information
is available in the reject file).

* subversion/svn/notify.c
  (notify): Print different hunk headers depending on whether we have
a property or not.

* subversion/include/svn_wc.h
  (svn_wc_notify_t): Add 'is_prop_hunk' field.

* subversion/libsvn_client/patch.c
  (send_patch_notification): Iterate over the hunks of the property 
targets in the same manner as is done for the text hunks.

* subversion/tests/cmdline/patch_tests.py
  (test_with_properties): Mark as XFail. We get a notification saying
a hunk that adds one line to a non-existent property is beeing applied
with offset 1.

Modified:
subversion/trunk/subversion/include/svn_wc.h
subversion/trunk/subversion/libsvn_client/patch.c
subversion/trunk/subversion/svn/notify.c
subversion/trunk/subversion/tests/cmdline/patch_tests.py

Modified: subversion/trunk/subversion/include/svn_wc.h
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/include/svn_wc.h?rev=980427r1=980426r2=980427view=diff
==
--- subversion/trunk/subversion/include/svn_wc.h (original)
+++ subversion/trunk/subversion/include/svn_wc.h Thu Jul 29 12:43:56 2010
@@ -1266,6 +1266,10 @@ typedef struct svn_wc_notify_t {
* @since New in 1.7 */
   int hunk_fuzz;
 
+  /** If @c action relates to hunks, specifies whether the hunk is a
+   * property hunk or not. */
+  svn_boolean_t is_prop_hunk;
+
   /* NOTE: Add new fields at the end to preserve binary compatibility.
  Also, if you add fields here, you have to update svn_wc_create_notify
  and svn_wc_dup_notify. */

Modified: subversion/trunk/subversion/libsvn_client/patch.c
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/patch.c?rev=980427r1=980426r2=980427view=diff
==
--- subversion/trunk/subversion/libsvn_client/patch.c (original)
+++ subversion/trunk/subversion/libsvn_client/patch.c Thu Jul 29 12:43:56 2010
@@ -1487,6 +1487,7 @@ send_patch_notification(const patch_targ
 {
   int i;
   apr_pool_t *iterpool;
+  apr_hash_index_t *hash_index;
 
   iterpool = svn_pool_create(pool);
   for (i = 0; i  target-content_info-hunks-nelts; i++)
@@ -1518,9 +1519,56 @@ send_patch_notification(const patch_targ
 svn_diff_hunk_get_modified_length(hi-hunk);
   notify-hunk_matched_line = hi-matched_line;
   notify-hunk_fuzz = hi-fuzz;
+  /* ### Should is_prop_hunk be a field in hunk_info_t? */
+  notify-is_prop_hunk = FALSE;
 
   (*ctx-notify_func2)(ctx-notify_baton2, notify, pool);
 }
+
+  for (hash_index = apr_hash_first(pool, target-prop_targets);
+   hash_index;
+   hash_index = apr_hash_next(hash_index))
+{
+  prop_patch_target_t *prop_target; 
+  
+  prop_target = svn__apr_hash_index_val(hash_index);
+
+  for (i = 0; i  prop_target-content_info-hunks-nelts; i++)
+{
+  hunk_info_t *hi;
+
+  svn_pool_clear(iterpool);
+
+  hi = APR_ARRAY_IDX(prop_target-content_info-hunks, i,
+ hunk_info_t *);
+
+  if (hi-already_applied)
+action = svn_wc_notify_patch_hunk_already_applied;
+  else if (hi-rejected)
+action = svn_wc_notify_patch_rejected_hunk;
+  else
+action = svn_wc_notify_patch_applied_hunk;
+
+  notify = svn_wc_create_notify(target-local_abspath
+? target-local_abspath
+: target-local_relpath,
+action, pool);
+  notify-hunk_original_start =
+svn_diff_hunk_get_original_start(hi-hunk);
+  notify-hunk_original_length =
+svn_diff_hunk_get_original_length(hi-hunk);
+  notify-hunk_modified_start =
+svn_diff_hunk_get_modified_start(hi-hunk);
+  notify-hunk_modified_length =
+svn_diff_hunk_get_modified_length(hi-hunk);
+  notify-hunk_matched_line = hi-matched_line;
+  notify-hunk_fuzz = hi-fuzz;
+  /* ### Should is_prop_hunk be a field in hunk_info_t? */
+  notify-is_prop_hunk = TRUE;
+
+  (*ctx-notify_func2)(ctx-notify_baton2, notify, pool);
+}
+}
   svn_pool_destroy(iterpool

svn commit: r980569 - in /subversion/trunk/subversion: include/svn_wc.h libsvn_client/patch.c svn/notify.c

2010-07-29 Thread dannas
Author: dannas
Date: Thu Jul 29 20:59:08 2010
New Revision: 980569

URL: http://svn.apache.org/viewvc?rev=980569view=rev
Log:
Show the property name when printing property hunk notifications.

At the same time use '##' in the property hunk headers for already 
applied hunks.

The notifications will be on this form:
  '## -1,6 +1,7 ## (svn:executable)'

* subversion/svn/notify.c
  (notify): Add prop_name to the output for property hunks. 

* subversion/include/svn_wc.h
  (svn_wc_notify_t): Remove 'is_prop_hunk' field.

* subversion/libsvn_client/patch.c
  (send_patch_notification): Set the prop_name for property hunk 
notifications.

Suggested by: stsp

Modified:
subversion/trunk/subversion/include/svn_wc.h
subversion/trunk/subversion/libsvn_client/patch.c
subversion/trunk/subversion/svn/notify.c

Modified: subversion/trunk/subversion/include/svn_wc.h
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/include/svn_wc.h?rev=980569r1=980568r2=980569view=diff
==
--- subversion/trunk/subversion/include/svn_wc.h (original)
+++ subversion/trunk/subversion/include/svn_wc.h Thu Jul 29 20:59:08 2010
@@ -1266,10 +1266,6 @@ typedef struct svn_wc_notify_t {
* @since New in 1.7 */
   int hunk_fuzz;
 
-  /** If @c action relates to hunks, specifies whether the hunk is a
-   * property hunk or not. */
-  svn_boolean_t is_prop_hunk;
-
   /* NOTE: Add new fields at the end to preserve binary compatibility.
  Also, if you add fields here, you have to update svn_wc_create_notify
  and svn_wc_dup_notify. */

Modified: subversion/trunk/subversion/libsvn_client/patch.c
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/patch.c?rev=980569r1=980568r2=980569view=diff
==
--- subversion/trunk/subversion/libsvn_client/patch.c (original)
+++ subversion/trunk/subversion/libsvn_client/patch.c Thu Jul 29 20:59:08 2010
@@ -1519,8 +1519,7 @@ send_patch_notification(const patch_targ
 svn_diff_hunk_get_modified_length(hi-hunk);
   notify-hunk_matched_line = hi-matched_line;
   notify-hunk_fuzz = hi-fuzz;
-  /* ### Should is_prop_hunk be a field in hunk_info_t? */
-  notify-is_prop_hunk = FALSE;
+  notify-prop_name = NULL;
 
   (*ctx-notify_func2)(ctx-notify_baton2, notify, pool);
 }
@@ -1563,8 +1562,7 @@ send_patch_notification(const patch_targ
 svn_diff_hunk_get_modified_length(hi-hunk);
   notify-hunk_matched_line = hi-matched_line;
   notify-hunk_fuzz = hi-fuzz;
-  /* ### Should is_prop_hunk be a field in hunk_info_t? */
-  notify-is_prop_hunk = TRUE;
+  notify-prop_name = apr_pstrdup(pool, prop_target-name);
 
   (*ctx-notify_func2)(ctx-notify_baton2, notify, pool);
 }

Modified: subversion/trunk/subversion/svn/notify.c
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/svn/notify.c?rev=980569r1=980568r2=980569view=diff
==
--- subversion/trunk/subversion/svn/notify.c (original)
+++ subversion/trunk/subversion/svn/notify.c Thu Jul 29 20:59:08 2010
@@ -310,60 +310,96 @@ notify(void *baton, const svn_wc_notify_
   minus = -;
 }
 
-  /* ### APR_INT64_T_FMT isn't translator-friendly */
+  /* ### We're creating the localized strings without
+   * ### APR_INT64_T_FMT since it isn't translator-friendly */
   if (n-hunk_fuzz)
 {
-  if (n-is_prop_hunk)
-s = _( applied hunk ## -%lu,%lu +%lu,%lu ## 
-  with offset %s);
+
+  if (n-prop_name)
+{
+  s = _( applied hunk ## -%lu,%lu +%lu,%lu ## 
+with offset %s);
+
+  err = svn_cmdline_printf(pool,
+   apr_pstrcat(pool, s,
+   %APR_UINT64_T_FMT
+and fuzz %d (%s)\n,
+   NULL),
+   n-hunk_original_start,
+   n-hunk_original_length,
+   n-hunk_modified_start,
+   n-hunk_modified_length,
+   minus, off, n-hunk_fuzz,
+   n-prop_name);
+}
   else
-s = _( applied hunk @@ -%lu,%lu +%lu,%lu @@ 
-  with offset %s);
+{
+  s = _( applied hunk @@ -%lu,%lu +%lu,%lu

svn commit: r979955 - /subversion/trunk/subversion/tests/cmdline/diff_tests.py

2010-07-28 Thread dannas
Author: dannas
Date: Wed Jul 28 06:17:09 2010
New Revision: 979955

URL: http://svn.apache.org/viewvc?rev=979955view=rev
Log:
Simplify the testdata for an XFailing property diff test.

The actual diff still misses one context line; 'line 3'. Using the same
testdata and changes on a text file shows all context lines.

* subversion/tests/cmdline/diff_tests.py
  (diff_prop_missing_context): Use lines of the format 'line digit'. 
Remove empty lines.

Modified:
subversion/trunk/subversion/tests/cmdline/diff_tests.py

Modified: subversion/trunk/subversion/tests/cmdline/diff_tests.py
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/diff_tests.py?rev=979955r1=979954r2=979955view=diff
==
--- subversion/trunk/subversion/tests/cmdline/diff_tests.py (original)
+++ subversion/trunk/subversion/tests/cmdline/diff_tests.py Wed Jul 28 06:17:09 
2010
@@ -3374,16 +3374,13 @@ def diff_prop_missing_context(sbox):
 
   iota_path = os.path.join(wc_dir, 'iota')
   prop_val = .join([
-   One line\n,
-   Another line\n,
-   \n,
-   $ email EOT\n,
-mat...@docs.uu.se\n,
-Something strange @ my place\n,
-EOT\n,
-   \n,
-   to a shell, will produce the output\n,
-   \n,
+   line 1\n,
+   line 2\n,
+   line 3\n,
+   line 4\n,
+   line 5\n,
+   line 6\n,
+   line 7\n,
  ])
   svntest.main.run_svn(None,
propset, prop, prop_val, iota_path)
@@ -3396,13 +3393,11 @@ def diff_prop_missing_context(sbox):
   svntest.actions.run_and_verify_commit(wc_dir, expected_output,
 expected_status, None, wc_dir)
 
-  prop_val = .join([\n,
-   $ email EOT\n,
-mat...@docs.uu.se\n,
-Something strange @ my place\n,
-EOT\n,
-   \n,
-   \n,
+  prop_val = .join([
+   line 3\n,
+   line 4\n,
+   line 5\n,
+   line 6\n,
  ])
   svntest.main.run_svn(None,
propset, prop, prop_val, iota_path)
@@ -3415,18 +3410,14 @@ def diff_prop_missing_context(sbox):
 Property changes on: iota\n,
 ___\n,
 Modified: prop\n,
-## -1,10 +1,7 ##\n,
--One line\n,
--Another line\n,
-\n, 
-$ email EOT\n,
- mat...@docs.uu.se\n,
- Something strange @ my place\n,
- EOT\n,
-\n,
--to a shell, will produce the output\n,
-\n,
-\n,
+## -1,8 +1,5 ##\n,
+-line 1\n,
+-line 2\n,
+ line 3\n,
+ line 4\n,
+ line 5\n,
+ line 6\n,
+-line 7\n,
   ]
 
   svntest.actions.run_and_verify_svn(None, expected_output, [],




svn commit: r979976 - /subversion/trunk/subversion/libsvn_client/patch.c

2010-07-28 Thread dannas
Author: dannas
Date: Wed Jul 28 07:44:58 2010
New Revision: 979976

URL: http://svn.apache.org/viewvc?rev=979976view=rev
Log:
Follow-up to r979835. Allow more than just a deleted prop to be 
installed for a path. Before this change, the code stopped looping
over property targets after a deleted prop target was found.

* subversion/libsvn_client/patch.c
  (install_patched_prop_targets): Replace a break statement with a 
continue.

Modified:
subversion/trunk/subversion/libsvn_client/patch.c

Modified: subversion/trunk/subversion/libsvn_client/patch.c
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/patch.c?rev=979976r1=979975r2=979976view=diff
==
--- subversion/trunk/subversion/libsvn_client/patch.c (original)
+++ subversion/trunk/subversion/libsvn_client/patch.c Wed Jul 28 07:44:58 2010
@@ -2066,7 +2066,7 @@ install_patched_prop_targets(patch_targe
TRUE /* skip_checks */,
NULL, NULL,
iterpool));
-  break;
+  continue;
 }
 
   /* A property is usually one line long.




svn propchange: r979976 - svn:log

2010-07-28 Thread dannas
Author: dannas
Revision: 979976
Modified property: svn:log

Modified: svn:log at Wed Jul 28 08:12:47 2010
--
--- svn:log (original)
+++ svn:log Wed Jul 28 08:12:47 2010
@@ -3,5 +3,5 @@ installed for a path. Before this change
 over property targets after a deleted prop target was found.
 
 * subversion/libsvn_client/patch.c
-  (install_patched_prop_targets): Replace a break statement with a 
-continue.
+  (install_patched_prop_targets): Continue to the next prop target
+after having deleted a property.



svn commit: r980050 - /subversion/trunk/subversion/tests/cmdline/patch_tests.py

2010-07-28 Thread dannas
Author: dannas
Date: Wed Jul 28 13:35:21 2010
New Revision: 980050

URL: http://svn.apache.org/viewvc?rev=980050view=rev
Log:
Add XFailing test for 'svn patch' involving added paths with properties.

We have to be able to deal with diffs created on those. Currently, we
fail when we try to invoke svn_wc_prop_getX() on the not yet existing
node.

* subversion/tests/cmdline/patch_tests.py
  (patch_add_path_with_props): New
  (test_list): Add the new test.

Modified:
subversion/trunk/subversion/tests/cmdline/patch_tests.py

Modified: subversion/trunk/subversion/tests/cmdline/patch_tests.py
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/patch_tests.py?rev=980050r1=980049r2=980050view=diff
==
--- subversion/trunk/subversion/tests/cmdline/patch_tests.py (original)
+++ subversion/trunk/subversion/tests/cmdline/patch_tests.py Wed Jul 28 
13:35:21 2010
@@ -2526,6 +2526,70 @@ def patch_dir_properties(sbox):
1, # check-props
1) # dry-run
 
+def patch_add_path_with_props(sbox):
+  patch that adds paths with props
+
+  sbox.build()
+  wc_dir = sbox.wc_dir
+
+  patch_file_path = make_patch_path(sbox)
+  iota_path = os.path.join(wc_dir, 'iota')
+
+  # Apply patch that adds a file and a dir.
+
+  unidiff_patch = [
+Index: new\n,
+===\n,
+--- new\t(revision 0)\n,
++++ new\t(working copy)\n,
+@@ -0,0 +1 @@\n,
++This is the file 'new'\n,
+\n,
+Property changes on: new\n,
+---\n,
+Added: added\n,
+## -0,0 +1 ##\n,
++This is the property 'added'.\n,
+Index: X\n,
+===\n,
+--- X\t(revision 0)\n,
++++ X\t(working copy)\n,
+\n,
+Property changes on: X\n,
+---\n,
+Added: added\n,
+## -0,0 +1 ##\n,
++This is the property 'added'.\n,
+  ]
+
+  svntest.main.file_write(patch_file_path, ''.join(unidiff_patch))
+
+  added_prop_contents = This is the property 'added'.\n
+
+  expected_output = [
+'A %s\n' % os.path.join(wc_dir, 'new'),
+'A %s\n' % os.path.join(wc_dir, 'X'),
+  ]
+
+  expected_disk = svntest.main.greek_state.copy()
+  expected_disk.add({'new': Item(contents=This is the file 'new'\n, 
+ props={'added' : added_prop_contents})})
+  expected_disk.add({'X': Item(props={'added' : added_prop_contents})})
+  expected_status = svntest.actions.get_virginal_state(wc_dir, 1)
+  expected_status.add({'new': Item(status='A ', wc_rev='0')})
+  expected_status.add({'X': Item(status='A ', wc_rev='0')})
+
+  expected_skip = wc.State('', { })
+
+  svntest.actions.run_and_verify_patch(wc_dir, 
os.path.abspath(patch_file_path),
+   expected_output,
+   expected_disk,
+   expected_status,
+   expected_skip,
+   None, # expected err
+   1, # check-props
+   1) # dry-run
+
 
 #Run the tests
 
@@ -2552,6 +2616,7 @@ test_list = [ None,
   patch_with_properties,
   patch_same_twice,
   XFail(patch_dir_properties),
+  XFail(patch_add_path_with_props),
 ]
 
 if __name__ == '__main__':




svn commit: r979654 - /subversion/trunk/subversion/libsvn_client/patch.c

2010-07-27 Thread dannas
Author: dannas
Date: Tue Jul 27 11:56:39 2010
New Revision: 979654

URL: http://svn.apache.org/viewvc?rev=979654view=rev
Log:
Add some doc comments in the patch code.

* subversion/libsvn_client/patch.c
  (prop_patch_target_t): Add doc strings to the fields.
  (patch_target_t): Fix typo in doc string.

Modified:
subversion/trunk/subversion/libsvn_client/patch.c

Modified: subversion/trunk/subversion/libsvn_client/patch.c
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/patch.c?rev=979654r1=979653r2=979654view=diff
==
--- subversion/trunk/subversion/libsvn_client/patch.c (original)
+++ subversion/trunk/subversion/libsvn_client/patch.c Tue Jul 27 11:56:39 2010
@@ -113,8 +113,14 @@ typedef struct target_content_info_t {
 } target_content_info_t;
 
 typedef struct prop_patch_target_t {
+
+  /* The name of the property */
   const char *name;
+
+  /* All the information that is specific to the content of the property. */
   target_content_info_t *content_info;
+
+  /* Path to the temporary file underlying the result stream. */
   const char *patched_path;
 
   /* ### Here we'll add flags telling if the prop was added, deleted,
@@ -192,7 +198,7 @@ typedef struct patch_target_t {
   /* True if the patch changes any of the properties of the target */
   svn_boolean_t has_prop_changes;
 
-  /* All the information that is specifict to the content of the target. */
+  /* All the information that is specific to the content of the target. */
   target_content_info_t *content_info;
 
   /* A hash table of prop_patch_target_t objects keyed by property names. */




svn commit: r979667 - /subversion/trunk/subversion/libsvn_client/patch.c

2010-07-27 Thread dannas
Author: dannas
Date: Tue Jul 27 12:22:21 2010
New Revision: 979667

URL: http://svn.apache.org/viewvc?rev=979667view=rev
Log:
Start recording the parsed diff operation for a property in 
'prop_patch_target_t'.

Previously it's been available in the structure returned from the 
parser but now we're associating it with the property target.

* subversion/libsvn_client/patch.c
  (prop_patch_target_t): Add 'operation' field.
  (init_prop_target): Add new parameter 'operation'.
  (init_patch_target): Fetch the the operation field from the structure 
used by the parser.

Modified:
subversion/trunk/subversion/libsvn_client/patch.c

Modified: subversion/trunk/subversion/libsvn_client/patch.c
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/patch.c?rev=979667r1=979666r2=979667view=diff
==
--- subversion/trunk/subversion/libsvn_client/patch.c (original)
+++ subversion/trunk/subversion/libsvn_client/patch.c Tue Jul 27 12:22:21 2010
@@ -123,6 +123,11 @@ typedef struct prop_patch_target_t {
   /* Path to the temporary file underlying the result stream. */
   const char *patched_path;
 
+  /* Represents the operation performed on the property. It can be added,
+   * deleted or modified. 
+   * ### Should we use flags instead since we're not using all enum values? */
+  svn_diff_operation_kind_t operation;
+
   /* ### Here we'll add flags telling if the prop was added, deleted,
* ### had_rejects, had_local_mods prior to patching and so on. */
 } prop_patch_target_t;
@@ -450,6 +455,7 @@ resolve_target_path(patch_target_t *targ
 static svn_error_t *
 init_prop_target(prop_patch_target_t **prop_target,
  const char *prop_name,
+ svn_diff_operation_kind_t operation,
  svn_stream_t *reject,
  svn_boolean_t remove_tempfiles,
  svn_wc_context_t *wc_ctx,
@@ -476,6 +482,7 @@ init_prop_target(prop_patch_target_t **p
 
   new_prop_target = apr_palloc(result_pool, sizeof(*new_prop_target));
   new_prop_target-name = apr_pstrdup(result_pool, prop_name);
+  new_prop_target-operation = operation;
   new_prop_target-content_info = content_info;
 
   SVN_ERR(svn_wc_prop_get2(value, wc_ctx, local_abspath, prop_name, 
@@ -648,11 +655,13 @@ init_patch_target(patch_target_t **patch
hi = apr_hash_next(hi))
 {
   const char *prop_name = svn__apr_hash_index_key(hi);
+  svn_prop_patch_t *prop_patch = svn__apr_hash_index_val(hi);
   prop_patch_target_t *prop_target;
 
   /* Obtain info about this property */
   SVN_ERR(init_prop_target(prop_target,
prop_name,
+   prop_patch-operation,
content_info-reject,
remove_tempfiles,
wc_ctx, target-local_abspath,




svn commit: r979823 - /subversion/trunk/subversion/tests/cmdline/patch_tests.py

2010-07-27 Thread dannas
Author: dannas
Date: Tue Jul 27 19:36:16 2010
New Revision: 979823

URL: http://svn.apache.org/viewvc?rev=979823view=rev
Log:
Correct typos in patch test for properties.

* subversion/tests/cmdline/patch_tests.py
  (patch_with_properties): Fix typo in a hunk header and use the right 
revision for expected status.
  

Modified:
subversion/trunk/subversion/tests/cmdline/patch_tests.py

Modified: subversion/trunk/subversion/tests/cmdline/patch_tests.py
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/patch_tests.py?rev=979823r1=979822r2=979823view=diff
==
--- subversion/trunk/subversion/tests/cmdline/patch_tests.py (original)
+++ subversion/trunk/subversion/tests/cmdline/patch_tests.py Tue Jul 27 
19:36:16 2010
@@ -2200,7 +2200,7 @@ def patch_with_properties(sbox):
 -This is the property 'modified'.\n,
 +The property 'modified' has changed.\n,
 Added: added\n,
-## -0,0 +1 \n,
+## -0,0 +1 ##\n,
 +This is the property 'added'.\n,
 Deleted: deleted\n,
 ## -1 +0,0 ##\n,
@@ -2220,7 +2220,7 @@ def patch_with_properties(sbox):
   expected_disk.tweak('iota', props={'modified' : modified_prop_contents,
  'added' : added_prop_contents})
   expected_status = svntest.actions.get_virginal_state(wc_dir, 1)
-  expected_status.tweak('iota', status=' M')
+  expected_status.tweak('iota', status=' M', wc_rev='2')
 
   expected_skip = wc.State('', { })
 




svn commit: r979835 - in /subversion/trunk/subversion: libsvn_client/patch.c tests/cmdline/patch_tests.py

2010-07-27 Thread dannas
Author: dannas
Date: Tue Jul 27 20:00:51 2010
New Revision: 979835

URL: http://svn.apache.org/viewvc?rev=979835view=rev
Log:
Start applying property patches to the target.

Note that we're not yet doing proper notifications for properties. 
That will be the next step. Currently 'svn patch' sends out notifications
for affected paths as if they had been subject to text changes only.

Another restriction is that we not yet allow props to be set on the 
wc-root dir.

* subversion/libsvn_client/patch.c
  (install_patched_prop_targets): New.
  (apply_patches): Call install_patched_prop_targets() when we have
property changes.

* subversion/tests/cmdline/patch_tests.py
  (patch_with_properties): Change the 'U' symbol to be in the second 
column as is custom for properties. Before this change the test 
XPassed.

Modified:
subversion/trunk/subversion/libsvn_client/patch.c
subversion/trunk/subversion/tests/cmdline/patch_tests.py

Modified: subversion/trunk/subversion/libsvn_client/patch.c
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/patch.c?rev=979835r1=979834r2=979835view=diff
==
--- subversion/trunk/subversion/libsvn_client/patch.c (original)
+++ subversion/trunk/subversion/libsvn_client/patch.c Tue Jul 27 20:00:51 2010
@@ -2028,6 +2028,91 @@ write_out_rejected_hunks(patch_target_t 
   return SVN_NO_ERROR;
 }
 
+/* Install the patched properties for TARGET. Use client context CTX to
+ * retrieve WC_CTX. If DRY_RUN is TRUE, don't modify the working copy.
+ * Do tempoary allocations in SCRATCH_POOL. */
+static svn_error_t *
+install_patched_prop_targets(patch_target_t *target,
+ svn_client_ctx_t *ctx, svn_boolean_t dry_run,
+ apr_pool_t *scratch_pool)
+{
+  apr_hash_index_t *hi;
+  apr_pool_t *iterpool;
+
+  if (dry_run)
+return SVN_NO_ERROR;
+
+  iterpool = svn_pool_create(scratch_pool);
+
+  for (hi = apr_hash_first(scratch_pool, target-prop_targets);
+   hi;
+   hi = apr_hash_next(hi))
+{
+  prop_patch_target_t *prop_target = svn__apr_hash_index_val(hi); 
+  apr_file_t *file;
+  svn_stream_t *patched_stream;
+  svn_stringbuf_t *line;
+  svn_stringbuf_t *prop_content;
+  const char *eol_str;
+  svn_boolean_t eof;
+
+  svn_pool_clear(iterpool);
+
+  /* For a deleted prop we only set the value to NULL. */
+  if (prop_target-operation == svn_diff_op_deleted)
+{
+  SVN_ERR(svn_wc_prop_set4(ctx-wc_ctx, target-local_abspath,
+   prop_target-name, NULL, 
+   TRUE /* skip_checks */,
+   NULL, NULL,
+   iterpool));
+  break;
+}
+
+  /* A property is usually one line long.
+   * ### Is this the optimal size to allocate? */
+  prop_content = svn_stringbuf_create_ensure(80, scratch_pool);
+
+  /* svn_wc_prop_set4() wants a svn_string_t for input so we need to
+   * open the tmp file for reading again. */
+  SVN_ERR(svn_io_file_open(file, prop_target-patched_path,
+   APR_READ | APR_BINARY, APR_OS_DEFAULT,
+   scratch_pool));
+
+  patched_stream = svn_stream_from_aprfile2(file, FALSE /* disown */,
+iterpool);
+  do
+{
+  SVN_ERR(svn_stream_readline_detect_eol(patched_stream,
+ line, eol_str,
+ eof,
+ iterpool));
+
+  svn_stringbuf_appendstr(prop_content, line);
+
+  if (eol_str)
+svn_stringbuf_appendcstr(prop_content, eol_str);
+}
+  while (! eof);
+
+  svn_stream_close(patched_stream);
+
+  /* ### How should we handle SVN_ERR_ILLEGAL_TARGET and
+   * ### SVN_ERR_BAD_MIME_TYPE? */
+  SVN_ERR(svn_wc_prop_set4(ctx-wc_ctx, target-local_abspath,
+   prop_target-name,
+   svn_string_create_from_buf(prop_content, 
+  iterpool),
+   TRUE /* skip_checks */,
+   NULL, NULL,
+   iterpool));
+}
+
+  svn_pool_destroy(iterpool);
+
+  return SVN_NO_ERROR;
+}
+
 /* Baton for find_existing_children() */
 struct status_baton
 {
@@ -2397,7 +2482,9 @@ apply_patches(void *baton,
iterpool));
 
   if (target-has_prop_changes)
-; /* ### Here we're going to install prop targets */
+SVN_ERR(install_patched_prop_targets(target, btn-ctx, 
+ btn-dry_run

svn commit: r979265 - /subversion/trunk/subversion/libsvn_client/patch.c

2010-07-26 Thread dannas
Author: dannas
Date: Mon Jul 26 12:58:12 2010
New Revision: 979265

URL: http://svn.apache.org/viewvc?rev=979265view=rev
Log:
As a step towards installing property diffs, write out rejected hunks
in a separate function instead of as part of installing text changes.

We do it this way since both text and property hunks should be written 
to the same reject_path.

* subversion/libsvn_client/patch.c
  (install_patched_target): Move the parts dealing with rejected hunks 
from here..
  (write_out_rejected_hunks): ..To here. New.
  (apply_patches): Call write_out_rejected_hunks().

Modified:
subversion/trunk/subversion/libsvn_client/patch.c

Modified: subversion/trunk/subversion/libsvn_client/patch.c
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/patch.c?rev=979265r1=979264r2=979265view=diff
==
--- subversion/trunk/subversion/libsvn_client/patch.c (original)
+++ subversion/trunk/subversion/libsvn_client/patch.c Mon Jul 26 12:58:12 2010
@@ -1953,16 +1953,27 @@ install_patched_target(patch_target_t *t
 }
 }
 
-  /* Write out rejected hunks, if any. */
-  if (! dry_run  ! target-skipped  target-had_rejects)
+  return SVN_NO_ERROR;
+}
+
+/* Write out rejected hunks, if any, to TARGET-REJECT_PATH. If DRY_RUN is
+ * TRUE, don't modify the working copy.  
+ * Do temporary allocations in POOL.
+ */
+static svn_error_t *
+write_out_rejected_hunks(patch_target_t *target,
+ svn_boolean_t dry_run,
+ apr_pool_t *pool)
+{
+  if (! dry_run  target-had_rejects)
 {
+  /* Write out rejected hunks, if any. */
   SVN_ERR(svn_io_copy_file(target-reject_path,
apr_psprintf(pool, %s.svnpatch.rej,
-target-local_abspath),
+   target-local_abspath),
FALSE, pool));
   /* ### TODO mark file as conflicted. */
 }
-
   return SVN_NO_ERROR;
 }
 
@@ -2328,9 +2339,14 @@ apply_patches(void *baton,
  patch_target_info_t *) = target_info;
 
   if (! target-skipped)
-SVN_ERR(install_patched_target(target, btn-abs_wc_path,
-   btn-ctx, btn-dry_run,
-   iterpool));
+{
+  SVN_ERR(install_patched_target(target, btn-abs_wc_path,
+ btn-ctx, btn-dry_run,
+ iterpool));
+
+  SVN_ERR(write_out_rejected_hunks(target, btn-dry_run,
+   iterpool));
+}
   SVN_ERR(send_patch_notification(target, btn-ctx, iterpool));
 }
 




svn commit: r979285 - /subversion/trunk/subversion/libsvn_client/patch.c

2010-07-26 Thread dannas
Author: dannas
Date: Mon Jul 26 14:03:28 2010
New Revision: 979285

URL: http://svn.apache.org/viewvc?rev=979285view=rev
Log:
Allow a dir to be patch target if the patch only deals with properties.

* subversion/libsvn_client/patch.c
  (patch_target_t): Add fields 'has_text_changes' and 'has_prop_changes'
to be able to decide if we should install tmp files for text and/or
props. It's needed since we may have a dir as a target for a
property. If we'd try to copy the tmp file for the text changes onto
a dir we get an error.
  (resolve_target_path): Add new parameter 'prop_changes_only' to help
us determine the case when a dir is a valid target.
  (init_patch_target): Update caller of resolve_target_path().
  (apply_hunk): Record if we've done any changes to props or text
content.
  (apply_patches): Only call install_patched_target() if we have changed
the text content.


Modified:
subversion/trunk/subversion/libsvn_client/patch.c

Modified: subversion/trunk/subversion/libsvn_client/patch.c
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/patch.c?rev=979285r1=979284r2=979285view=diff
==
--- subversion/trunk/subversion/libsvn_client/patch.c (original)
+++ subversion/trunk/subversion/libsvn_client/patch.c Mon Jul 26 14:03:28 2010
@@ -186,6 +186,12 @@ typedef struct patch_target_t {
   /* True if the target has the executable bit set. */
   svn_boolean_t executable;
 
+  /* True if the patch changes the text of the target */
+  svn_boolean_t has_text_changes;
+
+  /* True if the patch changes any of the properties of the target */
+  svn_boolean_t has_prop_changes;
+
   /* All the information that is specifict to the content of the target. */
   target_content_info_t *content_info;
 
@@ -305,6 +311,8 @@ obtain_eol_and_keywords_for_file(apr_has
  * Indicate in TARGET-SKIPPED whether the target should be skipped.
  * STRIP_COUNT specifies the number of leading path components
  * which should be stripped from target paths in the patch.
+ * PROP_CHANGES_ONLY is used for determining if the target path is allowed
+ * to be a dir.
  * Use RESULT_POOL for allocations of fields in TARGET.
  * Use SCRATCH_POOL for all other allocations. */
 static svn_error_t *
@@ -312,6 +320,7 @@ resolve_target_path(patch_target_t *targ
 const char *path_from_patchfile,
 const char *local_abspath,
 int strip_count,
+svn_boolean_t prop_changes_only,
 svn_wc_context_t *wc_ctx,
 apr_pool_t *result_pool,
 apr_pool_t *scratch_pool)
@@ -341,6 +350,8 @@ resolve_target_path(patch_target_t *targ
 {
   target-local_relpath = svn_dirent_is_child(local_abspath, stripped_path,
   result_pool);
+
+  /* ### We need to allow setting props on the wc root dir */
   if (! target-local_relpath)
 {
   /* The target path is either outside of the working copy
@@ -403,7 +414,11 @@ resolve_target_path(patch_target_t *targ
 }
   SVN_ERR(svn_wc_read_kind(target-db_kind, wc_ctx, target-local_abspath,
FALSE, scratch_pool));
-  if (target-db_kind == svn_node_dir)
+
+  /* If the target is a version directory not missing from disk,
+   * and there are only property changes in the patch, we accept
+   * a directory target. Else, we skip directories. */
+  if (target-db_kind == svn_node_dir  ! prop_changes_only)
 {
   /* ### We cannot yet replace a locally deleted dir with a file,
* ### but some day we might want to allow it. */
@@ -502,6 +517,26 @@ init_patch_target(patch_target_t **patch
 {
   patch_target_t *target;
   target_content_info_t *content_info; 
+  svn_boolean_t has_prop_changes = FALSE;
+  svn_boolean_t prop_changes_only = FALSE;
+
+  {
+apr_hash_index_t *hi;
+
+/* ### Should we use an iterpool here? */
+for (hi = apr_hash_first(scratch_pool, patch-prop_patches);
+ hi;
+ hi = apr_hash_next(hi))
+  {
+svn_prop_patch_t *prop_patch = svn__apr_hash_index_val(hi); 
+if (! has_prop_changes)
+  has_prop_changes = prop_patch-hunks-nelts  0;
+else
+  break;
+  }
+  }
+
+  prop_changes_only = has_prop_changes  patch-hunks-nelts == 0;
 
   content_info = apr_pcalloc(result_pool, sizeof(*content_info));
 
@@ -525,8 +560,8 @@ init_patch_target(patch_target_t **patch
   target-pool = result_pool;
 
   SVN_ERR(resolve_target_path(target, patch-new_filename,
-  base_dir, strip_count, wc_ctx,
-  result_pool, scratch_pool));
+  base_dir, strip_count, prop_changes_only,
+  wc_ctx, result_pool, scratch_pool));
   if (! target-skipped)
 {
   const char *diff_header;
@@ -1350,6 +1385,11

svn commit: r979043 - /subversion/trunk/subversion/tests/libsvn_diff/parse-diff-test.c

2010-07-25 Thread dannas
Author: dannas
Date: Sun Jul 25 14:47:24 2010
New Revision: 979043

URL: http://svn.apache.org/viewvc?rev=979043view=rev
Log:
Add test for parsing property diffs with diff symbols in the hunk
bodies, i.e. having a hunk header or diff header as content of a
hunk.

* subversion/tests/libsvn_diff/parse-diff-test.c
  (diff_symbols_in_prop_unidiff): New unidiff data.
  (test_parse_diff_symbols_in_prp_unidiff): New
  (test_funcs): Add new test.

Modified:
subversion/trunk/subversion/tests/libsvn_diff/parse-diff-test.c

Modified: subversion/trunk/subversion/tests/libsvn_diff/parse-diff-test.c
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/libsvn_diff/parse-diff-test.c?rev=979043r1=979042r2=979043view=diff
==
--- subversion/trunk/subversion/tests/libsvn_diff/parse-diff-test.c (original)
+++ subversion/trunk/subversion/tests/libsvn_diff/parse-diff-test.c Sun Jul 25 
14:47:24 2010
@@ -179,6 +179,42 @@ static const char *bad_git_diff_header =
   ## -0,0 +1 ##   NL
   +value  NL;
 
+  /* A unidiff containing diff symbols in the body of the hunks. */
+  static const char *diff_symbols_in_prop_unidiff =
+  Index: iota NL
+  === NL
+  --- iotaNL
+  +++ iotaNL
+  NL
+  Property changes on: iota   NL
+  ___ NL
+  Added: prop_add NL
+  ## -0,0 +1,3 ## NL
+  +Added: bogus_prop  NL
+  +## -0,0 +20 ## NL
+  +@@ -1,2 +0,0 @@NL
+  Deleted: prop_del   NL
+  ## -1,2 +0,0 ##  NL
+   iota   NL
+  -+++ iota   NL
+  Modified: non-existent  NL
+  blah, just noise - no valid hunk header NL
+  Modified: prop_mod  NL
+  ## -1,4 +1,4 ## NL
+  -## -1,2 +1,2 ##NL
+  +## -1,3 +1,3 ##NL
+   ## -1,5 -0,0 ##NL
+   @@ -1,5 -0,0 @@NL
+   Modified: prop_mod NL
+  ## -10,4 +10,4 ##   NL
+   contextNL
+   contextNL
+   contextNL
+  -## -0,0 +1 ##  NL
+  +## -1,2 +1,4 ##NL
+  NL;
+
+
 /* Create a PATCH_FILE with name FNAME containing the contents of DIFF. */
 static svn_error_t *
 create_patch_file(apr_file_t **patch_file, const char *fname,
@@ -651,6 +687,106 @@ test_parse_property_and_text_diff(apr_po
   return SVN_NO_ERROR;
 }
 
+static svn_error_t *
+test_parse_diff_symbols_in_prop_unidiff(apr_pool_t *pool)
+{
+  svn_patch_t *patch;
+  apr_file_t *patch_file;
+  svn_prop_patch_t *prop_patch;
+  svn_hunk_t *hunk;
+  apr_array_header_t *hunks;
+  const char *fname = test_parse_diff_symbols_in_prop_unidiff.patch;
+
+  SVN_ERR(create_patch_file(patch_file, fname, diff_symbols_in_prop_unidiff,
+pool));
+
+  SVN_ERR(svn_diff_parse_next_patch(patch, patch_file, 
+FALSE, /* reverse */
+FALSE, /* ignore_whitespace */ 
+pool, pool));
+  SVN_TEST_ASSERT(patch);
+  SVN_TEST_ASSERT(! strcmp(patch-old_filename, iota));
+  SVN_TEST_ASSERT(! strcmp(patch-new_filename, iota));
+  SVN_TEST_ASSERT(patch-hunks-nelts == 0);
+  SVN_TEST_ASSERT(apr_hash_count(patch-prop_patches) == 3);
+
+  /* Check the added property */
+  prop_patch = apr_hash_get(patch-prop_patches, prop_add,
+APR_HASH_KEY_STRING);
+  SVN_TEST_ASSERT

svn commit: r979046 - /subversion/trunk/subversion/tests/libsvn_diff/parse-diff-test.c

2010-07-25 Thread dannas
Author: dannas
Date: Sun Jul 25 15:00:20 2010
New Revision: 979046

URL: http://svn.apache.org/viewvc?rev=979046view=rev
Log:
Follow-up to r979043. Remove an extra whitespace.

* subversion/tests/libsvn_diff/parse-diff-test.c
  (diff_symbols_in_prop_unidiff): Remove an extra whitespace.

Modified:
subversion/trunk/subversion/tests/libsvn_diff/parse-diff-test.c

Modified: subversion/trunk/subversion/tests/libsvn_diff/parse-diff-test.c
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/libsvn_diff/parse-diff-test.c?rev=979046r1=979045r2=979046view=diff
==
--- subversion/trunk/subversion/tests/libsvn_diff/parse-diff-test.c (original)
+++ subversion/trunk/subversion/tests/libsvn_diff/parse-diff-test.c Sun Jul 25 
15:00:20 2010
@@ -194,7 +194,7 @@ static const char *bad_git_diff_header =
   +## -0,0 +20 ## NL
   +@@ -1,2 +0,0 @@NL
   Deleted: prop_del   NL
-  ## -1,2 +0,0 ##  NL
+  ## -1,2 +0,0 ## NL
    iota   NL
   -+++ iota   NL
   Modified: non-existent  NL




svn commit: r979055 - /subversion/trunk/subversion/tests/cmdline/patch_tests.py

2010-07-25 Thread dannas
Author: dannas
Date: Sun Jul 25 15:58:53 2010
New Revision: 979055

URL: http://svn.apache.org/viewvc?rev=979055view=rev
Log:
Tweak an XFailing test for patching properties to use the wc-root dir
as one of the targets.

The patch code currently always skips the target if it's the wc-root dir,
so I'm tweaking this test to make sure we don't forget to allow the wc-root
as target for a property patch.

* subversion/tests/cmdline/patch_tests.py
  (patch_dir_properties): Use the wc root dir instead of 'A' as
target for some properties. 

Modified:
subversion/trunk/subversion/tests/cmdline/patch_tests.py

Modified: subversion/trunk/subversion/tests/cmdline/patch_tests.py
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/patch_tests.py?rev=979055r1=979054r2=979055view=diff
==
--- subversion/trunk/subversion/tests/cmdline/patch_tests.py (original)
+++ subversion/trunk/subversion/tests/cmdline/patch_tests.py Sun Jul 25 
15:58:53 2010
@@ -2436,7 +2436,6 @@ def patch_dir_properties(sbox):
   wc_dir = sbox.wc_dir
 
   patch_file_path = make_patch_path(sbox)
-  A_path = os.path.join(wc_dir, 'A')
   B_path = os.path.join(wc_dir, 'A', 'B')
 
   modified_prop_contents = This is the property 'modified'.\n
@@ -2444,27 +2443,27 @@ def patch_dir_properties(sbox):
 
   # Set the properties
   svntest.main.run_svn(None, 'propset', 'modified', modified_prop_contents,
-   A_path)
+   wc_dir)
   svntest.main.run_svn(None, 'propset', 'deleted', deleted_prop_contents,
B_path)
   expected_output = svntest.wc.State(wc_dir, {
-  'A': Item(verb='Sending'),
+  '.': Item(verb='Sending'),
   'A/B': Item(verb='Sending'),
   })
   expected_status = svntest.actions.get_virginal_state(wc_dir, 1)
-  expected_status.tweak('A', wc_rev=2)
+  expected_status.tweak('', wc_rev=2)
   expected_status.tweak('A/B', wc_rev=2)
   svntest.actions.run_and_verify_commit(wc_dir, expected_output,
 expected_status, None, wc_dir)
   # Apply patch
 
   unidiff_patch = [
-Index: A\n,
+Index: .\n,
 ===\n,
---- A\t(revision 1)\n,
-+++ A\t(working copy)\n,
+--- .\t(revision 1)\n,
++++ .\t(working copy)\n,
 \n,
-Property changes on: A\n,
+Property changes on: .\n,
 ---\n,
 Modified: modified\n,
 ## -1 +1 ##\n,
@@ -2499,7 +2498,7 @@ def patch_dir_properties(sbox):
   ### on a dir) is still subject to change. We might just want to bail out 
   ### directly instead of catching the error and use the notify mechanism.
   expected_output = [
-' U%s\n' % os.path.join(wc_dir, 'A'),
+' U%s\n' % wc_dir,
 ' U%s\n' % os.path.join(wc_dir, 'A', 'B'),
 'Skipped missing target \'svn:executable\' on (\'%s\')' % B_path,
 'Summary of conflicts:\n',
@@ -2507,11 +2506,13 @@ def patch_dir_properties(sbox):
   ]
 
   expected_disk = svntest.main.greek_state.copy()
-  expected_disk.tweak('A', props={'modified' : modified_prop_contents,
-  'svn:ignore' : ignore_prop_contents})
+  expected_disk.add({
+'' : Item(props={'modified' : modified_prop_contents,
+ 'svn:ignore' : ignore_prop_contents})
+})
   expected_disk.tweak('A/B', props={})
   expected_status = svntest.actions.get_virginal_state(wc_dir, 1)
-  expected_status.tweak('A', status=' M')
+  expected_status.tweak('', status=' M')
   expected_status.tweak('A/B', status=' M')
 
   expected_skip = wc.State('', { })




svn commit: r978821 - /subversion/trunk/subversion/tests/cmdline/patch_tests.py

2010-07-24 Thread dannas
Author: dannas
Date: Sat Jul 24 08:05:26 2010
New Revision: 978821

URL: http://svn.apache.org/viewvc?rev=978821view=rev
Log:
Adjust test for patching properties to include deleting and adding 
properties.

* subversion/tests/cmdline/patch_tests.py
  (patch_with_properties): Include a deleted and added property in the
patch to be tested. At the same time fix hunk header for property 
modified.

Modified:
subversion/trunk/subversion/tests/cmdline/patch_tests.py

Modified: subversion/trunk/subversion/tests/cmdline/patch_tests.py
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/patch_tests.py?rev=978821r1=978820r2=978821view=diff
==
--- subversion/trunk/subversion/tests/cmdline/patch_tests.py (original)
+++ subversion/trunk/subversion/tests/cmdline/patch_tests.py Sat Jul 24 
08:05:26 2010
@@ -2162,7 +2162,6 @@ def patch_no_eol_at_eof(sbox):
1, # check-props
1) # dry-run
 
-### We need to add deletes and adds of properties to this test.
 def patch_with_properties(sbox):
   patch with properties
 
@@ -2172,10 +2171,13 @@ def patch_with_properties(sbox):
   patch_file_path = make_patch_path(sbox)
   iota_path = os.path.join(wc_dir, 'iota')
 
-  iota_prop_contents = This is the property 'iota_prop'.\n
+  modified_prop_contents = This is the property 'modified'.\n
+  deleted_prop_contents = This is the property 'deleted'.\n
 
-  # Set iota contents
-  svntest.main.run_svn(None, 'propset', 'prop', iota_prop_contents,
+  # Set iota prop contents
+  svntest.main.run_svn(None, 'propset', 'modified', modified_prop_contents,
+   iota_path)
+  svntest.main.run_svn(None, 'propset', 'deleted', deleted_prop_contents,
iota_path)
   expected_output = svntest.wc.State(wc_dir, {
   'iota': Item(verb='Sending'),
@@ -2193,22 +2195,30 @@ def patch_with_properties(sbox):
 +++ iota\t(working copy)\n,
 Property changes on: iota\n,
 ---\n,
-Modified: prop\n,
-## -1 +1 \n,
--This is the property 'iota_prop'.\n,
-+This is the property 'prop'.\n,
+Modified: modified\n,
+## -1 +1 ##\n,
+-This is the property 'modified'.\n,
++The property 'modified' has changed.\n,
+Added: added\n,
+## -0,0 +1 \n,
++This is the property 'added'.\n,
+Deleted: deleted\n,
+## -1 +0,0 ##\n,
+-This is the property 'deleted'.\n,
   ]
 
   svntest.main.file_write(patch_file_path, ''.join(unidiff_patch))
 
-  iota_prop_contents = This is the property 'prop'.\n
+  modified_prop_contents = The property 'modified' has changed.\n
+  added_prop_contents = This is the property 'added'.\n
 
   expected_output = [
 'U %s\n' % os.path.join(wc_dir, 'iota'),
   ]
 
   expected_disk = svntest.main.greek_state.copy()
-  expected_disk.tweak('iota', props={'prop' : iota_prop_contents})
+  expected_disk.tweak('iota', props={'modified' : modified_prop_contents,
+ 'added' : added_prop_contents})
   expected_status = svntest.actions.get_virginal_state(wc_dir, 1)
   expected_status.tweak('iota', status=' M')
 




svn commit: r978830 - /subversion/trunk/subversion/tests/cmdline/patch_tests.py

2010-07-24 Thread dannas
Author: dannas
Date: Sat Jul 24 08:51:33 2010
New Revision: 978830

URL: http://svn.apache.org/viewvc?rev=978830view=rev
Log:
Add a XFailing test for running 'svn patch' with property diffs against 
dirs.

* subversion/tests/cmdline/patch_tests.py
  (patch_dir_properties): New. Note that the output for illegal targets
(i.e. setting svn:executable on a dir) is still subject to change.
  (tests_list): Add the new test marked as XFail.

Modified:
subversion/trunk/subversion/tests/cmdline/patch_tests.py

Modified: subversion/trunk/subversion/tests/cmdline/patch_tests.py
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/patch_tests.py?rev=978830r1=978829r2=978830view=diff
==
--- subversion/trunk/subversion/tests/cmdline/patch_tests.py (original)
+++ subversion/trunk/subversion/tests/cmdline/patch_tests.py Sat Jul 24 
08:51:33 2010
@@ -2429,6 +2429,102 @@ def patch_same_twice(sbox):
1, # check-props
1) # dry-run
 
+def patch_dir_properties(sbox):
+  patch with dir properties
+
+  sbox.build()
+  wc_dir = sbox.wc_dir
+
+  patch_file_path = make_patch_path(sbox)
+  A_path = os.path.join(wc_dir, 'A')
+  B_path = os.path.join(wc_dir, 'A', 'B')
+
+  modified_prop_contents = This is the property 'modified'.\n
+  deleted_prop_contents = This is the property 'deleted'.\n
+
+  # Set the properties
+  svntest.main.run_svn(None, 'propset', 'modified', modified_prop_contents,
+   A_path)
+  svntest.main.run_svn(None, 'propset', 'deleted', deleted_prop_contents,
+   B_path)
+  expected_output = svntest.wc.State(wc_dir, {
+  'A': Item(verb='Sending'),
+  'A/B': Item(verb='Sending'),
+  })
+  expected_status = svntest.actions.get_virginal_state(wc_dir, 1)
+  expected_status.tweak('A', wc_rev=2)
+  expected_status.tweak('A/B', wc_rev=2)
+  svntest.actions.run_and_verify_commit(wc_dir, expected_output,
+expected_status, None, wc_dir)
+  # Apply patch
+
+  unidiff_patch = [
+Index: A\n,
+===\n,
+--- A\t(revision 1)\n,
++++ A\t(working copy)\n,
+\n,
+Property changes on: A\n,
+---\n,
+Modified: modified\n,
+## -1 +1 ##\n,
+-This is the property 'modified'.\n,
++The property 'modified' has changed.\n,
+Added: svn:ignore\n,
+## -0,0 +1,3 ##\n,
++*.o\n,
++.libs\n,
++*.lo\n,
+Index: A/B\n,
+===\n,
+--- A/B\t(revision 1)\n,
++++ A/B\t(working copy)\n,
+\n,
+Property changes on: A/B\n,
+---\n,
+Deleted: deleted\n,
+## -1 +0,0 ##\n,
+-This is the property 'deleted'.\n,
+Added: svn:executable\n,
+## -0,0 +1 ##\n,
++*\n,
+  ]
+
+  svntest.main.file_write(patch_file_path, ''.join(unidiff_patch))
+
+  modified_prop_contents = The property 'modified' has changed.\n
+  ignore_prop_contents = *.o\n.libs\n*.lo\n
+
+  ### The output for properties set on illegal targets (i.e. svn:excutable
+  ### on a dir) is still subject to change. We might just want to bail out 
+  ### directly instead of catching the error and use the notify mechanism.
+  expected_output = [
+' U%s\n' % os.path.join(wc_dir, 'A'),
+' U%s\n' % os.path.join(wc_dir, 'A', 'B'),
+'Skipped missing target \'svn:executable\' on (\'%s\')' % B_path,
+'Summary of conflicts:\n',
+'  Skipped paths: 1\n',
+  ]
+
+  expected_disk = svntest.main.greek_state.copy()
+  expected_disk.tweak('A', props={'modified' : modified_prop_contents,
+  'svn:ignore' : ignore_prop_contents})
+  expected_disk.tweak('A/B', props={})
+  expected_status = svntest.actions.get_virginal_state(wc_dir, 1)
+  expected_status.tweak('A', status=' M')
+  expected_status.tweak('A/B', status=' M')
+
+  expected_skip = wc.State('', { })
+
+  svntest.actions.run_and_verify_patch(wc_dir, 
os.path.abspath(patch_file_path),
+   expected_output,
+   expected_disk,
+   expected_status,
+   expected_skip,
+   None, # expected err
+   1, # check-props
+   1) # dry-run
+
 
 #Run the tests
 
@@ -2454,6 +2550,7 @@ test_list = [ None,
   patch_no_eol_at_eof,
   XFail(patch_with_properties),
   patch_same_twice,
+  XFail(patch_dir_properties

svn commit: r978856 - /subversion/trunk/subversion/tests/cmdline/diff_tests.py

2010-07-24 Thread dannas
Author: dannas
Date: Sat Jul 24 11:55:17 2010
New Revision: 978856

URL: http://svn.apache.org/viewvc?rev=978856view=rev
Log:
Add XFailing test for a property diff that has missing intermediate 
context lines.

Runnning:
  diff -u (svn pg prop i...@base) (svn pg prop iota)
gives the right result, e.g. all context lines that should be there are
there and the hunk header offsets are right.

* subversion/tests/cmdline/diff_tests.py
  (diff_prop_missing_context): New. 
  (tests_list): Add the new test.

Modified:
subversion/trunk/subversion/tests/cmdline/diff_tests.py

Modified: subversion/trunk/subversion/tests/cmdline/diff_tests.py
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/diff_tests.py?rev=978856r1=978855r2=978856view=diff
==
--- subversion/trunk/subversion/tests/cmdline/diff_tests.py (original)
+++ subversion/trunk/subversion/tests/cmdline/diff_tests.py Sat Jul 24 11:55:17 
2010
@@ -3367,6 +3367,72 @@ def diff_git_format_url_url(sbox):
  '--old', repo_url + '@1', '--new',
  repo_url + '@2')
 
+def diff_prop_missing_context(sbox):
+  diff for property has missing context
+  sbox.build()
+  wc_dir = sbox.wc_dir
+
+  iota_path = os.path.join(wc_dir, 'iota')
+  prop_val = .join([
+   One line\n,
+   Another line\n,
+   \n,
+   $ email EOT\n,
+mat...@docs.uu.se\n,
+Something strange @ my place\n,
+EOT\n,
+   \n,
+   to a shell, will produce the output\n,
+   \n,
+ ])
+  svntest.main.run_svn(None,
+   propset, prop, prop_val, iota_path)
+
+  expected_output = svntest.wc.State(wc_dir, {
+  'iota': Item(verb='Sending'),
+  })
+  expected_status = svntest.actions.get_virginal_state(wc_dir, 1)
+  expected_status.tweak('iota', wc_rev=2)
+  svntest.actions.run_and_verify_commit(wc_dir, expected_output,
+expected_status, None, wc_dir)
+
+  prop_val = .join([\n,
+   $ email EOT\n,
+mat...@docs.uu.se\n,
+Something strange @ my place\n,
+EOT\n,
+   \n,
+   \n,
+ ])
+  svntest.main.run_svn(None,
+   propset, prop, prop_val, iota_path)
+  expected_output = [
+Index: iota\n,
+===\n,
+--- iota\t(revision 2)\n,
++++ iota\t(working copy)\n,
+\n,
+Property changes on: iota\n,
+___\n,
+Modified: prop\n,
+## -1,10 +1,7 ##\n,
+-One line\n,
+-Another line\n,
+\n, 
+$ email EOT\n,
+ mat...@docs.uu.se\n,
+ Something strange @ my place\n,
+ EOT\n,
+\n,
+-to a shell, will produce the output\n,
+\n,
+\n,
+  ]
+
+  svntest.actions.run_and_verify_svn(None, expected_output, [],
+ 'diff', iota_path)
+
+
 
 #Run the tests
 
@@ -3426,6 +3492,7 @@ test_list = [ None,
   diff_git_format_wc_wc,
   diff_git_format_url_wc,
   diff_git_format_url_url,
+  XFail(diff_prop_missing_context),
   ]
 
 if __name__ == '__main__':




svn commit: r967020 - /subversion/trunk/subversion/libsvn_client/patch.c

2010-07-23 Thread dannas
Author: dannas
Date: Fri Jul 23 10:19:22 2010
New Revision: 967020

URL: http://svn.apache.org/viewvc?rev=967020view=rev
Log:
Follow-up to r965773. Update a doc string.

* subversion/libsvn_client/patch.c
  (resolve_target_path): Remove sentence saying we obtain eols and 
keywords. Those parts were moved to init_patch_target() so
that everything related to text content will be initialized in 
one place.

Modified:
subversion/trunk/subversion/libsvn_client/patch.c

Modified: subversion/trunk/subversion/libsvn_client/patch.c
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/patch.c?rev=967020r1=967019r2=967020view=diff
==
--- subversion/trunk/subversion/libsvn_client/patch.c (original)
+++ subversion/trunk/subversion/libsvn_client/patch.c Fri Jul 23 10:19:22 2010
@@ -300,8 +300,6 @@ obtain_eol_and_keywords_for_file(apr_has
  * Indicate in TARGET-SKIPPED whether the target should be skipped.
  * STRIP_COUNT specifies the number of leading path components
  * which should be stripped from target paths in the patch.
- * If the path is not skipped also obtain eol-style and keywords
- * information and store this in *TARGET.
  * Use RESULT_POOL for allocations of fields in TARGET.
  * Use SCRATCH_POOL for all other allocations. */
 static svn_error_t *




svn commit: r967038 - /subversion/trunk/subversion/libsvn_client/patch.c

2010-07-23 Thread dannas
Author: dannas
Date: Fri Jul 23 10:55:15 2010
New Revision: 967038

URL: http://svn.apache.org/viewvc?rev=967038view=rev
Log:
Adjust a doc string.

* subversion/libsvn_client/patch.c
  (init_patch_target): Document that we use PATCH_TARGET-SKIPPED as an
  indicator for a patch that should not be applied,instead of as 
  previously setting PATCH_TARGET to NULL.


Modified:
subversion/trunk/subversion/libsvn_client/patch.c

Modified: subversion/trunk/subversion/libsvn_client/patch.c
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/patch.c?rev=967038r1=967037r2=967038view=diff
==
--- subversion/trunk/subversion/libsvn_client/patch.c (original)
+++ subversion/trunk/subversion/libsvn_client/patch.c Fri Jul 23 10:55:15 2010
@@ -474,8 +474,10 @@ init_prop_content_info(target_content_in
  * described by PATCH. Use working copy context WC_CTX.
  * STRIP_COUNT specifies the number of leading path components
  * which should be stripped from target paths in the patch.
- * Upon success, allocate the patch target structure in RESULT_POOL.
- * Else, set *target to NULL.
+ * The patch target structure is allocated in RESULT_POOL, but if the target
+ * should be skipped, PATCH_TARGET-SKIPPED is set and the target should be
+ * treated as not fully initialized, e.g. the caller should not not do any
+ * further operations on the target if it is marked to be skipped.
  * REMOVE_TEMPFILES as in svn_client_patch().
  * Use SCRATCH_POOL for all other allocations. */
 static svn_error_t *




svn commit: r966192 - /subversion/trunk/subversion/libsvn_client/patch.c

2010-07-21 Thread dannas
Author: dannas
Date: Wed Jul 21 11:52:26 2010
New Revision: 966192

URL: http://svn.apache.org/viewvc?rev=966192view=rev
Log:
Only create a target stream for a property if the property exists.

* subversion/libsvn_client/patch.c
  (init_prop_content_info): Only create a target stream if the property
exists.
  (apply_one_patch): Check that the target stream is not NULL before
closing it.

Modified:
subversion/trunk/subversion/libsvn_client/patch.c

Modified: subversion/trunk/subversion/libsvn_client/patch.c
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/patch.c?rev=966192r1=966191r2=966192view=diff
==
--- subversion/trunk/subversion/libsvn_client/patch.c (original)
+++ subversion/trunk/subversion/libsvn_client/patch.c Wed Jul 21 11:52:26 2010
@@ -449,9 +449,13 @@ init_prop_content_info(target_content_in
   SVN_ERR(svn_wc_prop_get2(value, wc_ctx, local_abspath, prop_name, 
result_pool, scratch_pool));
 
-  /* We assume that a property is small enough to be kept in memory during
-   * the patch process. */
-  content_info-stream = svn_stream_from_string(value, result_pool);
+  if (value)
+{
+  /* We assume that a property is small enough to be kept in memory during
+   * the patch process. */
+  content_info-stream = svn_stream_from_string(value,
+result_pool);
+}
 
   /* Create a temporary file to write the patched result to. For properties,
* we don't have to worrry about different eol-style. */
@@ -1525,7 +1529,13 @@ apply_one_patch(patch_target_t **patch_t
hi = apr_hash_next(hi))
 {
   prop_content_info = svn__apr_hash_index_val(hi);
-  svn_stream_close(prop_content_info-stream);
+
+  /* ### If the prop did not exist pre-patching we'll not have a
+   * ### stream to read from. Find a better way to store info on
+   * ### the existence of the target prop. */
+  if (prop_content_info-stream)
+svn_stream_close(prop_content_info-stream);
+
   svn_stream_close(prop_content_info-patched);
 }
 




svn commit: r966210 - /subversion/trunk/subversion/bindings/javahl/tests/org/tigris/subversion/javahl/BasicTests.java

2010-07-21 Thread dannas
Author: dannas
Date: Wed Jul 21 12:42:28 2010
New Revision: 966210

URL: http://svn.apache.org/viewvc?rev=966210view=rev
Log:
Follow-up to r965520. Fix a failure in the javahl-compat tests in the same way
as was done for the org.apache tests.

Update a javahl test to always display a diff header, even if we just have
property changes.

 * subversion/bindings/javahl/tests/org/tigris/subversion/javahl/BasicTests.java
   (testDiff): Add diff headers to the expected diff output.


Modified:

subversion/trunk/subversion/bindings/javahl/tests/org/tigris/subversion/javahl/BasicTests.java

Modified: 
subversion/trunk/subversion/bindings/javahl/tests/org/tigris/subversion/javahl/BasicTests.java
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/bindings/javahl/tests/org/tigris/subversion/javahl/BasicTests.java?rev=966210r1=966209r2=966210view=diff
==
--- 
subversion/trunk/subversion/bindings/javahl/tests/org/tigris/subversion/javahl/BasicTests.java
 (original)
+++ 
subversion/trunk/subversion/bindings/javahl/tests/org/tigris/subversion/javahl/BasicTests.java
 Wed Jul 21 12:42:28 2010
@@ -2738,7 +2738,10 @@ public class BasicTests extends SVNTests
 String aPath = fileToSVNPath(new File(thisTest.getWCPath() + /A),
  false);
 
-expectedDiffOutput = NL + Property changes on: A + NL +
+expectedDiffOutput = Index: A + NL + sepLine +
+--- A\t(revision 1) + NL +
++++ A\t(working copy) + NL +
+NL + Property changes on: A + NL +
 underSepLine +
 Added: testprop + NL +
 ## -0,0 +1 ## + NL +
@@ -2753,7 +2756,10 @@ public class BasicTests extends SVNTests
  expectedDiffOutput, diffOutput);
 
 // Test diff where relativeToDir and path are the same.
-expectedDiffOutput = NL + Property changes on: . + NL +
+expectedDiffOutput = Index: . + NL + sepLine +
+--- .\t(revision 1) + NL +
++++ .\t(working copy) + NL +
+NL + Property changes on: . + NL +
 underSepLine +
 Added: testprop + NL +
 ## -0,0 +1 ## + NL +




svn commit: r966226 - /subversion/trunk/subversion/libsvn_client/patch.c

2010-07-21 Thread dannas
Author: dannas
Date: Wed Jul 21 13:46:06 2010
New Revision: 966226

URL: http://svn.apache.org/viewvc?rev=966226view=rev
Log:
Start matching property hunks.

With this change, we can handle matching of modified and deleted 
properties but we cannot yet handle added props. (The current code
for handling added files is not generic enough to apply for props).

Note that we do matching but none of the other steps necceseary for
installing a property patch.

* subversion/libsvn_client/patch.c
  (get_hunk_info): Add new parameter 'is_prop_hunk' for determining
if match_new_file() should be called. The idea is that we should
be able to handle matching of new props as well in the future.
Make the apply step more generic by checking if we have a target
stream instead of as previously if our target was a file.
  (apply_one_patch): Match property hunks for each property in the
same manner as is done for text hunks.

Modified:
subversion/trunk/subversion/libsvn_client/patch.c

Modified: subversion/trunk/subversion/libsvn_client/patch.c
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/patch.c?rev=966226r1=966225r2=966226view=diff
==
--- subversion/trunk/subversion/libsvn_client/patch.c (original)
+++ subversion/trunk/subversion/libsvn_client/patch.c Wed Jul 21 13:46:06 2010
@@ -1002,6 +1002,7 @@ get_hunk_info(hunk_info_t **hi, patch_ta
   target_content_info_t *content_info,
   const svn_hunk_t *hunk, int fuzz, 
   svn_boolean_t ignore_whitespace,
+  svn_boolean_t is_prop_hunk,
   svn_cancel_func_t cancel_func, void *cancel_baton,
   apr_pool_t *result_pool, apr_pool_t *scratch_pool)
 {
@@ -1016,8 +1017,11 @@ get_hunk_info(hunk_info_t **hi, patch_ta
* a new file. Don't bother matching hunks in that case, since
* the hunk applies at line 1. If the file already exists, the hunk
* is rejected, unless the file is versioned and its content matches
-   * the file the patch wants to create. */
-  if (original_start == 0)
+   * the file the patch wants to create. 
+   *
+   * ### We need to be able to apply this logic to property hunks that wants
+   * ### to create a new property. Currently we just ignore added hunks. */
+  if (original_start == 0  ! is_prop_hunk)
 {
   if (target-kind_on_disk == svn_node_file)
 {
@@ -1041,7 +1045,11 @@ get_hunk_info(hunk_info_t **hi, patch_ta
   else
 matched_line = 1;
 }
-  else if (original_start  0  target-kind_on_disk == svn_node_file)
+  /* ### We previously checked for target-kind_on_disk == svn_node_file
+   * ### here. But that wasn't generic enough to cope with properties. How
+   * ### better describe that content_info-stream is only set if we have an
+   * ### existing target? */
+  else if (original_start  0  content_info-stream)
 {
   svn_linenum_t saved_line = content_info-current_line;
   svn_linenum_t modified_start;
@@ -1434,6 +1442,7 @@ apply_one_patch(patch_target_t **patch_t
   apr_pool_t *iterpool;
   int i;
   static const int MAX_FUZZ = 2;
+  apr_hash_index_t *hash_index;
 
   SVN_ERR(init_patch_target(target, patch, abs_wc_path, wc_ctx, strip_count,
 remove_tempfiles, result_pool, scratch_pool));
@@ -1477,6 +1486,7 @@ apply_one_patch(patch_target_t **patch_t
 {
   SVN_ERR(get_hunk_info(hi, target, target-content_info, hunk, fuzz,
 ignore_whitespace,
+FALSE /* is_prop_hunk */,
 cancel_func, cancel_baton,
 result_pool, iterpool));
   fuzz++;
@@ -1501,7 +1511,6 @@ apply_one_patch(patch_target_t **patch_t
   else
 SVN_ERR(apply_hunk(target, target-content_info, hi, iterpool));
 }
-  svn_pool_destroy(iterpool);
 
   if (target-kind_on_disk == svn_node_file)
 {
@@ -1517,6 +1526,56 @@ apply_one_patch(patch_target_t **patch_t
 }
 }
 
+  /* Match property hunks. */
+  for (hash_index = apr_hash_first(result_pool, patch-prop_patches);
+   hash_index;
+   hash_index = apr_hash_next(hash_index))
+{
+  svn_prop_patch_t *prop_patch;
+  const char *prop_name;
+  target_content_info_t *prop_content_info;
+
+  /* Fetching the parsed info for one property */
+  prop_name = svn__apr_hash_index_key(hash_index);
+  prop_patch = svn__apr_hash_index_val(hash_index);
+
+  /* Fetch the prop_content_info we'll use to store the matched hunks
+   * in. */
+  prop_content_info = apr_hash_get(target-prop_content_info, prop_name, 
+   APR_HASH_KEY_STRING);
+
+  for (i = 0; i  prop_patch-hunks-nelts; i++)
+{
+  svn_hunk_t *hunk;
+  hunk_info_t *hi;
+  int fuzz = 0;
+
+  svn_pool_clear(iterpool

svn propchange: r966226 - svn:log

2010-07-21 Thread dannas
Author: dannas
Revision: 966226
Modified property: svn:log

Modified: svn:log at Wed Jul 21 14:04:55 2010
--
--- svn:log (original)
+++ svn:log Wed Jul 21 14:04:55 2010
@@ -11,7 +11,7 @@ installing a property patch.
   (get_hunk_info): Add new parameter 'is_prop_hunk' for determining
 if match_new_file() should be called. The idea is that we should
 be able to handle matching of new props as well in the future.
-Make the apply step more generic by checking if we have a target
+Make the match step more generic by checking if we have a target
 stream instead of as previously if our target was a file.
   (apply_one_patch): Match property hunks for each property in the
 same manner as is done for text hunks.



svn commit: r966228 - /subversion/trunk/subversion/libsvn_client/patch.c

2010-07-21 Thread dannas
Author: dannas
Date: Wed Jul 21 14:10:13 2010
New Revision: 966228

URL: http://svn.apache.org/viewvc?rev=966228view=rev
Log:
* subversion/libsvn_client/patch.c
  (target_content_info_t): Add doc string.

Modified:
subversion/trunk/subversion/libsvn_client/patch.c

Modified: subversion/trunk/subversion/libsvn_client/patch.c
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/patch.c?rev=966228r1=966227r2=966228view=diff
==
--- subversion/trunk/subversion/libsvn_client/patch.c (original)
+++ subversion/trunk/subversion/libsvn_client/patch.c Wed Jul 21 14:10:13 2010
@@ -65,6 +65,8 @@ typedef struct hunk_info_t {
   int fuzz;
 } hunk_info_t;
 
+/* A struct carrying the information related to the content of a target, be it
+ * a property or the the text of a file. */
 typedef struct target_content_info_t {
   /* A stream to read lines form the target file. This is NULL in case
* the target file did not exist prior to patch application. */




svn commit: r966271 - /subversion/trunk/subversion/libsvn_client/patch.c

2010-07-21 Thread dannas
Author: dannas
Date: Wed Jul 21 15:11:43 2010
New Revision: 966271

URL: http://svn.apache.org/viewvc?rev=966271view=rev
Log:
Enable matching of added properties.

* subversion/libsvn_client/patch.c
  (match_existing_file): Rename from this to ..
  (match_existing_target): .. This and replace 'target' parameter with
'content_info' and add 'stream' parameter to be able to use
the function for both text and properties.
  (get_hunk_info): Open the stream for the added file case here and pass
the stream to match_existing_target().  Match added properties in a 
manner similar to how we match added files.

Modified:
subversion/trunk/subversion/libsvn_client/patch.c

Modified: subversion/trunk/subversion/libsvn_client/patch.c
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/patch.c?rev=966271r1=966270r2=966271view=diff
==
--- subversion/trunk/subversion/libsvn_client/patch.c (original)
+++ subversion/trunk/subversion/libsvn_client/patch.c Wed Jul 21 15:11:43 2010
@@ -925,27 +925,22 @@ scan_for_match(svn_linenum_t *matched_li
   return SVN_NO_ERROR;
 }
 
-/* Indicate in *MATCH whether the file at TARGET-abspath matches the
- * modified text of HUNK. Use SCRATCH_POOL for temporary allocations. */
+/* Indicate in *MATCH whether the STREAM matches the modified text of HUNK.
+ * Use CONTENT_INFO for retrieving information on eol and keywords that is
+ * needed for the comparison.
+ * Use SCRATCH_POOL for temporary allocations. */
 static svn_error_t *
-match_existing_file(svn_boolean_t *match,
-patch_target_t *target,
+match_existing_target(svn_boolean_t *match,
+target_content_info_t *content_info,
 const svn_hunk_t *hunk,
+svn_stream_t *stream,
 apr_pool_t *scratch_pool)
 {
-  apr_file_t *file;
-  svn_stream_t *stream;
   svn_boolean_t lines_matched;
   apr_pool_t *iterpool;
   svn_boolean_t eof;
   svn_boolean_t hunk_eof;
 
-  SVN_ERR(svn_io_file_open(file, target-local_abspath,
-   APR_READ | APR_BINARY, APR_OS_DEFAULT,
-   scratch_pool));
-  stream = svn_stream_from_aprfile2(file, FALSE, scratch_pool);
-
-
   SVN_ERR(svn_diff_hunk_reset_modified_text(hunk));
 
   iterpool = svn_pool_create(scratch_pool);
@@ -966,19 +961,18 @@ match_existing_file(svn_boolean_t *match
   /* Contract keywords. */
   SVN_ERR(svn_subst_translate_cstring2(line-data, line_translated,
NULL, FALSE, 
-   target-content_info-keywords,
+   content_info-keywords,
FALSE, iterpool));
   SVN_ERR(svn_subst_translate_cstring2(hunk_line-data,
hunk_line_translated,
NULL, FALSE,
-   target-content_info-keywords,
+   content_info-keywords,
FALSE, iterpool));
   lines_matched = ! strcmp(line_translated, hunk_line_translated);
   if (eof != hunk_eof)
 {
   svn_pool_destroy(iterpool);
   *match = FALSE;
-  svn_stream_close(stream);
   return SVN_NO_ERROR;
 }
   }
@@ -986,7 +980,6 @@ match_existing_file(svn_boolean_t *match
 svn_pool_destroy(iterpool);
 
 *match = (lines_matched  eof == hunk_eof);
-svn_stream_close(stream);
 return SVN_NO_ERROR;
 }
 
@@ -1019,10 +1012,7 @@ get_hunk_info(hunk_info_t **hi, patch_ta
* a new file. Don't bother matching hunks in that case, since
* the hunk applies at line 1. If the file already exists, the hunk
* is rejected, unless the file is versioned and its content matches
-   * the file the patch wants to create. 
-   *
-   * ### We need to be able to apply this logic to property hunks that wants
-   * ### to create a new property. Currently we just ignore added hunks. */
+   * the file the patch wants to create.  */
   if (original_start == 0  ! is_prop_hunk)
 {
   if (target-kind_on_disk == svn_node_file)
@@ -1030,9 +1020,19 @@ get_hunk_info(hunk_info_t **hi, patch_ta
   if (target-db_kind == svn_node_file)
 {
   svn_boolean_t file_matches;
+  apr_file_t *file;
+  svn_stream_t *stream;
+
+  /* ### dannas: Why not use content_info-stream here? */
+  SVN_ERR(svn_io_file_open(file, target-local_abspath,
+   APR_READ | APR_BINARY, APR_OS_DEFAULT,
+   scratch_pool));
+  stream = svn_stream_from_aprfile2(file, FALSE, scratch_pool);
+
+  SVN_ERR(match_existing_target(file_matches, content_info, hunk

svn propchange: r965520 - svn:log

2010-07-20 Thread dannas
Author: dannas
Revision: 965520
Modified property: svn:log

Modified: svn:log at Tue Jul 20 08:20:36 2010
--
--- svn:log (original)
+++ svn:log Tue Jul 20 08:20:36 2010
@@ -1,5 +1,5 @@
 Update a javahl test to always display a diff header, even if we just have 
-property changes.
+property changes. That change of behavior was introduced in r962670.
 
 * subversion/bindings/javahl/tests/org/apache/subversion/javahl/BasicTests.java
   (testDiff): Add diff headers to the expected diff output.



svn commit: r965756 - /subversion/trunk/subversion/libsvn_client/patch.c

2010-07-20 Thread dannas
Author: dannas
Date: Tue Jul 20 08:40:11 2010
New Revision: 965756

URL: http://svn.apache.org/viewvc?rev=965756view=rev
Log:
* subversion/libsvn_client/patch.c
  (resolve_target_wc_file_info): For consistency, use 'local_abspath' in
all function calls.

Modified:
subversion/trunk/subversion/libsvn_client/patch.c

Modified: subversion/trunk/subversion/libsvn_client/patch.c
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/patch.c?rev=965756r1=965755r2=965756view=diff
==
--- subversion/trunk/subversion/libsvn_client/patch.c (original)
+++ subversion/trunk/subversion/libsvn_client/patch.c Tue Jul 20 08:40:11 2010
@@ -260,7 +260,7 @@ resolve_target_wc_file_info(svn_wc_conte
 scratch_pool));
   rev_str = apr_psprintf(scratch_pool, %ld, changed_rev);
   SVN_ERR(svn_wc__node_get_url(url, wc_ctx,
-   target-local_abspath,
+   local_abspath,
scratch_pool, scratch_pool));
   SVN_ERR(svn_subst_build_keywords2(target-content_info-keywords,
 keywords_val-data,




svn commit: r965761 - /subversion/trunk/subversion/libsvn_client/patch.c

2010-07-20 Thread dannas
Author: dannas
Date: Tue Jul 20 08:58:17 2010
New Revision: 965761

URL: http://svn.apache.org/viewvc?rev=965761view=rev
Log:
Give a more descriptive name to a function.

No semantic changes.

* subversion/libsvn_client/patch.c
  (resolve_target_wc_file_info): Rename this ...
  (obtain_eol_and_keywords_for_file): .. To this and pass 'content_info'
as parameter instead of 'target' to clarify what fields we're 
changing.

Modified:
subversion/trunk/subversion/libsvn_client/patch.c

Modified: subversion/trunk/subversion/libsvn_client/patch.c
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/patch.c?rev=965761r1=965760r2=965761view=diff
==
--- subversion/trunk/subversion/libsvn_client/patch.c (original)
+++ subversion/trunk/subversion/libsvn_client/patch.c Tue Jul 20 08:58:17 2010
@@ -226,15 +226,15 @@ strip_path(const char **result, const ch
 }
 
 /* Obtain eol and keywords information for LOCAL_ABSPATH, from WC_CTX and
- * store the obtained information in *TARGET.
+ * store the obtained information in *CONTENT_INFO.
  * Use RESULT_POOL for allocations of fields in TARGET.
  * Use SCRATCH_POOL for all other allocations. */
 static svn_error_t *
-resolve_target_wc_file_info(svn_wc_context_t *wc_ctx,
-const char *local_abspath,
-patch_target_t *target,
-apr_pool_t *result_pool,
-apr_pool_t *scratch_pool)
+obtain_eol_and_keywords_for_file(svn_wc_context_t *wc_ctx,
+ const char *local_abspath,
+ target_content_info_t *content_info,
+ apr_pool_t *result_pool,
+ apr_pool_t *scratch_pool)
 {
   apr_hash_t *props;
   svn_string_t *keywords_val, *eol_style_val;
@@ -262,7 +262,7 @@ resolve_target_wc_file_info(svn_wc_conte
   SVN_ERR(svn_wc__node_get_url(url, wc_ctx,
local_abspath,
scratch_pool, scratch_pool));
-  SVN_ERR(svn_subst_build_keywords2(target-content_info-keywords,
+  SVN_ERR(svn_subst_build_keywords2(content_info-keywords,
 keywords_val-data,
 rev_str, url, changed_date,
 author, result_pool));
@@ -272,8 +272,8 @@ resolve_target_wc_file_info(svn_wc_conte
APR_HASH_KEY_STRING);
   if (eol_style_val)
 {
-  svn_subst_eol_style_from_value(target-content_info-eol_style,
- target-content_info-eol_str,
+  svn_subst_eol_style_from_value(content_info-eol_style,
+ content_info-eol_str,
  eol_style_val-data);
 }
 
@@ -406,8 +406,9 @@ resolve_target_path(patch_target_t *targ
 }
 
   if (target-kind_on_disk == svn_node_file)
-SVN_ERR(resolve_target_wc_file_info(wc_ctx, target-local_abspath,
-target, result_pool, scratch_pool));
+SVN_ERR(obtain_eol_and_keywords_for_file(wc_ctx, target-local_abspath,
+ target-content_info, 
+ result_pool, scratch_pool));
 
   return SVN_NO_ERROR;
 }




svn commit: r965773 - /subversion/trunk/subversion/libsvn_client/patch.c

2010-07-20 Thread dannas
Author: dannas
Date: Tue Jul 20 09:35:05 2010
New Revision: 965773

URL: http://svn.apache.org/viewvc?rev=965773view=rev
Log:
Follow-up to r965761. For readability, initialize all fields of 
'target_content_info_t' in one place.

No semantic changes.

* subversion/libsvn_client/patch.c
  (obtain_eol_and_keywords_for_file): Add out parameters 
'keywords', 'eol_style' and 'eol_str'. Those replaces
the removed parameter 'content_info'.
  (resolve_target_path): Move the call to 
obtain_eol_and_keywords_for_file() from here..
  (init_patch_target): .. To here and track the parameter changes.

Modified:
subversion/trunk/subversion/libsvn_client/patch.c

Modified: subversion/trunk/subversion/libsvn_client/patch.c
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/patch.c?rev=965773r1=965772r2=965773view=diff
==
--- subversion/trunk/subversion/libsvn_client/patch.c (original)
+++ subversion/trunk/subversion/libsvn_client/patch.c Tue Jul 20 09:35:05 2010
@@ -225,14 +225,15 @@ strip_path(const char **result, const ch
   return SVN_NO_ERROR;
 }
 
-/* Obtain eol and keywords information for LOCAL_ABSPATH, from WC_CTX and
- * store the obtained information in *CONTENT_INFO.
+/* Obtain KEYWORDS, EOL_STYLE and EOL_STR for LOCAL_ABSPATH, from WC_CTX.
  * Use RESULT_POOL for allocations of fields in TARGET.
  * Use SCRATCH_POOL for all other allocations. */
 static svn_error_t *
-obtain_eol_and_keywords_for_file(svn_wc_context_t *wc_ctx,
+obtain_eol_and_keywords_for_file(apr_hash_t **keywords,
+ svn_subst_eol_style_t *eol_style,
+ const char **eol_str,
+ svn_wc_context_t *wc_ctx,
  const char *local_abspath,
- target_content_info_t *content_info,
  apr_pool_t *result_pool,
  apr_pool_t *scratch_pool)
 {
@@ -262,7 +263,7 @@ obtain_eol_and_keywords_for_file(svn_wc_
   SVN_ERR(svn_wc__node_get_url(url, wc_ctx,
local_abspath,
scratch_pool, scratch_pool));
-  SVN_ERR(svn_subst_build_keywords2(content_info-keywords,
+  SVN_ERR(svn_subst_build_keywords2(keywords,
 keywords_val-data,
 rev_str, url, changed_date,
 author, result_pool));
@@ -272,8 +273,8 @@ obtain_eol_and_keywords_for_file(svn_wc_
APR_HASH_KEY_STRING);
   if (eol_style_val)
 {
-  svn_subst_eol_style_from_value(content_info-eol_style,
- content_info-eol_str,
+  svn_subst_eol_style_from_value(eol_style,
+ eol_str,
  eol_style_val-data);
 }
 
@@ -405,11 +406,6 @@ resolve_target_path(patch_target_t *targ
   return SVN_NO_ERROR;
 }
 
-  if (target-kind_on_disk == svn_node_file)
-SVN_ERR(obtain_eol_and_keywords_for_file(wc_ctx, target-local_abspath,
- target-content_info, 
- result_pool, scratch_pool));
-
   return SVN_NO_ERROR;
 }
 
@@ -479,6 +475,14 @@ init_patch_target(patch_target_t **patch
   SVN_ERR(svn_io_is_file_executable(target-executable,
 target-local_abspath,
 scratch_pool));
+
+  SVN_ERR(obtain_eol_and_keywords_for_file(content_info-keywords,
+   content_info-eol_style,
+   content_info-eol_str,
+   wc_ctx,
+   target-local_abspath,
+   result_pool,
+   scratch_pool));
 }
 
   /* Create a temporary file to write the patched result to. */




svn commit: r965778 - /subversion/trunk/subversion/libsvn_client/patch.c

2010-07-20 Thread dannas
Author: dannas
Date: Tue Jul 20 09:54:27 2010
New Revision: 965778

URL: http://svn.apache.org/viewvc?rev=965778view=rev
Log:
Clarify what fields are initialized to zero to avoid ambiguity.

* subversion/libsvn_client/patch.c
  (init_patch_target): Clarify doc comment and rearrange lines to
make it clearer that both 'target' and 'content_info' are allocated
with apr_pcalloc() and thus have all fields set to zero by default.

Modified:
subversion/trunk/subversion/libsvn_client/patch.c

Modified: subversion/trunk/subversion/libsvn_client/patch.c
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/patch.c?rev=965778r1=965777r2=965778view=diff
==
--- subversion/trunk/subversion/libsvn_client/patch.c (original)
+++ subversion/trunk/subversion/libsvn_client/patch.c Tue Jul 20 09:54:27 2010
@@ -428,9 +428,9 @@ init_patch_target(patch_target_t **patch
   patch_target_t *target;
   target_content_info_t *content_info; 
 
-  target = apr_pcalloc(result_pool, sizeof(*target));
   content_info = apr_pcalloc(result_pool, sizeof(*content_info));
 
+  /* All other fields in content_info are FALSE or NULL due to apr_pcalloc().*/
   content_info-current_line = 1;
   content_info-eol_style = svn_subst_eol_style_none;
   content_info-lines = apr_array_make(result_pool, 0,
@@ -439,12 +439,13 @@ init_patch_target(patch_target_t **patch
   content_info-keywords = apr_hash_make(result_pool);
   content_info-pool = result_pool;
 
-  target-content_info = content_info;
+  target = apr_pcalloc(result_pool, sizeof(*target));
 
-  /* All other fields are FALSE or NULL due to apr_pcalloc(). */
+  /* All other fields in target are FALSE or NULL due to apr_pcalloc(). */
   target-patch = patch;
   target-db_kind = svn_node_none;
   target-kind_on_disk = svn_node_none;
+  target-content_info = content_info;
   target-pool = result_pool;
 
   SVN_ERR(resolve_target_path(target, patch-new_filename,




svn commit: r965376 - /subversion/trunk/subversion/libsvn_client/diff.c

2010-07-19 Thread dannas
Author: dannas
Date: Mon Jul 19 07:38:14 2010
New Revision: 965376

URL: http://svn.apache.org/viewvc?rev=965376view=rev
Log:
* subversion/libsvn_client/diff.c
  (display_prop_diffs): Remove code for handling relative_to_dir. That 
logic exists in adjust_paths_for_diff_labels() now.

Modified:
subversion/trunk/subversion/libsvn_client/diff.c

Modified: subversion/trunk/subversion/libsvn_client/diff.c
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/diff.c?rev=965376r1=965375r2=965376view=diff
==
--- subversion/trunk/subversion/libsvn_client/diff.c (original)
+++ subversion/trunk/subversion/libsvn_client/diff.c Mon Jul 19 07:38:14 2010
@@ -321,20 +321,6 @@ display_prop_diffs(const apr_array_heade
 {
   int i;
 
-  if (relative_to_dir)
-{
-  /* Possibly adjust the path shown in the output (see issue #2723). */
-  const char *child_path = svn_dirent_is_child(relative_to_dir, path,
-   pool);
-
-  if (child_path)
-path = child_path;
-  else if (!svn_path_compare_paths(relative_to_dir, path))
-path = .;
-  else
-return MAKE_ERR_BAD_RELATIVE_PATH(path, relative_to_dir);
-}
-
   /* If we're creating a diff on the wc root, path would be empty. */
   if (path[0] == '\0')
 path = apr_psprintf(pool, .);




svn commit: r965389 - /subversion/trunk/subversion/libsvn_client/diff.c

2010-07-19 Thread dannas
Author: dannas
Date: Mon Jul 19 09:01:57 2010
New Revision: 965389

URL: http://svn.apache.org/viewvc?rev=965389view=rev
Log:
Give more descriptive names for variables representing the original 
targets of a diff operation.

No semantic changes.

* subversion/libsvn_client/diff.c
  (adjust_paths_for_diff_labels): Replace path1 and path2 with 
orig_path_1 and orig_path_2. 

Modified:
subversion/trunk/subversion/libsvn_client/diff.c

Modified: subversion/trunk/subversion/libsvn_client/diff.c
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/diff.c?rev=965389r1=965388r2=965389view=diff
==
--- subversion/trunk/subversion/libsvn_client/diff.c (original)
+++ subversion/trunk/subversion/libsvn_client/diff.c Mon Jul 19 09:01:57 2010
@@ -190,22 +190,22 @@ maybe_append_eol(const svn_string_t *tok
 }
 }
 
-/* Adjust PATH, PATH1 and PATH2, representing the changed file and the two
- * original targets passed to the diff command, to handle the case when
- * we're dealing with different anchors. RELATIVE_TO_DIR is the directory
- * the diff target should be considered relative to. All allocations are done
- * in POOL. */
+/* Adjust PATH, ORIG_PATH_1 and ORIG_PATH_2, representing the changed file
+ * and the two original targets passed to the diff command, to handle the
+ * case when we're dealing with different anchors. RELATIVE_TO_DIR is the
+ * directory the diff target should be considered relative to. All
+ * allocations are done in POOL. */
 static svn_error_t *
 adjust_paths_for_diff_labels(const char **path,
- const char **path1,
- const char **path2,
+ const char **orig_path_1,
+ const char **orig_path_2,
  const char *relative_to_dir,
  apr_pool_t *pool)
 {
   apr_size_t len;
   const char *new_path = *path;
-  const char *new_path1 = *path1;
-  const char *new_path2 = *path2;
+  const char *new_path1 = *orig_path_1;
+  const char *new_path2 = *orig_path_2;
 
   /* ### Holy cow.  Due to anchor/target weirdness, we can't
  simply join diff_cmd_baton-orig_path_1 with path, ditto for
@@ -274,8 +274,8 @@ adjust_paths_for_diff_labels(const char 
 return MAKE_ERR_BAD_RELATIVE_PATH(new_path2, relative_to_dir);
 }
   *path = new_path;
-  *path1 = new_path1;
-  *path2 = new_path2;
+  *orig_path_1 = new_path1;
+  *orig_path_2 = new_path2;
 
   return SVN_NO_ERROR;
 }




svn commit: r965488 - /subversion/trunk/subversion/libsvn_client/patch.c

2010-07-19 Thread dannas
Author: dannas
Date: Mon Jul 19 14:01:26 2010
New Revision: 965488

URL: http://svn.apache.org/viewvc?rev=965488view=rev
Log:
Create target_content_info_t for storing text related parts of 
patch_target_t.

This is a step towards handling properties in the patch code. The idea
is that target_content_info_t should be able to describe any text, be 
it from a file or a property. But for now we're only dealing with texts from a
file.

* subversion/libsvn_client/patch.c
  (target_content_info): New.
  (patch_target_t): Fields related to the text have been moved to the
field 'content_info'
  (init_patch_target): Initialize 'content_info'.
  (resolve_target_wc_file_info,
   read_line,
   seek_to_line,
   match_hunk,
   scan_for_match): Replace 'target-' with 'content_info-' for fields
related to text content.
  (match_existing_file): Use 'target-content_info' for accessing the
streams. We still need other fields from the target.
  (get_hunk_info): Add 'content_info' parameter. We still need target for
match_existing_file().
  (copy_lines_to_target): Add 'content_info' parameter.
  (reject_hunk,
   apply_hunk): Add 'content_info' parameter. We still need target for
marking a target as having rejects.
  (send_patch_notification): Uses content_info-hunks
  (apply_one_patch): Pass around target-content_info to the match and
apply/reject functions.

Modified:
subversion/trunk/subversion/libsvn_client/patch.c

Modified: subversion/trunk/subversion/libsvn_client/patch.c
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/patch.c?rev=965488r1=965487r2=965488view=diff
==
--- subversion/trunk/subversion/libsvn_client/patch.c (original)
+++ subversion/trunk/subversion/libsvn_client/patch.c Mon Jul 19 14:01:26 2010
@@ -65,28 +65,7 @@ typedef struct hunk_info_t {
   int fuzz;
 } hunk_info_t;
 
-typedef struct patch_target_t {
-  /* The patch being applied. */
-  const svn_patch_t *patch;
-
-  /* The target path as it appeared in the patch file,
-   * but in canonicalised form. */
-  const char *canon_path_from_patchfile;
-
-  /* The target path, relative to the working copy directory the
-   * patch is being applied to. A patch strip count applies to this
-   * and only this path. This is never NULL. */
-  const char *local_relpath;
-
-  /* The absolute path of the target on the filesystem.
-   * Any symlinks the path from the patch file may contain are resolved.
-   * Is not always known, so it may be NULL. */
-  char *local_abspath;
-
-  /* The target file, read-only, seekable. This is NULL in case the target
-   * file did not exist prior to patch application. */
-  apr_file_t *file;
-
+typedef struct target_content_info_t {
   /* A stream to read lines form the target file. This is NULL in case
* the target file did not exist prior to patch application. */
   svn_stream_t *stream;
@@ -98,16 +77,10 @@ typedef struct patch_target_t {
* so EOL transformation and keyword contraction is done transparently. */
   svn_stream_t *patched;
 
-  /* Path to the temporary file underlying the result stream. */
-  const char *patched_path;
-
   /* The reject stream, write-only, not seekable.
* Hunks that are rejected will be written to this stream. */
   svn_stream_t *reject;
 
-  /* Path to the temporary file underlying the reject stream. */
-  const char *reject_path;
-
   /* The line last read from the target file. */
   svn_linenum_t current_line;
 
@@ -127,6 +100,44 @@ typedef struct patch_target_t {
   /* An array containing hunk_info_t structures for hunks already matched. */
   apr_array_header_t *hunks;
 
+  /* True if end-of-file was reached while reading from the target. */
+  svn_boolean_t eof;
+
+  /* The keywords of the target. */
+  apr_hash_t *keywords;
+
+  /* The pool the target_info is allocated in. */
+  apr_pool_t *pool;
+} target_content_info_t;
+
+typedef struct patch_target_t {
+  /* The patch being applied. */
+  const svn_patch_t *patch;
+
+  /* The target path as it appeared in the patch file,
+   * but in canonicalised form. */
+  const char *canon_path_from_patchfile;
+
+  /* The target path, relative to the working copy directory the
+   * patch is being applied to. A patch strip count applies to this
+   * and only this path. This is never NULL. */
+  const char *local_relpath;
+
+  /* The absolute path of the target on the filesystem.
+   * Any symlinks the path from the patch file may contain are resolved.
+   * Is not always known, so it may be NULL. */
+  char *local_abspath;
+
+  /* The target file, read-only, seekable. This is NULL in case the target
+   * file did not exist prior to patch application. */
+  apr_file_t *file;
+
+  /* Path to the temporary file underlying the result stream. */
+  const char *patched_path;
+
+  /* Path to the temporary file underlying the reject stream. */
+  const char *reject_path;
+
   /* The node kind of the target as found

svn commit: r965520 - /subversion/trunk/subversion/bindings/javahl/tests/org/apache/subversion/javahl/BasicTests.java

2010-07-19 Thread dannas
Author: dannas
Date: Mon Jul 19 15:01:09 2010
New Revision: 965520

URL: http://svn.apache.org/viewvc?rev=965520view=rev
Log:
Update a javahl test to always display a diff header, even if we just have 
property changes.

* subversion/bindings/javahl/tests/org/apache/subversion/javahl/BasicTests.java
  (testDiff): Add diff headers to the expected diff output.

Modified:

subversion/trunk/subversion/bindings/javahl/tests/org/apache/subversion/javahl/BasicTests.java

Modified: 
subversion/trunk/subversion/bindings/javahl/tests/org/apache/subversion/javahl/BasicTests.java
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/bindings/javahl/tests/org/apache/subversion/javahl/BasicTests.java?rev=965520r1=965519r2=965520view=diff
==
--- 
subversion/trunk/subversion/bindings/javahl/tests/org/apache/subversion/javahl/BasicTests.java
 (original)
+++ 
subversion/trunk/subversion/bindings/javahl/tests/org/apache/subversion/javahl/BasicTests.java
 Mon Jul 19 15:01:09 2010
@@ -2856,7 +2856,10 @@ public class BasicTests extends SVNTests
 String aPath = fileToSVNPath(new File(thisTest.getWCPath() + /A),
  false);
 
-expectedDiffOutput = NL + Property changes on: A + NL +
+expectedDiffOutput = Index: A + NL + sepLine +
+--- A\t(revision 1) + NL +
++++ A\t(working copy) + NL +
+NL + Property changes on: A + NL +
 underSepLine +
 Added: testprop + NL +
 ## -0,0 +1 ## + NL +
@@ -2872,7 +2875,10 @@ public class BasicTests extends SVNTests
  expectedDiffOutput, diffOutput);
 
 // Test diff where relativeToDir and path are the same.
-expectedDiffOutput = NL + Property changes on: . + NL +
+expectedDiffOutput = Index: . + NL + sepLine +
+--- .\t(revision 1) + NL +
++++ .\t(working copy) + NL +
+NL + Property changes on: . + NL +
 underSepLine +
 Added: testprop + NL +
 ## -0,0 +1 ## + NL +




svn commit: r964935 - /subversion/trunk/subversion/libsvn_client/patch.c

2010-07-16 Thread dannas
Author: dannas
Date: Fri Jul 16 20:15:16 2010
New Revision: 964935

URL: http://svn.apache.org/viewvc?rev=964935view=rev
Log:
* subversion/libsvn_client/patch.c
  (match_hunk): Require that all lines match when comparing 
modified_text to determine if a hunk has already been applied. Else
a hunk that adds a newline at the end will be treated as already 
applied even if it isn't.

Modified:
subversion/trunk/subversion/libsvn_client/patch.c

Modified: subversion/trunk/subversion/libsvn_client/patch.c
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/patch.c?rev=964935r1=964934r2=964935view=diff
==
--- subversion/trunk/subversion/libsvn_client/patch.c (original)
+++ subversion/trunk/subversion/libsvn_client/patch.c Fri Jul 16 20:15:16 2010
@@ -702,7 +702,11 @@ match_hunk(svn_boolean_t *matched, patch
 SVN_ERR(svn_diff_hunk_readline_original_text(hunk, hunk_line,
  NULL, hunk_eof,
  iterpool, iterpool));
-  if (hunk_line-len == 0  hunk_eof)
+
+  /* When comparing modified text we require that all lines match, else
+   * a hunk that adds a newline at the end will be treated as already
+   * applied even if it isn't. */
+  if (! match_modified  hunk_line-len == 0  hunk_eof)
 *matched = lines_matched;
   else
 *matched = FALSE;




svn commit: r964031 - in /subversion/trunk/subversion: include/svn_diff.h libsvn_diff/parse-diff.c

2010-07-14 Thread dannas
Author: dannas
Date: Wed Jul 14 12:34:05 2010
New Revision: 964031

URL: http://svn.apache.org/viewvc?rev=964031view=rev
Log:
Introduce a no-op entry to svn_diff_operation_kind_t to avoid 
an uninitialized variable.

* subversion/libsvn_diff/parse-diff.c
  (parse_next_hunk): Initialize 'prop_operation' to svn_diff_op_unchanged.

* subversion/include/svn_diff.h
  (svn_diff_operation_kind_t): Add entry 'svn_diff_op_unchanged'.

Modified:
subversion/trunk/subversion/include/svn_diff.h
subversion/trunk/subversion/libsvn_diff/parse-diff.c

Modified: subversion/trunk/subversion/include/svn_diff.h
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/include/svn_diff.h?rev=964031r1=964030r2=964031view=diff
==
--- subversion/trunk/subversion/include/svn_diff.h (original)
+++ subversion/trunk/subversion/include/svn_diff.h Wed Jul 14 12:34:05 2010
@@ -777,6 +777,7 @@ svn_diff_mem_string_output_merge(svn_str
  */
 typedef enum svn_diff_operation_kind_e
 {
+  svn_diff_op_unchanged,
   svn_diff_op_added,
   svn_diff_op_deleted,
   svn_diff_op_copied,

Modified: subversion/trunk/subversion/libsvn_diff/parse-diff.c
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_diff/parse-diff.c?rev=964031r1=964030r2=964031view=diff
==
--- subversion/trunk/subversion/libsvn_diff/parse-diff.c (original)
+++ subversion/trunk/subversion/libsvn_diff/parse-diff.c Wed Jul 14 12:34:05 
2010
@@ -534,6 +534,8 @@ parse_next_hunk(svn_hunk_t **hunk,
   svn_boolean_t changed_line_seen;
   apr_pool_t *iterpool;
 
+  *prop_operation = svn_diff_op_unchanged;
+
   /* We only set this if we have a property hunk. 
* ### prop_name acts as both a state flag inside this function and a
* ### qualifier to discriminate between props and text hunks. Is that




svn commit: r964059 - /subversion/trunk/subversion/libsvn_diff/parse-diff.c

2010-07-14 Thread dannas
Author: dannas
Date: Wed Jul 14 14:24:54 2010
New Revision: 964059

URL: http://svn.apache.org/viewvc?rev=964059view=rev
Log:
Fix erroneus allocation of svn_prop_patch_t. 

* subversion/libsvn_diff/parse-diff.c
  (add_property_hunk): Allocate space for a struct instead of a pointer.

Suggested by: philip

Modified:
subversion/trunk/subversion/libsvn_diff/parse-diff.c

Modified: subversion/trunk/subversion/libsvn_diff/parse-diff.c
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_diff/parse-diff.c?rev=964059r1=964058r2=964059view=diff
==
--- subversion/trunk/subversion/libsvn_diff/parse-diff.c (original)
+++ subversion/trunk/subversion/libsvn_diff/parse-diff.c Wed Jul 14 14:24:54 
2010
@@ -1077,7 +1077,7 @@ add_property_hunk(svn_patch_t *patch, co
   svn_prop_patch_t *prop_patch;
 
   prop_patch = apr_palloc(result_pool,
-  sizeof(svn_prop_patch_t *));
+  sizeof(svn_prop_patch_t));
   prop_patch-name = prop_name;
   prop_patch-operation = operation;
   prop_patch-hunks = apr_array_make(result_pool, 1,




svn commit: r964107 - in /subversion/trunk/subversion: libsvn_diff/parse-diff.c tests/libsvn_diff/parse-diff-test.c

2010-07-14 Thread dannas
Author: dannas
Date: Wed Jul 14 17:41:38 2010
New Revision: 964107

URL: http://svn.apache.org/viewvc?rev=964107view=rev
Log:
Fix bug in the diff parser where only the first property hunk after
a property header was detected.

* subversion/libsvn_diff/parse-diff.c
  (parse_next_hunk): Introduce a new out parameter 'is_property' for 
determerning the type of the returned hunk.
  (svn_diff_parse_next_patch): Store the last prop name we've parsed
to be able to identify what property a hunk belongs to.

* subversion/tests/libsvn_diff/parse-diff-test.c
  (property_unidiff): Use two hunks for one property.
  (test_parse_property_diff): Check two hunks for one property.

Modified:
subversion/trunk/subversion/libsvn_diff/parse-diff.c
subversion/trunk/subversion/tests/libsvn_diff/parse-diff-test.c

Modified: subversion/trunk/subversion/libsvn_diff/parse-diff.c
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_diff/parse-diff.c?rev=964107r1=964106r2=964107view=diff
==
--- subversion/trunk/subversion/libsvn_diff/parse-diff.c (original)
+++ subversion/trunk/subversion/libsvn_diff/parse-diff.c Wed Jul 14 17:41:38 
2010
@@ -500,14 +500,17 @@ parse_prop_name(const char **prop_name, 
 }
 
 /* Return the next *HUNK from a PATCH, using STREAM to read data
- * from the patch file. If no hunk can be found, set *HUNK to NULL. If we
- * have a property hunk, PROP_NAME and PROP_OPERATION will be set. If we
- * have a text hunk, PROP_NAME will be NULL. If REVERSE is TRUE, invert the
- * hunk while parsing it. If IGNORE_WHiTESPACES is TRUE, let lines without
- * leading spaces be recognized as context lines.  Allocate results in
+ * from the patch file. If no hunk can be found, set *HUNK to NULL. Set
+ * IS_PROPERTY to TRUE if we have a property hunk. If the returned HUNK is
+ * the first belonging to a certain property, then PROP_NAME and
+ * PROP_OPERATION will be set too. If we have a text hunk, PROP_NAME will be
+ * NULL. If REVERSE is TRUE, invert the hunk while parsing it. If
+ * IGNORE_WHiTESPACES is TRUE, let lines without leading spaces be
+ * recognized as context lines.  Allocate results in
  * RESULT_POOL.  Use SCRATCH_POOL for all other allocations. */
 static svn_error_t *
 parse_next_hunk(svn_hunk_t **hunk,
+svn_boolean_t *is_property,
 const char **prop_name,
 svn_diff_operation_kind_t *prop_operation,
 svn_patch_t *patch,
@@ -536,11 +539,9 @@ parse_next_hunk(svn_hunk_t **hunk,
 
   *prop_operation = svn_diff_op_unchanged;
 
-  /* We only set this if we have a property hunk. 
-   * ### prop_name acts as both a state flag inside this function and a
-   * ### qualifier to discriminate between props and text hunks. Is that
-   * ### kind of overloading ok? */
+  /* We only set this if we have a property hunk header. */
   *prop_name = NULL;
+  *is_property = FALSE;
 
   if (apr_file_eof(patch-patch_file) == APR_EOF)
 {
@@ -669,10 +670,10 @@ parse_next_hunk(svn_hunk_t **hunk,
 {
   original_lines = (*hunk)-original_length;
   modified_lines = (*hunk)-modified_length;
-  *prop_name = NULL;
+  *is_property = FALSE;
 }
   }
-  else if (starts_with(line-data, prop_atat)  *prop_name)
+  else if (starts_with(line-data, prop_atat))
 {
   /* Looks like we have a property hunk header, try to rip it
* apart. */
@@ -682,6 +683,7 @@ parse_next_hunk(svn_hunk_t **hunk,
 {
   original_lines = (*hunk)-original_length;
   modified_lines = (*hunk)-modified_length;
+  *is_property = TRUE;
 }
 }
   else if (starts_with(line-data, Added: ))
@@ -1213,6 +1215,8 @@ svn_diff_parse_next_patch(svn_patch_t **
   else
 {
   svn_hunk_t *hunk;
+  svn_boolean_t is_property;
+  const char *last_prop_name;
   const char *prop_name;
   svn_diff_operation_kind_t prop_operation;
 
@@ -1223,21 +1227,25 @@ svn_diff_parse_next_patch(svn_patch_t **
 {
   svn_pool_clear(iterpool);
 
-  SVN_ERR(parse_next_hunk(hunk, prop_name, prop_operation,
-  *patch, stream, reverse,
+  SVN_ERR(parse_next_hunk(hunk, is_property, prop_name,
+  prop_operation, *patch, stream, reverse,
   ignore_whitespace,
   result_pool, iterpool));
 
-  /* We have a property hunk. */
-  if (hunk  prop_name)
+  if (hunk  is_property)
 {
+  if (! prop_name)
+prop_name = last_prop_name;
+  else
+last_prop_name = prop_name;
   SVN_ERR(add_property_hunk(*patch, prop_name, hunk

svn commit: r963814 - in /subversion/trunk/subversion: include/svn_diff.h libsvn_diff/parse-diff.c tests/libsvn_diff/parse-diff-test.c

2010-07-13 Thread dannas
Author: dannas
Date: Tue Jul 13 18:46:31 2010
New Revision: 963814

URL: http://svn.apache.org/viewvc?rev=963814view=rev
Log:
Start recording what operation is perfomed on a property in a patch.

* subversion/include/svn_diff.h
  (svn_prop_patch_t): New. Should only deal with the property part of a
patch.
  (svn_patch_t): Use an array of 'svn_prop_patch_t' instead of a
hash table of hunks for representing parsed property content.

* subversion/libsvn_diff/parse-diff.c
  (parse_next_hunk): Add 'prop_operation' parameter for recording if a
property patch was deleted, added or modified.
  (add_property_hunk): New.
  svn_diff_parse_next_patch): Call add_property_hunk() if we have a
property hunk. Use the new 'svn_prop_patch_t' type.
  
* subversion/tests/libsvn_diff/parse-diff-test.c
  (test_parse_property_diff,
   test_parse_property_and_text_diff): Adjust the tests to use the
new 'svn_prop_patch_t' type and loop over an array instead of 
fetching the properties from a hash table..

Modified:
subversion/trunk/subversion/include/svn_diff.h
subversion/trunk/subversion/libsvn_diff/parse-diff.c
subversion/trunk/subversion/tests/libsvn_diff/parse-diff-test.c

Modified: subversion/trunk/subversion/include/svn_diff.h
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/include/svn_diff.h?rev=963814r1=963813r2=963814view=diff
==
--- subversion/trunk/subversion/include/svn_diff.h (original)
+++ subversion/trunk/subversion/include/svn_diff.h Tue Jul 13 18:46:31 2010
@@ -933,6 +933,22 @@ svn_linenum_t
 svn_diff_hunk_get_trailing_context(const svn_hunk_t *hunk);
 
 /**
+ * Data type to manage parsing of properties in patches.
+ * 
+ * @since New in 1.7. */
+typedef struct svn_prop_patch_t {
+  const char *name;
+
+  /** Represents the operation performed on the property */
+  svn_diff_operation_kind_t operation;
+
+  /**
+   * An array containing an svn_hunk_t object for each hunk parsed from the
+   * patch associated with our property name */
+  apr_array_header_t *hunks;
+} svn_prop_patch_t;
+
+/**
  * Data type to manage parsing of patches.
  *
  * @since New in 1.7. */
@@ -956,9 +972,9 @@ typedef struct svn_patch_t {
   apr_array_header_t *hunks;
 
   /**
-   * A hash table containing an array of svn_hunk_t object for each property
-   * parsed from the patch. The property names act as keys.  */
-  apr_hash_t *property_hunks;
+   * An array containing svn_patch_property_t object for each property
+   * parsed from the patch. */
+  apr_array_header_t *prop_patches;
 
   /**
* Represents the operation performed on the file. */

Modified: subversion/trunk/subversion/libsvn_diff/parse-diff.c
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_diff/parse-diff.c?rev=963814r1=963813r2=963814view=diff
==
--- subversion/trunk/subversion/libsvn_diff/parse-diff.c (original)
+++ subversion/trunk/subversion/libsvn_diff/parse-diff.c Tue Jul 13 18:46:31 
2010
@@ -501,14 +501,15 @@ parse_prop_name(const char **prop_name, 
 
 /* Return the next *HUNK from a PATCH, using STREAM to read data
  * from the patch file. If no hunk can be found, set *HUNK to NULL. If we
- * have a property hunk, PROP_NAME will be set. If we have a text hunk,
- * PROP_NAME will be NULL. If REVERSE is TRUE, invert the hunk while
- * parsing it. If IGNORE_WHiTESPACES is TRUE, let lines without leading
- * spaces be recognized as context lines.  Allocate results in RESULT_POOL.
- * Use SCRATCH_POOL for all other allocations. */
+ * have a property hunk, PROP_NAME and PROP_OPERATION will be set. If we
+ * have a text hunk, PROP_NAME will be NULL. If REVERSE is TRUE, invert the
+ * hunk while parsing it. If IGNORE_WHiTESPACES is TRUE, let lines without
+ * leading spaces be recognized as context lines.  Allocate results in
+ * RESULT_POOL.  Use SCRATCH_POOL for all other allocations. */
 static svn_error_t *
 parse_next_hunk(svn_hunk_t **hunk,
 const char **prop_name,
+svn_diff_operation_kind_t *prop_operation,
 svn_patch_t *patch,
 svn_stream_t *stream,
 svn_boolean_t reverse,
@@ -685,16 +686,19 @@ parse_next_hunk(svn_hunk_t **hunk,
 {
   SVN_ERR(parse_prop_name(prop_name, line-data, Added: ,
   result_pool));
+  *prop_operation = svn_diff_op_added;
 }
   else if (starts_with(line-data, Deleted: ))
 {
   SVN_ERR(parse_prop_name(prop_name, line-data, Deleted: ,
   result_pool));
+  *prop_operation = svn_diff_op_deleted;
 }
   else if (starts_with(line-data, Modified: ))
 {
   SVN_ERR(parse_prop_name(prop_name, line-data, Modified

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

2010-07-10 Thread dannas
Author: dannas
Date: Sat Jul 10 08:20:01 2010
New Revision: 962788

URL: http://svn.apache.org/viewvc?rev=962788view=rev
Log:
Follow-up to r962670. Adjust a diff test and remove XFail marker.

The values in the diff_cmd_baton were correct. I got fooled by the
other paths in the test beeing added and thus having this form:

svn diff -r 1

  --- path  (revision 0)
  +++ path  (revision 3)

But for non-added paths it should be:
  
  --- path (revision 1)
  +++ path (working copy)

* subversion/libsvn_client/diff.c
  (diff_props_changed): Remove '###' comment about non-matching 
behaviour for the revisions in the diff_cmd_baton. At the
same time, clarify why we're using revisions from that baton.

* subversion/tests/cmdline/diff_tests.py
  (diff_prop_change_local_propmod): Adjust diff labels and remove
XFail markers.

Modified:
subversion/trunk/subversion/libsvn_client/diff.c
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=962788r1=962787r2=962788view=diff
==
--- subversion/trunk/subversion/libsvn_client/diff.c (original)
+++ subversion/trunk/subversion/libsvn_client/diff.c Sat Jul 10 08:20:01 2010
@@ -635,10 +635,9 @@ diff_props_changed(const char *local_dir
 
   if (props-nelts  0)
 {
-  /* ### We're using the revnums from the diff_cmd_baton since there's
-   * ### no revision argument to diff_props_changed(). But those revnums
-   * ### don't always match the ones given by the diff callbacks. See
-   * ### diff_test 32 for an example. */
+  /* We're using the revnums from the diff_cmd_baton since there's
+   * no revision argument to the svn_wc_diff_callback_t
+   * dir_props_changed(). */
   SVN_ERR(display_prop_diffs(props, original_props, path,
  diff_cmd_baton-orig_path_1,
  diff_cmd_baton-orig_path_2,

Modified: subversion/trunk/subversion/tests/cmdline/diff_tests.py
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/diff_tests.py?rev=962788r1=962787r2=962788view=diff
==
--- subversion/trunk/subversion/tests/cmdline/diff_tests.py (original)
+++ subversion/trunk/subversion/tests/cmdline/diff_tests.py Sat Jul 10 08:20:01 
2010
@@ -2336,9 +2336,9 @@ def diff_repos_wc_add_with_props(sbox):
 +propvalue\n,
 ]
 
-  diff_X_r1_base = make_diff_header(X, revision 0,
- revision 3) + diff_X
-  diff_X_base_r3 = make_diff_header(X, revision 0,
+  diff_X_r1_base = make_diff_header(X, revision 1,
+ working copy) + diff_X
+  diff_X_base_r3 = make_diff_header(X, working copy,
  revision 3) + diff_X
   diff_foo_r1_base = make_diff_header(foo, revision 0,
  revision 3) + diff_foo
@@ -3404,7 +3404,7 @@ test_list = [ None,
   diff_property_changes_to_base,
   diff_mime_type_changes,
   diff_prop_change_local_propmod,
-  XFail(diff_repos_wc_add_with_props),
+  diff_repos_wc_add_with_props,
   diff_nonrecursive_checkout_deleted_dir,
   diff_repos_working_added_dir,
   diff_base_repos_moved,




svn commit: r962791 - /subversion/trunk/subversion/svnlook/main.c

2010-07-10 Thread dannas
Author: dannas
Date: Sat Jul 10 08:33:25 2010
New Revision: 962791

URL: http://svn.apache.org/viewvc?rev=962791view=rev
Log:
Remove i18n markers around the property header lines. 
We've removed those in the regular diff code to allow us to
use them in the parsing. Doing the same here for consistency.

* subversion/svnlook/main.c
  (display_prop_diffs): Remove '_()' around property header lines.

Modified:
subversion/trunk/subversion/svnlook/main.c

Modified: subversion/trunk/subversion/svnlook/main.c
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/svnlook/main.c?rev=962791r1=962790r2=962791view=diff
==
--- subversion/trunk/subversion/svnlook/main.c (original)
+++ subversion/trunk/subversion/svnlook/main.c Sat Jul 10 08:33:25 2010
@@ -833,11 +833,11 @@ display_prop_diffs(const apr_array_heade
 orig_value = NULL;
 
   if (! orig_value)
-header_fmt = _(Added: %s\n);
+header_fmt = Added: %s\n;
   else if (! pc-value)
-header_fmt = _(Deleted: %s\n);
+header_fmt = Deleted: %s\n;
   else
-header_fmt = _(Modified: %s\n);
+header_fmt = Modified: %s\n; _
   SVN_ERR(svn_cmdline_printf(pool, header_fmt, pc-name));
 
   /* Flush stdout before we open a stream to it below. */




svn commit: r962793 - /subversion/trunk/subversion/svnlook/main.c

2010-07-10 Thread dannas
Author: dannas
Date: Sat Jul 10 08:51:09 2010
New Revision: 962793

URL: http://svn.apache.org/viewvc?rev=962793view=rev
Log:
Follow-up to r962791. Fix build failure.

* subversion/svnlook/main.c
  (display_prop_diffs): Remove garbage character that sneaked in and 
broke the build.

Modified:
subversion/trunk/subversion/svnlook/main.c

Modified: subversion/trunk/subversion/svnlook/main.c
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/svnlook/main.c?rev=962793r1=962792r2=962793view=diff
==
--- subversion/trunk/subversion/svnlook/main.c (original)
+++ subversion/trunk/subversion/svnlook/main.c Sat Jul 10 08:51:09 2010
@@ -837,7 +837,7 @@ display_prop_diffs(const apr_array_heade
   else if (! pc-value)
 header_fmt = Deleted: %s\n;
   else
-header_fmt = Modified: %s\n; _
+header_fmt = Modified: %s\n;
   SVN_ERR(svn_cmdline_printf(pool, header_fmt, pc-name));
 
   /* Flush stdout before we open a stream to it below. */




svn commit: r962890 - /subversion/trunk/subversion/libsvn_client/diff.c

2010-07-10 Thread dannas
Author: dannas
Date: Sat Jul 10 17:22:21 2010
New Revision: 962890

URL: http://svn.apache.org/viewvc?rev=962890view=rev
Log:
Only mark paths that contains diffs as visited. Previously we assumed
that all paths that had been invoked by the diff callbacks would have
changes that should be printed. But that's not certain if we for instance
ignore eol differences. 

* subversion/libsvn_client/diff.c
  (diff_content_changed): Only mark the path as visited if libsvn_diff
says that we have a diff.

Modified:
subversion/trunk/subversion/libsvn_client/diff.c

Modified: subversion/trunk/subversion/libsvn_client/diff.c
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/diff.c?rev=962890r1=962889r2=962890view=diff
==
--- subversion/trunk/subversion/libsvn_client/diff.c (original)
+++ subversion/trunk/subversion/libsvn_client/diff.c Sat Jul 10 17:22:21 2010
@@ -863,6 +863,11 @@ diff_content_changed(const char *path,
diff_cmd_baton-header_encoding, rel_to_dir,
diff_cmd_baton-options.for_internal-show_c_function,
subpool));
+
+  /* We have a printed a diff for this path, mark it as visited. */
+  apr_hash_set(diff_cmd_baton-visited_paths, path,
+   APR_HASH_KEY_STRING, path);
+
 }
 }
 
@@ -873,8 +878,6 @@ diff_content_changed(const char *path,
   /* Destroy the subpool. */
   svn_pool_destroy(subpool);
 
-  apr_hash_set(diff_cmd_baton-visited_paths, path, APR_HASH_KEY_STRING, path);
-
   return SVN_NO_ERROR;
 }
 




svn commit: r962895 - in /subversion/trunk/subversion: svnlook/main.c tests/cmdline/svnlook_tests.py

2010-07-10 Thread dannas
Author: dannas
Date: Sat Jul 10 17:41:00 2010
New Revision: 962895

URL: http://svn.apache.org/viewvc?rev=962895view=rev
Log:
Make svnlook print diff header for paths with only prop modifications.

* subversion/svnlook/main.c
  (print_diff_tree): Print diff headers for property changes if they
haven't been written previously.

* subversion/tests/cmdline/svnlook_tests.py
  (test_print_property_diffs,
   diff_ignore_eolstyle): Remove XFail marker. Since the headers differ
between the 'svnlook diff' and 'svn diff' we only compare the paths.

Modified:
subversion/trunk/subversion/svnlook/main.c
subversion/trunk/subversion/tests/cmdline/svnlook_tests.py

Modified: subversion/trunk/subversion/svnlook/main.c
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/svnlook/main.c?rev=962895r1=962894r2=962895view=diff
==
--- subversion/trunk/subversion/svnlook/main.c (original)
+++ subversion/trunk/subversion/svnlook/main.c Sat Jul 10 17:41:00 2010
@@ -902,6 +902,7 @@ print_diff_tree(svn_fs_root_t *root,
   svn_boolean_t orig_empty = FALSE;
   svn_boolean_t is_copy = FALSE;
   svn_boolean_t binary = FALSE;
+  svn_boolean_t diff_header_printed = FALSE;
   apr_pool_t *subpool;
   svn_stringbuf_t *header;
 
@@ -1074,6 +1075,7 @@ print_diff_tree(svn_fs_root_t *root,
svn_cmdline_output_encoding(pool), NULL, FALSE, pool));
   SVN_ERR(svn_stream_close(ostream));
   SVN_ERR(svn_cmdline_printf(pool, \n));
+  diff_header_printed = TRUE;
 }
   else if (! node-prop_mod 
   ((! c-no_diff_added  node-action == 'A') ||
@@ -1114,7 +1116,24 @@ print_diff_tree(svn_fs_root_t *root,
  base_proptable, pool));
   SVN_ERR(svn_categorize_props(propchanges, NULL, NULL, props, pool));
   if (props-nelts  0)
-SVN_ERR(display_prop_diffs(props, base_proptable, path, pool));
+{
+  /* We print a diff header for the case when we only have property
+   * mods. */
+  if (! diff_header_printed)
+{
+  const char *orig_label, *new_label;
+
+  SVN_ERR(generate_label(orig_label, base_root, base_path,
+ pool));
+  SVN_ERR(generate_label(new_label, root, path, pool));
+
+  SVN_ERR(svn_cmdline_printf(pool, Index: %s\n, path));
+  SVN_ERR(svn_cmdline_printf(pool, %s\n, equal_string));
+  SVN_ERR(svn_cmdline_printf(pool, --- %s\n, orig_label));
+  SVN_ERR(svn_cmdline_printf(pool, +++ %s\n, new_label));
+}
+  SVN_ERR(display_prop_diffs(props, base_proptable, path, pool));
+}
 }
 
   /* Return here if the node has no children. */

Modified: subversion/trunk/subversion/tests/cmdline/svnlook_tests.py
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/svnlook_tests.py?rev=962895r1=962894r2=962895view=diff
==
--- subversion/trunk/subversion/tests/cmdline/svnlook_tests.py (original)
+++ subversion/trunk/subversion/tests/cmdline/svnlook_tests.py Sat Jul 10 
17:41:00 2010
@@ -271,7 +271,15 @@ def test_print_property_diffs(sbox):
   for i in range(len(expected_output)):
 expected_output[i] = expected_output[i].replace(iota_path, 'iota')
 
-  svntest.verify.compare_and_display_lines('', '', expected_output, output)
+  # Check that the header filenames match.
+  if expected_output[2].split()[1] != output[2].split()[1]:
+raise svntest.Failure
+  if expected_output[3].split()[1] != output[3].split()[1]:
+raise svntest.Failure
+
+  svntest.verify.compare_and_display_lines('', '', 
+   expected_output[4:],
+   output[4:])
 
 #--
 # Check that svnlook info repairs allows inconsistent line endings in logs.
@@ -524,7 +532,15 @@ def diff_ignore_eolstyle(sbox):
 for i in range(len(expected_output)):
   expected_output[i] = expected_output[i].replace(mu_path, 'A/mu')
 
-svntest.verify.compare_and_display_lines('', '', expected_output, output)
+# Check that the header filenames match.
+if expected_output[2].split()[1] != output[2].split()[1]:
+  raise svntest.Failure
+if expected_output[3].split()[1] != output[3].split()[1]:
+  raise svntest.Failure
+
+svntest.verify.compare_and_display_lines('', '', 
+ expected_output[4:],
+ output[4:])
 
 
 #--
@@ -675,13 +691,13 @@ fp.close()
 test_list = [ None,
   test_misc,
   delete_file_in_moved_dir,
-  XFail

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

2010-07-10 Thread dannas
Author: dannas
Date: Sat Jul 10 19:22:05 2010
New Revision: 962905

URL: http://svn.apache.org/viewvc?rev=962905view=rev
Log:
For consistency, use '/' as separators for all paths in a diff.

Previously the 'Property changes' line used the system
specific separator.

* subversion/libsvn_client/diff.c
  (display_prop_diffs): Remove call to svn_dirent_local_style().

* subversion/tests/cmdline/diff_tests.py
  (diff_repos_wc_add_with_props,
  (diff_with_depth): Use '/' as separator.

* subversion/tests/cmdline/merge_tests.py
  (merge_in_new_file_and_diff): Use '/' as separator.

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

Modified: subversion/trunk/subversion/libsvn_client/diff.c
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/diff.c?rev=962905r1=962904r2=962905view=diff
==
--- subversion/trunk/subversion/libsvn_client/diff.c (original)
+++ subversion/trunk/subversion/libsvn_client/diff.c Sat Jul 10 19:22:05 2010
@@ -369,7 +369,7 @@ display_prop_diffs(const apr_array_heade
   SVN_ERR(file_printf_from_utf8(file, encoding,
 _(%sProperty changes on: %s%s),
 APR_EOL_STR,
-svn_dirent_local_style(path, pool),
+path,
 APR_EOL_STR));
 
   SVN_ERR(file_printf_from_utf8(file, encoding, %s APR_EOL_STR,

Modified: subversion/trunk/subversion/tests/cmdline/diff_tests.py
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/diff_tests.py?rev=962905r1=962904r2=962905view=diff
==
--- subversion/trunk/subversion/tests/cmdline/diff_tests.py (original)
+++ subversion/trunk/subversion/tests/cmdline/diff_tests.py Sat Jul 10 19:22:05 
2010
@@ -2329,7 +2329,7 @@ def diff_repos_wc_add_with_props(sbox):
 @@ -0,0 +1 @@\n,
 +content\n,
 \n,
-Property changes on:  + os.path.join('X', 'bar') + \n,
+Property changes on: X/bar\n,
 ___\n,
 Added: propname\n,
 ## -0,0 +1 ##\n,
@@ -2776,7 +2776,7 @@ def diff_with_depth(sbox):
 ## -0,0 +1 ##\n,
 +bar3\n,
 \n,
-Property changes on:  + os.path.join('A', 'B') + \n,
+Property changes on: A/B\n, 
 ___\n,
 Added: foo4\n,
 ## -0,0 +1 ##\n,
@@ -2863,7 +2863,7 @@ def diff_with_depth(sbox):
 --- A/B\t(revision 2)\n,
 +++ A/B\t(working copy)\n,
 \n,
-Property changes on:  + os.path.join('A', 'B') + \n,
+Property changes on: A/B\n,
 ___\n,
 Modified: foo4\n,
 ## -1 +1 ##\n,

Modified: subversion/trunk/subversion/tests/cmdline/merge_tests.py
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/merge_tests.py?rev=962905r1=962904r2=962905view=diff
==
--- subversion/trunk/subversion/tests/cmdline/merge_tests.py (original)
+++ subversion/trunk/subversion/tests/cmdline/merge_tests.py Sat Jul 10 
19:22:05 2010
@@ -1330,7 +1330,7 @@ def merge_in_new_file_and_diff(sbox):
 --- + url_branch_path + \t(revision 2)\n,
 +++ + url_branch_path + \t(working copy)\n,
 \n,
-Property changes on:  + branch_path + \n,
+Property changes on:  + url_branch_path + \n,
 ___\n,
 Added:  + SVN_PROP_MERGEINFO + \n,
Merged /A/B/E:r2-3\n,




svn commit: r962906 - /subversion/trunk/subversion/tests/cmdline/svnlook_tests.py

2010-07-10 Thread dannas
Author: dannas
Date: Sat Jul 10 19:36:10 2010
New Revision: 962906

URL: http://svn.apache.org/viewvc?rev=962906view=rev
Log:
Follow-up to r962905. Use '/' as separators for paths in diff tests.

* subversion/tests/cmdline/svnlook_tests.py
  (test_print_property_diffs,
   diff_ignore_eolstyle): Use paths with '/' as separators when replacing
diff paths with different anchors.

Modified:
subversion/trunk/subversion/tests/cmdline/svnlook_tests.py

Modified: subversion/trunk/subversion/tests/cmdline/svnlook_tests.py
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/svnlook_tests.py?rev=962906r1=962905r2=962906view=diff
==
--- subversion/trunk/subversion/tests/cmdline/svnlook_tests.py (original)
+++ subversion/trunk/subversion/tests/cmdline/svnlook_tests.py Sat Jul 10 
19:36:10 2010
@@ -267,9 +267,12 @@ def test_print_property_diffs(sbox):
   if len(output) != len(expected_output):
 raise svntest.Failure
 
+  canonical_iota_path = iota_path.replace(os.path.sep, '/')
+
   # replace wcdir/iota with iota in expected_output
   for i in range(len(expected_output)):
-expected_output[i] = expected_output[i].replace(iota_path, 'iota')
+expected_output[i] = expected_output[i].replace(canonical_iota_path, 
+'iota')
 
   # Check that the header filenames match.
   if expected_output[2].split()[1] != output[2].split()[1]:
@@ -528,6 +531,8 @@ def diff_ignore_eolstyle(sbox):
  '--ignore-eol-style', repo_dir, '/A/mu')
 rev += 1
 
+canonical_mu_path = mu_path.replace(os.path.sep, '/')
+
 # replace wcdir/A/mu with A/mu in expected_output
 for i in range(len(expected_output)):
   expected_output[i] = expected_output[i].replace(mu_path, 'A/mu')




svn commit: r962910 - /subversion/trunk/subversion/tests/cmdline/svnlook_tests.py

2010-07-10 Thread dannas
Author: dannas
Date: Sat Jul 10 20:05:41 2010
New Revision: 962910

URL: http://svn.apache.org/viewvc?rev=962910view=rev
Log:
Follow-up to r962906. Use '/' as separators for paths in diff tests.

* subversion/tests/cmdline/svnlook_tests.py
  (diff_ignore_eolstyle): Forgot to use the path with '/' separators. 
Doh!

Modified:
subversion/trunk/subversion/tests/cmdline/svnlook_tests.py

Modified: subversion/trunk/subversion/tests/cmdline/svnlook_tests.py
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/svnlook_tests.py?rev=962910r1=962909r2=962910view=diff
==
--- subversion/trunk/subversion/tests/cmdline/svnlook_tests.py (original)
+++ subversion/trunk/subversion/tests/cmdline/svnlook_tests.py Sat Jul 10 
20:05:41 2010
@@ -535,7 +535,8 @@ def diff_ignore_eolstyle(sbox):
 
 # replace wcdir/A/mu with A/mu in expected_output
 for i in range(len(expected_output)):
-  expected_output[i] = expected_output[i].replace(mu_path, 'A/mu')
+  expected_output[i] = expected_output[i].replace(canonical_mu_path, 
+  'A/mu')
 
 # Check that the header filenames match.
 if expected_output[2].split()[1] != output[2].split()[1]:




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

2010-07-09 Thread dannas
Author: dannas
Date: Fri Jul  9 19:45:19 2010
New Revision: 962670

URL: http://svn.apache.org/viewvc?rev=962670view=rev
Log:
Print a diff header even if the diff only contains changes to
properties. We enable that by keeping a hashtable of visited paths
and print the header for props if the path hasn't been visited yet.

Works nicely, with two exceptions:
1) svnlook uses it's own diff implementation. I've marked the test as 
  XFail and intend to do the same change there in a follow-up.

2) Since the diff_props_changed callback does not have any revision
  arguments, the revisions have been fetched from the diff_cmd_baton. 
  BUT, those don't match for paths that have been added or when the
  caller is providing SVN_INVALID_REVNUM for revnum2. Intending to
  fix that in a follow-up.

* subversion/libsvn_client/diff.c
  (diff_label): Move above display_prop_diffs() since we need to call
it from there.
  (display_prop_diffs): Add parameters for paths and revisions
of the diffed content. Also add parameter 'show_diff_header'.
Print the diff header if 'show_diff_header' is TRUE.
  (diff_cmd_baton): Add field 'visited_paths', a hashtable holding all
the paths that we have received changes for - be it properties or 
text.
  (diff_props_changed): Determine if a diff header for the path has
been written.
  (diff_content_changed): Add the path to 'visited_paths'.
  (svn_client_diff5,
   svn_client_diff_peg5): Initialize 'visited_paths'.

* subversion/tests/cmdline/depth_tests.py
  (diff_in_depthy_wc): Add diff headers.

* subversion/tests/cmdline/diff_tests.py
  (diff_only_property_change): Add diff headers.
  (diff_property_changes_to_base): Add diff headers. Use 
make_diff_header() instead of replacing lines all over
the place.
  (diff_prop_change_local_propmod): Add diff headers but mark
as XFail since the revisions in the labels are not the 
expected.
  (diff_repos_wc_add_with_props,
   diff_with_depth): Add diff headers.

* subversion/tests/cmdline/svnlook_tests.py
  (test_print_property_diffs,
   diff_ignore_eolstyle): Mark as XFail. 

* subversion/tests/cmdline/merge_tests.py
  (merge_in_new_file_and_diff): Add diff headers.

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

Modified: subversion/trunk/subversion/libsvn_client/diff.c
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/diff.c?rev=962670r1=962669r2=962670view=diff
==
--- subversion/trunk/subversion/libsvn_client/diff.c (original)
+++ subversion/trunk/subversion/libsvn_client/diff.c Fri Jul  9 19:45:19 2010
@@ -279,6 +279,27 @@ adjust_paths_for_diff_labels(const char 
 }
 
 
+/* Generate a label for the diff output for file PATH at revision REVNUM.
+   If REVNUM is invalid then it is assumed to be the current working
+   copy.  Assumes the paths are already in the desired style (local
+   vs internal).  Allocate the label in POOL. */
+static const char *
+diff_label(const char *path,
+   svn_revnum_t revnum,
+   apr_pool_t *pool)
+{
+  const char *label;
+  if (revnum != SVN_INVALID_REVNUM)
+label = apr_psprintf(pool, _(%s\t(revision %ld)), path, revnum);
+  else
+label = apr_psprintf(pool, _(%s\t(working copy)), path);
+
+  return label;
+}
+
+
+
+
 /* A helper func that writes out verbal descriptions of property diffs
to FILE.   Of course, the apr_file_t will probably be the 'outfile'
passed to svn_client_diff5, which is probably stdout. */
@@ -286,9 +307,14 @@ static svn_error_t *
 display_prop_diffs(const apr_array_header_t *propchanges,
apr_hash_t *original_props,
const char *path,
+   const char *orig_path1,
+   const char *orig_path2,
+   svn_revnum_t rev1,
+   svn_revnum_t rev2,
const char *encoding,
apr_file_t *file,
const char *relative_to_dir,
+   svn_boolean_t show_diff_header,
apr_pool_t *pool)
 {
   int i;
@@ -307,6 +333,39 @@ display_prop_diffs(const apr_array_heade
 return MAKE_ERR_BAD_RELATIVE_PATH(path, relative_to_dir);
 }
 
+  /* If we're creating a diff on the wc root, path would be empty. */
+  if (path[0] == '\0')
+path = apr_psprintf(pool, .);
+
+if (show_diff_header)
+  {
+const char *path1 = orig_path1;
+const char *path2 = orig_path2;
+const char *label1;
+const char *label2;
+
+SVN_ERR(adjust_paths_for_diff_labels(path1, path2, path,
+ relative_to_dir, pool));
+
+label1 = diff_label

svn commit: r961775 - /subversion/trunk/subversion/libsvn_client/diff.c

2010-07-08 Thread dannas
Author: dannas
Date: Thu Jul  8 14:08:43 2010
New Revision: 961775

URL: http://svn.apache.org/viewvc?rev=961775view=rev
Log:
Move code that deals with adjusting paths for output to its own function.
No semantic changes.

Makes the code more readable and allows us to resuse the logic when
creating diff headers for paths with only property changes.

* subversion/libsvn_client/diff.c
  (diff_content_changed): Move code that adjusts the paths to be
displayed in the diff labels from here ..
  (adjust_paths_for_diff_labels): .. To here.

Modified:
subversion/trunk/subversion/libsvn_client/diff.c

Modified: subversion/trunk/subversion/libsvn_client/diff.c
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/diff.c?rev=961775r1=961774r2=961775view=diff
==
--- subversion/trunk/subversion/libsvn_client/diff.c (original)
+++ subversion/trunk/subversion/libsvn_client/diff.c Thu Jul  8 14:08:43 2010
@@ -190,6 +190,93 @@ maybe_append_eol(const svn_string_t *tok
 }
 }
 
+/* Adjust NEW_PATH1 and NEW_PATH2 to properly describe what paths has been
+ * compared taking RELATIVE_TO_DIR into account. All allocations are done in
+ * POOL. */
+static svn_error_t *
+adjust_paths_for_diff_labels(const char **path1,
+ const char **path2,
+ const char *path,
+ const char *relative_to_dir,
+ apr_pool_t *pool)
+{
+  apr_size_t len;
+  const char *new_path1 = *path1;
+  const char *new_path2 = *path2;
+
+  /* ### Holy cow.  Due to anchor/target weirdness, we can't
+ simply join diff_cmd_baton-orig_path_1 with path, ditto for
+ orig_path_2.  That will work when they're directory URLs, but
+ not for file URLs.  Nor can we just use anchor1 and anchor2
+ from do_diff(), at least not without some more logic here.
+ What a nightmare.
+
+ For now, to distinguish the two paths, we'll just put the
+ unique portions of the original targets in parentheses after
+ the received path, with ellipses for handwaving.  This makes
+ the labels a bit clumsy, but at least distinctive.  Better
+ solutions are possible, they'll just take more thought. */
+
+  len = strlen(svn_dirent_get_longest_ancestor(new_path1, new_path2, pool));
+  new_path1 = new_path1 + len;
+  new_path2 = new_path2 + len;
+
+  /* ### Should diff labels print paths in local style?  Is there
+ already a standard for this?  In any case, this code depends on
+ a particular style, so not calling svn_dirent_local_style() on the
+ paths below.*/
+  if (new_path1[0] == '\0')
+new_path1 = apr_psprintf(pool, %s, path);
+  else if (new_path1[0] == '/')
+new_path1 = apr_psprintf(pool, %s\t(...%s), path, new_path1);
+  else
+new_path1 = apr_psprintf(pool, %s\t(.../%s), path, new_path1);
+
+  if (new_path2[0] == '\0')
+new_path2 = apr_psprintf(pool, %s, path);
+  else if (new_path2[0] == '/')
+new_path2 = apr_psprintf(pool, %s\t(...%s), path, new_path2);
+  else
+new_path2 = apr_psprintf(pool, %s\t(.../%s), path, new_path2);
+
+  if (relative_to_dir)
+{
+  /* Possibly adjust the paths shown in the output (see issue #2723). */
+  const char *child_path = svn_dirent_is_child(relative_to_dir, path,
+   pool);
+
+  if (child_path)
+path = child_path;
+  else if (!svn_path_compare_paths(relative_to_dir, path))
+path = .;
+  else
+return MAKE_ERR_BAD_RELATIVE_PATH(path, relative_to_dir);
+
+  child_path = svn_dirent_is_child(relative_to_dir, new_path1, pool);
+
+  if (child_path)
+new_path1 = child_path;
+  else if (!svn_path_compare_paths(relative_to_dir, new_path1))
+new_path1 = .;
+  else
+return MAKE_ERR_BAD_RELATIVE_PATH(new_path1, relative_to_dir);
+
+  child_path = svn_dirent_is_child(relative_to_dir, new_path2, pool);
+
+  if (child_path)
+new_path2 = child_path;
+  else if (!svn_path_compare_paths(relative_to_dir, new_path2))
+new_path2 = .;
+  else
+return MAKE_ERR_BAD_RELATIVE_PATH(new_path2, relative_to_dir);
+}
+  *path1 = new_path1;
+  *path2 = new_path2;
+
+  return SVN_NO_ERROR;
+}
+
+
 /* A helper func that writes out verbal descriptions of property diffs
to FILE.   Of course, the apr_file_t will probably be the 'outfile'
passed to svn_client_diff5, which is probably stdout. */
@@ -532,80 +619,17 @@ diff_content_changed(const char *path,
   const char *label1, *label2;
   svn_boolean_t mt1_binary = FALSE, mt2_binary = FALSE;
   const char *path1, *path2;
-  apr_size_t len;
 
   /* Get a stream from our output file. */
   os = svn_stream_from_aprfile2(diff_cmd_baton-outfile, TRUE, subpool);
 
   /* Generate the diff headers. */
 
-  /* ### Holy cow.  Due to anchor/target weirdness, we can't
- simply join

svn commit: r961789 - /subversion/trunk/subversion/libsvn_client/diff.c

2010-07-08 Thread dannas
Author: dannas
Date: Thu Jul  8 14:47:52 2010
New Revision: 961789

URL: http://svn.apache.org/viewvc?rev=961789view=rev
Log:
Follow-up to r961775. Make the doc string a bit clearer atleast.

* subversion/libsvn_client/diff.c
  (adjust_paths_for_diff_labels): See above.

Modified:
subversion/trunk/subversion/libsvn_client/diff.c

Modified: subversion/trunk/subversion/libsvn_client/diff.c
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/diff.c?rev=961789r1=961788r2=961789view=diff
==
--- subversion/trunk/subversion/libsvn_client/diff.c (original)
+++ subversion/trunk/subversion/libsvn_client/diff.c Thu Jul  8 14:47:52 2010
@@ -190,9 +190,11 @@ maybe_append_eol(const svn_string_t *tok
 }
 }
 
-/* Adjust NEW_PATH1 and NEW_PATH2 to properly describe what paths has been
- * compared taking RELATIVE_TO_DIR into account. All allocations are done in
- * POOL. */
+/* Adjust PATH1 and PATH2, representing the original targets passed to the
+ * the diff command, to handle the case when we're dealing with different
+ * anchors. PATH represents the file that has changed. RELATIVE_TO_DIR is
+ * the directory the diff target should be considered relative to. All
+ * allocations are done in POOL. */
 static svn_error_t *
 adjust_paths_for_diff_labels(const char **path1,
  const char **path2,




svn commit: r960800 - /subversion/trunk/subversion/tests/cmdline/patch_tests.py

2010-07-06 Thread dannas
Author: dannas
Date: Tue Jul  6 06:08:09 2010
New Revision: 960800

URL: http://svn.apache.org/viewvc?rev=960800view=rev
Log:
Add XFailing test for applying property diffs.

The patch code can parse property diffs but it can not yet apply the 
found changes to a working copy.

* subversion/tests/cmdline/patch_tests.py
  (patch_with_properties): New.
  (test_list): Add new test.

Modified:
subversion/trunk/subversion/tests/cmdline/patch_tests.py

Modified: subversion/trunk/subversion/tests/cmdline/patch_tests.py
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/patch_tests.py?rev=960800r1=960799r2=960800view=diff
==
--- subversion/trunk/subversion/tests/cmdline/patch_tests.py (original)
+++ subversion/trunk/subversion/tests/cmdline/patch_tests.py Tue Jul  6 
06:08:09 2010
@@ -2162,6 +2162,67 @@ def patch_no_eol_at_eof(sbox):
1, # check-props
1) # dry-run
 
+### We need to add deletes and adds of properties to this test.
+def patch_with_properties(sbox):
+  patch with properties
+
+  sbox.build()
+  wc_dir = sbox.wc_dir
+
+  patch_file_path = make_patch_path(sbox)
+  iota_path = os.path.join(wc_dir, 'iota')
+
+  iota_prop_contents = This is the property 'iota_prop'.\n
+
+  # Set iota contents
+  svntest.main.run_svn(None, 'propset', 'prop', iota_prop_contents,
+   iota_path)
+  expected_output = svntest.wc.State(wc_dir, {
+  'iota': Item(verb='Sending'),
+  })
+  expected_status = svntest.actions.get_virginal_state(wc_dir, 1)
+  expected_status.tweak('iota', wc_rev=2)
+  svntest.actions.run_and_verify_commit(wc_dir, expected_output,
+expected_status, None, wc_dir)
+  # Apply patch
+
+  unidiff_patch = [
+Index: iota\n,
+===\n,
+--- iota\t(revision 1)\n,
++++ iota\t(working copy)\n,
+Property changes on: iota\n,
+---\n,
+Modified: prop\n,
+## -1 +1 \n,
+-This is the property 'iota_prop'.\n,
++This is the property 'prop'.\n,
+  ]
+
+  svntest.main.file_write(patch_file_path, ''.join(unidiff_patch))
+
+  iota_prop_contents = This is the property 'prop'.\n
+
+  expected_output = [
+property 'prop' set on '%s\n' % os.path.join(wc_dir, 'iota'),
+  ]
+
+  expected_disk = svntest.main.greek_state.copy()
+  expected_disk.tweak('iota', props={'prop' : iota_prop_contents})
+  expected_status = svntest.actions.get_virginal_state(wc_dir, 1)
+  expected_status.tweak('iota', status=' M')
+
+  expected_skip = wc.State('', { })
+
+  svntest.actions.run_and_verify_patch(wc_dir, 
os.path.abspath(patch_file_path),
+   expected_output,
+   expected_disk,
+   expected_status,
+   expected_skip,
+   None, # expected err
+   1, # check-props
+   1) # dry-run
+
 
 #Run the tests
 
@@ -2185,6 +2246,7 @@ test_list = [ None,
   patch_with_ignore_whitespace,
   patch_replace_locally_deleted_file,
   patch_no_eol_at_eof,
+  XFail(patch_with_properties),
 ]
 
 if __name__ == '__main__':




  1   2   >