subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject svn commit: r934607 - in /subversion/branches/svn-patch-improvements: ./ subversion/include/ subversion/include/private/ subversion/libsvn_client/ subversion/libsvn_diff/ subversion/libsvn_fs_fs/ subversion/libsvn_ra_svn/ subversion/libsvn_subr/ subver...
Date Thu, 15 Apr 2010 21:48:43 GMT
Author: stsp
Date: Thu Apr 15 21:48:42 2010
New Revision: 934607

URL: http://svn.apache.org/viewvc?rev=934607&view=rev
Log:
Sync the svn-patch-improvements branch with trunk.

Added:
    subversion/branches/svn-patch-improvements/subversion/libsvn_subr/internal_statements.sql
      - copied unchanged from r934587, subversion/trunk/subversion/libsvn_subr/internal_statements.sql
Modified:
    subversion/branches/svn-patch-improvements/   (props changed)
    subversion/branches/svn-patch-improvements/CHANGES
    subversion/branches/svn-patch-improvements/build.conf
    subversion/branches/svn-patch-improvements/subversion/include/private/svn_sqlite.h
    subversion/branches/svn-patch-improvements/subversion/include/private/svn_wc_private.h
    subversion/branches/svn-patch-improvements/subversion/include/svn_client.h
    subversion/branches/svn-patch-improvements/subversion/include/svn_diff.h
    subversion/branches/svn-patch-improvements/subversion/include/svn_subst.h
    subversion/branches/svn-patch-improvements/subversion/libsvn_client/blame.c
    subversion/branches/svn-patch-improvements/subversion/libsvn_client/merge.c
    subversion/branches/svn-patch-improvements/subversion/libsvn_client/patch.c
    subversion/branches/svn-patch-improvements/subversion/libsvn_diff/parse-diff.c
    subversion/branches/svn-patch-improvements/subversion/libsvn_fs_fs/fs_fs.c
    subversion/branches/svn-patch-improvements/subversion/libsvn_ra_svn/client.c
    subversion/branches/svn-patch-improvements/subversion/libsvn_subr/   (props changed)
    subversion/branches/svn-patch-improvements/subversion/libsvn_subr/sqlite.c
    subversion/branches/svn-patch-improvements/subversion/libsvn_wc/adm_crawler.c
    subversion/branches/svn-patch-improvements/subversion/libsvn_wc/adm_ops.c
    subversion/branches/svn-patch-improvements/subversion/libsvn_wc/entries.c
    subversion/branches/svn-patch-improvements/subversion/libsvn_wc/questions.c
    subversion/branches/svn-patch-improvements/subversion/libsvn_wc/update_editor.c
    subversion/branches/svn-patch-improvements/subversion/libsvn_wc/wc.h
    subversion/branches/svn-patch-improvements/subversion/libsvn_wc/wc_db.c
    subversion/branches/svn-patch-improvements/subversion/libsvn_wc/wc_db.h
    subversion/branches/svn-patch-improvements/subversion/svn/cl.h
    subversion/branches/svn-patch-improvements/subversion/svn/main.c
    subversion/branches/svn-patch-improvements/subversion/svn/patch-cmd.c
    subversion/branches/svn-patch-improvements/subversion/tests/cmdline/merge_tests.py
    subversion/branches/svn-patch-improvements/subversion/tests/cmdline/patch_tests.py
    subversion/branches/svn-patch-improvements/subversion/tests/libsvn_client/client-test.c
    subversion/branches/svn-patch-improvements/subversion/tests/libsvn_diff/parse-diff-test.c

Propchange: subversion/branches/svn-patch-improvements/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Thu Apr 15 21:48:42 2010
@@ -33,4 +33,4 @@
 /subversion/branches/tc_url_rev:874351-874483
 /subversion/branches/tree-conflicts:868291-873154
 /subversion/branches/tree-conflicts-notify:873926-874008
-/subversion/trunk:918519-933862
+/subversion/trunk:918519-934587

Modified: subversion/branches/svn-patch-improvements/CHANGES
URL: http://svn.apache.org/viewvc/subversion/branches/svn-patch-improvements/CHANGES?rev=934607&r1=934606&r2=934607&view=diff
==============================================================================
--- subversion/branches/svn-patch-improvements/CHANGES (original)
+++ subversion/branches/svn-patch-improvements/CHANGES Thu Apr 15 21:48:42 2010
@@ -1,6 +1,6 @@
-Version 1.6.10
-(02 Apr 2010, from /branches/1.6.x)
-http://svn.apache.org/repos/asf/subversion/tags/1.6.10
+Version 1.6.11
+(19 Apr 2010, from /branches/1.6.x)
+http://svn.apache.org/repos/asf/subversion/tags/1.6.11
 
  User-visible changes:
   * fix for repositories mounted via NFS (issue #3501)
@@ -16,6 +16,7 @@ http://svn.apache.org/repos/asf/subversi
   * update relative externals during a switch (issue #3390)
   * fix 'merge --reintegrate' with self-referential mergeinfo (r892050, -85)
   * improve wc-ng working copy detection (r929382)
+  * improve handling of mergeinfo when using serf (r880461)
   * fixed: 'svnlook plist --revprop' with '-t TXN_NAME' (r917640, -8211)
   * fixed: file external from URL cannot overwrite existing item (issue #3552)
   * fixed: potential memory error in 'svn status' (r923674, -9)
@@ -29,6 +30,10 @@ http://svn.apache.org/repos/asf/subversi
   * ensure rangelist APIs are commutative (r923389, -91)
 
 
+Version 1.6.10
+(Not released, see changes for 1.6.11.)
+
+
 Version 1.6.9
 (25 Jan 2010, from /branches/1.6.x)
 http://svn.apache.org/repos/asf/subversion/tags/1.6.9

Modified: subversion/branches/svn-patch-improvements/build.conf
URL: http://svn.apache.org/viewvc/subversion/branches/svn-patch-improvements/build.conf?rev=934607&r1=934606&r2=934607&view=diff
==============================================================================
--- subversion/branches/svn-patch-improvements/build.conf (original)
+++ subversion/branches/svn-patch-improvements/build.conf Thu Apr 15 21:48:42 2010
@@ -45,6 +45,7 @@ private-built-includes =
         subversion/libsvn_wc/wc-metadata.h
         subversion/libsvn_wc/wc-queries.h
         subversion/libsvn_wc/wc-checks.h
+        subversion/libsvn_subr/internal_statements.h
         subversion/bindings/swig/proxy/swig_python_external_runtime.swg
         subversion/bindings/swig/proxy/swig_perl_external_runtime.swg
         subversion/bindings/swig/proxy/swig_ruby_external_runtime.swg
@@ -380,6 +381,12 @@ type = sql-header
 path = subversion/libsvn_wc
 sources = wc-checks.sql
 
+[subr_sqlite]
+description = Internal statements for SQLite interface
+type = sql-header
+path = subversion/libsvn_subr
+sources = internal_statements.sql
+
 
 # ----------------------------------------------------------------------------
 #

Modified: subversion/branches/svn-patch-improvements/subversion/include/private/svn_sqlite.h
URL: http://svn.apache.org/viewvc/subversion/branches/svn-patch-improvements/subversion/include/private/svn_sqlite.h?rev=934607&r1=934606&r2=934607&view=diff
==============================================================================
--- subversion/branches/svn-patch-improvements/subversion/include/private/svn_sqlite.h (original)
+++ subversion/branches/svn-patch-improvements/subversion/include/private/svn_sqlite.h Thu Apr 15 21:48:42 2010
@@ -310,6 +310,12 @@ svn_sqlite__with_transaction(svn_sqlite_
                              void *cb_baton, apr_pool_t *scratch_pool);
 
 
+/* Hotcopy an SQLite database from SRC_PATH to DST_PATH. */
+svn_error_t *
+svn_sqlite__hotcopy(const char *src_path,
+                    const char *dst_path,
+                    apr_pool_t *scratch_pool);
+
 #ifdef __cplusplus
 }
 #endif /* __cplusplus */

Modified: subversion/branches/svn-patch-improvements/subversion/include/private/svn_wc_private.h
URL: http://svn.apache.org/viewvc/subversion/branches/svn-patch-improvements/subversion/include/private/svn_wc_private.h?rev=934607&r1=934606&r2=934607&view=diff
==============================================================================
--- subversion/branches/svn-patch-improvements/subversion/include/private/svn_wc_private.h (original)
+++ subversion/branches/svn-patch-improvements/subversion/include/private/svn_wc_private.h Thu Apr 15 21:48:42 2010
@@ -110,8 +110,7 @@ svn_wc__changelist_match(svn_wc_context_
  * for VERSIONED_FILE_ABSPATH's eol and keyword properties, but leaves
  * BASE_FILE_ABSPATH alone (as though BASE_FILE_ABSPATH were a text-base file,
  * which it usually is, only sometimes we're calling this on incoming
- * temporary text-bases).  If COMPARE_TEXTBASES is false, a clean copy of the
- * versioned file is compared to VERSIONED_FILE_ABSPATH.
+ * temporary text-bases).
  *
  * If an error is returned, the effect on *MODIFIED_P is undefined.
  *

Modified: subversion/branches/svn-patch-improvements/subversion/include/svn_client.h
URL: http://svn.apache.org/viewvc/subversion/branches/svn-patch-improvements/subversion/include/svn_client.h?rev=934607&r1=934606&r2=934607&view=diff
==============================================================================
--- subversion/branches/svn-patch-improvements/subversion/include/svn_client.h (original)
+++ subversion/branches/svn-patch-improvements/subversion/include/svn_client.h Thu Apr 15 21:48:42 2010
@@ -4906,6 +4906,7 @@ svn_client_patch(const char *abs_patch_p
                  const apr_array_header_t *exclude_patterns,
                  apr_hash_t **patched_tempfiles,
                  apr_hash_t **reject_tempfiles,
+                 svn_boolean_t ignore_whitespaces,
                  svn_client_ctx_t *ctx,
                  apr_pool_t *result_pool,
                  apr_pool_t *scratch_pool);

Modified: subversion/branches/svn-patch-improvements/subversion/include/svn_diff.h
URL: http://svn.apache.org/viewvc/subversion/branches/svn-patch-improvements/subversion/include/svn_diff.h?rev=934607&r1=934606&r2=934607&view=diff
==============================================================================
--- subversion/branches/svn-patch-improvements/subversion/include/svn_diff.h (original)
+++ subversion/branches/svn-patch-improvements/subversion/include/svn_diff.h Thu Apr 15 21:48:42 2010
@@ -866,6 +866,7 @@ svn_error_t *
 svn_diff_parse_next_patch(svn_patch_t **patch,
                           apr_file_t *patch_file,
                           svn_boolean_t reverse,
+                          svn_boolean_t ignore_whitespaces,
                           apr_pool_t *result_pool,
                           apr_pool_t *scratch_pool);
 

Modified: subversion/branches/svn-patch-improvements/subversion/include/svn_subst.h
URL: http://svn.apache.org/viewvc/subversion/branches/svn-patch-improvements/subversion/include/svn_subst.h?rev=934607&r1=934606&r2=934607&view=diff
==============================================================================
--- subversion/branches/svn-patch-improvements/subversion/include/svn_subst.h (original)
+++ subversion/branches/svn-patch-improvements/subversion/include/svn_subst.h Thu Apr 15 21:48:42 2010
@@ -198,15 +198,16 @@ svn_subst_keywords_differ(const svn_subs
 
 
 /**
- * Copy and translate the data in stream @a src into stream @a dst.  It is
- * assumed that @a src is a readable stream and @a dst is a writable stream.
- *
- * If @a eol_str is non-@c NULL, replace whatever bytestring @a src uses to
- * denote line endings with @a eol_str in the output.  If @a src has an
- * inconsistent line ending style, then: if @a repair is @c FALSE, return
- * @c SVN_ERR_IO_INCONSISTENT_EOL, else if @a repair is @c TRUE, convert any
- * line ending in @a src to @a eol_str in @a dst.  Recognized line endings are:
- * "\n", "\r", and "\r\n".
+ * Copy and translate the data in @a src_stream into @a dst_stream.  It is
+ * assumed that @a src_stream is a readable stream and @a dst_stream is a
+ * writable stream.
+ *
+ * If @a eol_str is non-@c NULL, replace whatever bytestring @a src_stream
+ * uses to denote line endings with @a eol_str in the output.  If
+ * @a src_stream has an inconsistent line ending style, then: if @a repair
+ * is @c FALSE, return @c SVN_ERR_IO_INCONSISTENT_EOL, else if @a repair is
+ * @c TRUE, convert any line ending in @a src_stream to @a eol_str in
+ * @a dst_stream.  Recognized line endings are: "\n", "\r", and "\r\n".
  *
  * Expand and contract keywords using the contents of @a keywords as the
  * new values.  If @a expand is @c TRUE, expand contracted keywords and
@@ -293,11 +294,12 @@ svn_subst_translate_stream(svn_stream_t 
  * operations.  Reads and writes may be mixed.
  *
  * If @a eol_str is non-@c NULL, replace whatever bytestring the input uses
- * to denote line endings with @a eol_str in the output.  If the input has an
- * inconsistent line ending style, then: if @a repair is @c FALSE, return
- * @c SVN_ERR_IO_INCONSISTENT_EOL, else if @a repair is @c TRUE, convert any
- * line ending to @a eol_str in @a .  Recognized line endings are:
- * "\n", "\r", and "\r\n".
+ * to denote line endings with @a eol_str in the output.  If the input has
+ * an inconsistent line ending style, then: if @a repair is @c FALSE, then a
+ * subsequent read, write or other operation on the stream will return
+ * @c SVN_ERR_IO_INCONSISTENT_EOL when the inconsistency is detected, else
+ * if @a repair is @c TRUE, convert any line ending to @a eol_str.
+ * Recognized line endings are: "\n", "\r", and "\r\n".
  *
  * The stream returned is allocated in @a pool.
  *

Modified: subversion/branches/svn-patch-improvements/subversion/libsvn_client/blame.c
URL: http://svn.apache.org/viewvc/subversion/branches/svn-patch-improvements/subversion/libsvn_client/blame.c?rev=934607&r1=934606&r2=934607&view=diff
==============================================================================
--- subversion/branches/svn-patch-improvements/subversion/libsvn_client/blame.c (original)
+++ subversion/branches/svn-patch-improvements/subversion/libsvn_client/blame.c Thu Apr 15 21:48:42 2010
@@ -107,8 +107,8 @@ struct delta_baton {
   svn_txdelta_window_handler_t wrapped_handler;
   void *wrapped_baton;
   struct file_rev_baton *file_rev_baton;
-  apr_file_t *source_file;  /* the delta source */
-  apr_file_t *file;  /* the result of the delta */
+  svn_stream_t *source_stream;  /* the delta source */
+  svn_stream_t *stream;  /* the result of the delta */
   const char *filename;
 };
 
@@ -325,9 +325,9 @@ window_handler(svn_txdelta_window_t *win
      It is important to do this early, since otherwise, they will be deleted
      before all handles are closed, which leads to failures on some platforms
      when new tempfiles are to be created. */
-  if (dbaton->source_file)
-    SVN_ERR(svn_io_file_close(dbaton->source_file, frb->currpool));
-  SVN_ERR(svn_io_file_close(dbaton->file, frb->currpool));
+  if (dbaton->source_stream)
+    SVN_ERR(svn_stream_close(dbaton->source_stream));
+  SVN_ERR(svn_stream_close(dbaton->stream));
 
   /* If we are including merged revisions, we need to add each rev to the
      merged chain. */
@@ -455,24 +455,24 @@ file_rev_handler(void *baton, const char
 
   /* Prepare the text delta window handler. */
   if (frb->last_filename)
-    SVN_ERR(svn_io_file_open(&delta_baton->source_file, frb->last_filename,
-                             APR_READ, APR_OS_DEFAULT, frb->currpool));
+    SVN_ERR(svn_stream_open_readonly(&delta_baton->source_stream, frb->last_filename,
+                                     frb->currpool, pool));
   else
     /* Means empty stream below. */
-    delta_baton->source_file = NULL;
-  last_stream = svn_stream_from_aprfile2(delta_baton->source_file, TRUE, pool);
+    delta_baton->source_stream = NULL;
+  last_stream = svn_stream_disown(delta_baton->source_stream, pool);
 
   if (frb->include_merged_revisions && !frb->merged_revision)
     filepool = frb->filepool;
   else
     filepool = frb->currpool;
 
-  SVN_ERR(svn_io_open_unique_file3(&delta_baton->file,
-                                   &delta_baton->filename,
-                                   NULL,
-                                   svn_io_file_del_on_pool_cleanup,
-                                   filepool, filepool));
-  cur_stream = svn_stream_from_aprfile2(delta_baton->file, TRUE, frb->currpool);
+  SVN_ERR(svn_stream_open_unique(&delta_baton->stream,
+                                 &delta_baton->filename,
+                                 NULL,
+                                 svn_io_file_del_on_pool_cleanup,
+                                 filepool, filepool));
+  cur_stream = svn_stream_disown(delta_baton->stream, filepool);
 
   /* Get window handler for applying delta. */
   svn_txdelta_apply(last_stream, cur_stream, NULL, NULL,

Modified: subversion/branches/svn-patch-improvements/subversion/libsvn_client/merge.c
URL: http://svn.apache.org/viewvc/subversion/branches/svn-patch-improvements/subversion/libsvn_client/merge.c?rev=934607&r1=934606&r2=934607&view=diff
==============================================================================
--- subversion/branches/svn-patch-improvements/subversion/libsvn_client/merge.c (original)
+++ subversion/branches/svn-patch-improvements/subversion/libsvn_client/merge.c Thu Apr 15 21:48:42 2010
@@ -1812,8 +1812,9 @@ properties_same_p(svn_boolean_t *same,
   return SVN_NO_ERROR;
 }
 
-/* Compare the file OLDER (together with its normal properties in
- * ORIGINAL_PROPS which may also contain WC props and entry props) and MINE.
+/* Compare the file OLDER_ABSPATH (together with its normal properties in
+ * ORIGINAL_PROPS which may also contain WC props and entry props) with the
+ * versioned file MINE_ABSPATH (together with its versioned properties).
  * Set *SAME to true if they are the same or false if they differ, ignoring
  * the "svn:mergeinfo" property, and ignoring differences in keyword
  * expansion and end-of-line style. */
@@ -8614,9 +8615,9 @@ svn_client_merge3(const char *source1,
 }
 
 
-/* If TARGET_WCPATH does not reflect a single-revision,
-   svn_depth_infinity, pristine, unswitched working copy -- in other
-   words, a subtree found in a single revision -- raise
+/* If TARGET_WCPATH does not reflect a single-revision, pristine,
+   unswitched working copy -- in other words, a subtree found in a
+   single revision (although sparse checkouts are permitted) -- raise
    SVN_ERR_CLIENT_NOT_READY_TO_MERGE. */
 static svn_error_t *
 ensure_wc_reflects_repository_subtree(const char *target_abspath,
@@ -8635,11 +8636,6 @@ ensure_wc_reflects_repository_subtree(co
                             _("Cannot reintegrate into a working copy "
                               "with a switched subtree"));
 
-  if (wc_stat->sparse_checkout)
-    return svn_error_create(SVN_ERR_CLIENT_NOT_READY_TO_MERGE, NULL,
-                            _("Cannot reintegrate into a working copy "
-                              "not entirely at infinite depth"));
-
   if (wc_stat->modified)
     return svn_error_create(SVN_ERR_CLIENT_NOT_READY_TO_MERGE, NULL,
                             _("Cannot reintegrate into a working copy "

Modified: subversion/branches/svn-patch-improvements/subversion/libsvn_client/patch.c
URL: http://svn.apache.org/viewvc/subversion/branches/svn-patch-improvements/subversion/libsvn_client/patch.c?rev=934607&r1=934606&r2=934607&view=diff
==============================================================================
--- subversion/branches/svn-patch-improvements/subversion/libsvn_client/patch.c (original)
+++ subversion/branches/svn-patch-improvements/subversion/libsvn_client/patch.c Thu Apr 15 21:48:42 2010
@@ -629,7 +629,8 @@ seek_to_line(patch_target_t *target, svn
  * POOL. */
 static svn_error_t *
 match_hunk(svn_boolean_t *matched, patch_target_t *target,
-           const svn_hunk_t *hunk, int fuzz, apr_pool_t *pool)
+           const svn_hunk_t *hunk, int fuzz, 
+           svn_boolean_t ignore_whitespaces, apr_pool_t *pool)
 {
   svn_stringbuf_t *hunk_line;
   const char *target_line;
@@ -674,7 +675,22 @@ match_hunk(svn_boolean_t *matched, patch
                    hunk->trailing_context > fuzz)
             lines_matched = TRUE;
           else
-            lines_matched = ! strcmp(hunk_line_translated, target_line);
+            {
+              if (ignore_whitespaces)
+                {
+                  char *stripped_hunk_line = apr_pstrdup(pool,
+                                                         hunk_line_translated);
+                  char *stripped_target_line = apr_pstrdup(pool, target_line);
+
+                  apr_collapse_spaces(stripped_hunk_line,
+                                      hunk_line_translated);
+                  apr_collapse_spaces(stripped_target_line, target_line);
+                  lines_matched = ! strcmp(stripped_hunk_line,
+                                           stripped_target_line);
+                }
+              else 
+                lines_matched = ! strcmp(hunk_line_translated, target_line);
+            }
         }
     }
   while (lines_matched && ! (hunk_eof || target->eof));
@@ -712,7 +728,9 @@ match_hunk(svn_boolean_t *matched, patch
 static svn_error_t *
 scan_for_match(svn_linenum_t *matched_line, patch_target_t *target,
                const svn_hunk_t *hunk, svn_boolean_t match_first,
-               svn_linenum_t upper_line, int fuzz, apr_pool_t *pool)
+               svn_linenum_t upper_line, int fuzz, 
+               svn_boolean_t ignore_whitespaces,
+               apr_pool_t *pool)
 {
   apr_pool_t *iterpool;
 
@@ -726,7 +744,8 @@ scan_for_match(svn_linenum_t *matched_li
 
       svn_pool_clear(iterpool);
 
-      SVN_ERR(match_hunk(&matched, target, hunk, fuzz, iterpool));
+      SVN_ERR(match_hunk(&matched, target, hunk, fuzz, ignore_whitespaces,
+                         iterpool));
       if (matched)
         {
           svn_boolean_t taken = FALSE;
@@ -770,7 +789,8 @@ scan_for_match(svn_linenum_t *matched_li
  * Do temporary allocations in POOL. */
 static svn_error_t *
 get_hunk_info(hunk_info_t **hi, patch_target_t *target,
-              const svn_hunk_t *hunk, int fuzz, apr_pool_t *result_pool,
+              const svn_hunk_t *hunk, int fuzz, 
+              svn_boolean_t ignore_whitespaces, apr_pool_t *result_pool,
               apr_pool_t *scratch_pool)
 {
   svn_linenum_t matched_line;
@@ -800,7 +820,8 @@ get_hunk_info(hunk_info_t **hi, patch_ta
         }
       else
         SVN_ERR(scan_for_match(&matched_line, target, hunk, TRUE,
-                               hunk->original_start + 1, fuzz, scratch_pool));
+                               hunk->original_start + 1, fuzz,
+                               ignore_whitespaces, scratch_pool));
 
       if (matched_line != hunk->original_start)
         {
@@ -810,7 +831,8 @@ get_hunk_info(hunk_info_t **hi, patch_ta
           /* Scan forward towards the hunk's line and look for a line
            * where the hunk matches. */
           SVN_ERR(scan_for_match(&matched_line, target, hunk, FALSE,
-                                 hunk->original_start, fuzz, scratch_pool));
+                                 hunk->original_start, fuzz,
+                                 ignore_whitespaces, scratch_pool));
 
           /* In tie-break situations, we arbitrarily prefer early matches
            * to save us from scanning the rest of the file. */
@@ -819,7 +841,8 @@ get_hunk_info(hunk_info_t **hi, patch_ta
               /* Scan forward towards the end of the file and look
                * for a line where the hunk matches. */
               SVN_ERR(scan_for_match(&matched_line, target, hunk, TRUE, 0,
-                                     fuzz, scratch_pool));
+                                     fuzz, ignore_whitespaces,
+                                     scratch_pool));
             }
         }
 
@@ -1116,6 +1139,7 @@ apply_one_patch(patch_target_t **patch_t
                 const apr_array_header_t *exclude_patterns,
                 apr_hash_t *patched_tempfiles,
                 apr_hash_t *reject_tempfiles,
+                svn_boolean_t ignore_whitespaces,
                 apr_pool_t *result_pool, apr_pool_t *scratch_pool)
 {
   patch_target_t *target;
@@ -1151,7 +1175,7 @@ apply_one_patch(patch_target_t **patch_t
       do
         {
           SVN_ERR(get_hunk_info(&hi, target, hunk, fuzz,
-                                result_pool, iterpool));
+                                ignore_whitespaces, result_pool, iterpool));
           fuzz++;
         }
       while (hi->rejected && fuzz <= MAX_FUZZ);
@@ -1731,6 +1755,10 @@ typedef struct {
   /* Mapping patch target path -> path to tempfile with rejected hunks. */
   apr_hash_t *reject_tempfiles;
 
+  /* Indicates whether we should ignore whitespaces when matching context
+   * lines */
+  svn_boolean_t ignore_whitespaces;
+
 
   /* The client context. */
   svn_client_ctx_t *ctx;
@@ -1777,7 +1805,8 @@ apply_patches(void *baton,
         SVN_ERR(btn->ctx->cancel_func(btn->ctx->cancel_baton));
 
       SVN_ERR(svn_diff_parse_next_patch(&patch, patch_file,
-                                        btn->reverse, scratch_pool, iterpool));
+                                        btn->reverse, btn->ignore_whitespaces,
+                                        scratch_pool, iterpool));
       if (patch)
         {
           patch_target_t *target;
@@ -1786,6 +1815,7 @@ apply_patches(void *baton,
                                   btn->ctx->wc_ctx, btn->strip_count,
                                   btn->include_patterns, btn->exclude_patterns,
                                   btn->patched_tempfiles, btn->reject_tempfiles,
+                                  btn->ignore_whitespaces,
                                   result_pool, iterpool));
           if (target->filtered)
             SVN_ERR(svn_diff_close_patch(patch));
@@ -1835,6 +1865,7 @@ svn_client_patch(const char *abs_patch_p
                  const apr_array_header_t *exclude_patterns,
                  apr_hash_t **patched_tempfiles,
                  apr_hash_t **reject_tempfiles,
+                 svn_boolean_t ignore_whitespaces,
                  svn_client_ctx_t *ctx,
                  apr_pool_t *result_pool,
                  apr_pool_t *scratch_pool)
@@ -1853,7 +1884,9 @@ svn_client_patch(const char *abs_patch_p
   baton.reverse = reverse;
   baton.include_patterns = include_patterns;
   baton.exclude_patterns = exclude_patterns;
-  if (patched_tempfiles)
+  baton.ignore_whitespaces = ignore_whitespaces;
+
+ if (patched_tempfiles)
     {
       (*patched_tempfiles) = apr_hash_make(result_pool);
       baton.patched_tempfiles = (*patched_tempfiles);

Modified: subversion/branches/svn-patch-improvements/subversion/libsvn_diff/parse-diff.c
URL: http://svn.apache.org/viewvc/subversion/branches/svn-patch-improvements/subversion/libsvn_diff/parse-diff.c?rev=934607&r1=934606&r2=934607&view=diff
==============================================================================
--- subversion/branches/svn-patch-improvements/subversion/libsvn_diff/parse-diff.c (original)
+++ subversion/branches/svn-patch-improvements/subversion/libsvn_diff/parse-diff.c Thu Apr 15 21:48:42 2010
@@ -268,6 +268,7 @@ parse_next_hunk(svn_hunk_t **hunk,
                 svn_patch_t *patch,
                 svn_stream_t *stream,
                 svn_boolean_t reverse,
+                svn_boolean_t ignore_whitespaces,
                 apr_pool_t *result_pool,
                 apr_pool_t *scratch_pool)
 {
@@ -355,8 +356,10 @@ parse_next_hunk(svn_hunk_t **hunk,
 
           c = line->data[0];
           /* Tolerate chopped leading spaces on empty lines. */
-          if (original_lines > 0 && modified_lines > 0 &&
-              (c == ' ' || (! eof && line->len == 0)))
+          if (original_lines > 0 && modified_lines > 0 
+              && ((c == ' ')
+              || (! eof && line->len == 0)
+              || (ignore_whitespaces && c != del && c != add)))
             {
               hunk_seen = TRUE;
               original_lines--;
@@ -517,6 +520,7 @@ svn_error_t *
 svn_diff_parse_next_patch(svn_patch_t **patch,
                           apr_file_t *patch_file,
                           svn_boolean_t reverse,
+                          svn_boolean_t ignore_whitespaces,
                           apr_pool_t *result_pool,
                           apr_pool_t *scratch_pool)
 {
@@ -624,7 +628,7 @@ svn_diff_parse_next_patch(svn_patch_t **
           svn_pool_clear(iterpool);
 
           SVN_ERR(parse_next_hunk(&hunk, *patch, stream, reverse,
-                                  result_pool, iterpool));
+                                  ignore_whitespaces, result_pool, iterpool));
           if (hunk)
             APR_ARRAY_PUSH((*patch)->hunks, svn_hunk_t *) = hunk;
         }

Modified: subversion/branches/svn-patch-improvements/subversion/libsvn_fs_fs/fs_fs.c
URL: http://svn.apache.org/viewvc/subversion/branches/svn-patch-improvements/subversion/libsvn_fs_fs/fs_fs.c?rev=934607&r1=934606&r2=934607&view=diff
==============================================================================
--- subversion/branches/svn-patch-improvements/subversion/libsvn_fs_fs/fs_fs.c (original)
+++ subversion/branches/svn-patch-improvements/subversion/libsvn_fs_fs/fs_fs.c Thu Apr 15 21:48:42 2010
@@ -1498,6 +1498,14 @@ svn_fs_fs__hotcopy(const char *src_path,
   /* Copy the config. */
   SVN_ERR(svn_io_dir_file_copy(src_path, dst_path, PATH_CONFIG, pool));
 
+  /* Copy the rep cache before copying the rev files to make sure all
+     cached references will be present in the copy. */
+  src_subdir = svn_dirent_join(src_path, REP_CACHE_DB_NAME, pool);
+  dst_subdir = svn_dirent_join(dst_path, REP_CACHE_DB_NAME, pool);
+  SVN_ERR(svn_io_check_path(src_subdir, &kind, pool));
+  if (kind == svn_node_file)
+    SVN_ERR(svn_sqlite__hotcopy(src_subdir, dst_subdir, pool));
+
   /* Copy the min unpacked rev, and read its value. */
   if (format >= SVN_FS_FS__MIN_PACKED_FORMAT)
     {
@@ -1597,8 +1605,11 @@ svn_fs_fs__hotcopy(const char *src_path,
   /* Copy the packed revprop db. */
   if (format >= SVN_FS_FS__MIN_PACKED_REVPROP_FORMAT)
     {
-      SVN_ERR(svn_io_dir_file_copy(src_subdir, dst_subdir, PATH_REVPROPS_DB,
-                                   pool));
+      const char *src_file = svn_dirent_join(src_subdir, PATH_REVPROPS_DB,
+                                             pool);
+      const char *dst_file = svn_dirent_join(dst_subdir, PATH_REVPROPS_DB,
+                                             pool);
+      SVN_ERR(svn_sqlite__hotcopy(src_file, dst_file, pool));
     }
 
   for (rev = min_unpacked_revprop; rev <= youngest; rev++)
@@ -1658,12 +1669,6 @@ svn_fs_fs__hotcopy(const char *src_path,
                                         PATH_NODE_ORIGINS_DIR, TRUE, NULL,
                                         NULL, pool));
 
-  /* Now copy the rep cache. */
-  src_subdir = svn_dirent_join(src_path, REP_CACHE_DB_NAME, pool);
-  SVN_ERR(svn_io_check_path(src_subdir, &kind, pool));
-  if (kind == svn_node_file)
-    SVN_ERR(svn_io_dir_file_copy(src_path, dst_path, REP_CACHE_DB_NAME, pool));
-
   /* Copy the txn-current file. */
   if (format >= SVN_FS_FS__MIN_TXN_CURRENT_FORMAT)
     SVN_ERR(svn_io_dir_file_copy(src_path, dst_path, PATH_TXN_CURRENT, pool));

Modified: subversion/branches/svn-patch-improvements/subversion/libsvn_ra_svn/client.c
URL: http://svn.apache.org/viewvc/subversion/branches/svn-patch-improvements/subversion/libsvn_ra_svn/client.c?rev=934607&r1=934606&r2=934607&view=diff
==============================================================================
--- subversion/branches/svn-patch-improvements/subversion/libsvn_ra_svn/client.c (original)
+++ subversion/branches/svn-patch-improvements/subversion/libsvn_ra_svn/client.c Thu Apr 15 21:48:42 2010
@@ -453,6 +453,7 @@ static void handle_child_process_error(a
   conn = svn_ra_svn_create_conn(NULL, in_file, out_file, pool);
   err = svn_error_wrap_apr(status, _("Error in child process: %s"), desc);
   svn_error_clear(svn_ra_svn_write_cmd_failure(conn, pool, err));
+  svn_error_clear(err);
   svn_error_clear(svn_ra_svn_flush(conn, pool));
 }
 

Propchange: subversion/branches/svn-patch-improvements/subversion/libsvn_subr/
------------------------------------------------------------------------------
--- svn:ignore (original)
+++ svn:ignore Thu Apr 15 21:48:42 2010
@@ -8,3 +8,4 @@ Debug
 *~
 .*~
 libsvn_subr.def
+internal_statements.h

Modified: subversion/branches/svn-patch-improvements/subversion/libsvn_subr/sqlite.c
URL: http://svn.apache.org/viewvc/subversion/branches/svn-patch-improvements/subversion/libsvn_subr/sqlite.c?rev=934607&r1=934606&r2=934607&view=diff
==============================================================================
--- subversion/branches/svn-patch-improvements/subversion/libsvn_subr/sqlite.c (original)
+++ subversion/branches/svn-patch-improvements/subversion/libsvn_subr/sqlite.c Thu Apr 15 21:48:42 2010
@@ -29,6 +29,8 @@
 #include "svn_dirent_uri.h"
 #include "svn_checksum.h"
 
+#include "internal_statements.h"
+
 #include "private/svn_sqlite.h"
 #include "svn_private_config.h"
 #include "private/svn_dep_compat.h"
@@ -48,6 +50,9 @@
   #include <sqlite3.h>
 #endif
 
+INTERNAL_STATEMENTS_SQL_DECLARE_STATEMENTS(internal_statements);
+
+
 #ifdef SQLITE3_DEBUG
 /* An sqlite query execution callback. */
 static void
@@ -140,7 +145,7 @@ svn_sqlite__get_statement(svn_sqlite__st
 
   *stmt = db->prepared_stmts[stmt_idx];
 
-  if ((*stmt)->needs_reset);
+  if ((*stmt)->needs_reset)
     return svn_error_return(svn_sqlite__reset(*stmt));
 
   return SVN_NO_ERROR;
@@ -964,3 +969,68 @@ svn_sqlite__with_transaction(svn_sqlite_
 
   return svn_error_return(exec_sql(db, "COMMIT TRANSACTION;"));
 }
+
+svn_error_t *
+svn_sqlite__hotcopy(const char *src_path,
+                    const char *dst_path,
+                    apr_pool_t *scratch_pool)
+{
+  svn_sqlite__db_t *src_db;
+
+  SVN_ERR(svn_sqlite__open(&src_db, src_path, svn_sqlite__mode_readonly,
+                           internal_statements, 0, NULL,
+                           scratch_pool, scratch_pool));
+
+#if SQLITE_VERSION_AT_LEAST(3,6,11)
+  {
+    svn_sqlite__db_t *dst_db;
+    sqlite3_backup *backup;
+    int rc1, rc2;
+
+    SVN_ERR(svn_sqlite__open(&dst_db, dst_path, svn_sqlite__mode_rwcreate,
+                             NULL, 0, NULL, scratch_pool, scratch_pool));
+    backup = sqlite3_backup_init(dst_db->db3, "main", src_db->db3, "main");
+    if (!backup)
+      return svn_error_createf(SVN_ERR_SQLITE_ERROR, NULL,
+                               _("SQLite hotcopy failed for %s"), src_path);
+    do
+      {
+        /* Pages are usually 1024 byte (SQLite docs). On my laptop
+           copying gets faster as the number of pages is increased up
+           to about 64, beyond that speed levels off.  Lets put the
+           number of pages an order of magnitude higher, this is still
+           likely to be a fraction of large databases. */
+        rc1 = sqlite3_backup_step(backup, 1024);
+
+        /* Should we sleep on SQLITE_OK?  That would make copying a
+           large database take much longer.  When we do sleep how,
+           long should we sleep?  Should the sleep get longer if we
+           keep getting BUSY/LOCKED?  I have no real reason for
+           choosing 25. */
+        if (rc1 == SQLITE_BUSY || rc1 == SQLITE_LOCKED)
+          sqlite3_sleep(25);
+      }
+    while (rc1 == SQLITE_OK || rc1 == SQLITE_BUSY || rc1 == SQLITE_LOCKED);
+    rc2 = sqlite3_backup_finish(backup);
+    if (rc1 != SQLITE_DONE)
+      SQLITE_ERR(rc1, dst_db);
+    SQLITE_ERR(rc2, dst_db);
+    SVN_ERR(svn_sqlite__close(dst_db));
+  }
+#else
+  {
+    svn_sqlite__stmt_t *stmt;
+    /* The SELECT takes a shared lock in the source database which
+       blocks writers and so ensures that the database won't change
+       during the copy. */
+    SVN_ERR(svn_sqlite__get_statement(&stmt, src_db,
+                                      STMT_DUMMY_SELECT_FOR_BACKUP));
+    SVN_ERR(svn_sqlite__step_row(stmt));
+    SVN_ERR(svn_io_copy_file(src_path, dst_path, TRUE, scratch_pool));
+  }
+#endif
+
+  SVN_ERR(svn_sqlite__close(src_db));
+
+  return SVN_NO_ERROR;
+}

Modified: subversion/branches/svn-patch-improvements/subversion/libsvn_wc/adm_crawler.c
URL: http://svn.apache.org/viewvc/subversion/branches/svn-patch-improvements/subversion/libsvn_wc/adm_crawler.c?rev=934607&r1=934606&r2=934607&view=diff
==============================================================================
--- subversion/branches/svn-patch-improvements/subversion/libsvn_wc/adm_crawler.c (original)
+++ subversion/branches/svn-patch-improvements/subversion/libsvn_wc/adm_crawler.c Thu Apr 15 21:48:42 2010
@@ -1054,13 +1054,12 @@ svn_wc__internal_transmit_text_deltas(co
 {
   svn_txdelta_window_handler_t handler;
   void *wh_baton;
-  const char *base_digest_hex;
-  const svn_checksum_t *expected_checksum = NULL;
-  svn_checksum_t *verify_checksum = NULL;
-  svn_checksum_t *local_checksum;
+  const svn_checksum_t *expected_md5_checksum;
+  svn_checksum_t *verify_checksum = NULL;  /* calc'd MD5 of BASE_STREAM */
+  svn_checksum_t *local_checksum;  /* calc'd MD5 of LOCAL_STREAM */
   svn_error_t *err;
-  svn_stream_t *base_stream;
-  svn_stream_t *local_stream;
+  svn_stream_t *base_stream;  /* delta source */
+  svn_stream_t *local_stream;  /* delta target: LOCAL_ABSPATH transl. to NF */
 
   /* Translated input */
   SVN_ERR(svn_wc__internal_translated_stream(&local_stream, db,
@@ -1073,33 +1072,29 @@ svn_wc__internal_transmit_text_deltas(co
    * *TEMPFILE to the path to it. */
   if (tempfile)
     {
-      const char *tmp_base;
-      apr_file_t *tempbasefile;
+      svn_stream_t *tempstream;
 
-      SVN_ERR(svn_wc__text_base_path(&tmp_base, db, local_abspath, TRUE,
+      SVN_ERR(svn_wc__text_base_path(tempfile, db, local_abspath, TRUE,
                                      scratch_pool));
 
-      *tempfile = tmp_base;
-
       /* Make an untranslated copy of the working file in the
          administrative tmp area because a) we need to detranslate eol
          and keywords anyway, and b) after the commit, we're going to
          copy the tmp file to become the new text base anyway. */
-      SVN_ERR(svn_io_file_open(&tempbasefile, tmp_base,
-                               APR_WRITE | APR_CREATE, APR_OS_DEFAULT,
-                               result_pool));
+      SVN_ERR(svn_stream_open_writable(&tempstream, *tempfile,
+                                       result_pool, scratch_pool));
 
       /* Wrap the translated stream with a new stream that writes the
          translated contents into the new text base file as we read from it.
          Note that the new text base file will be closed when the new stream
          is closed. */
-      local_stream
-        = copying_stream(local_stream,
-                         svn_stream_from_aprfile2(tempbasefile, FALSE,
-                                                  scratch_pool),
-                         scratch_pool);
+      local_stream = copying_stream(local_stream, tempstream, scratch_pool);
     }
 
+  /* Set BASE_STREAM to a stream providing the base (source) content for the
+   * delta, which may be an empty stream;
+   * set EXPECTED_CHECKSUM to its stored (or possibly calculated) MD5 checksum;
+   * and (usually) arrange for its VERIFY_CHECKSUM to be calculated later. */
   if (! fulltext)
     {
       /* Compute delta against the pristine contents */
@@ -1112,24 +1107,37 @@ svn_wc__internal_transmit_text_deltas(co
                                    NULL, NULL, NULL,
                                    NULL, NULL, NULL,
                                    NULL, NULL,
-                                   &expected_checksum, NULL,
+                                   &expected_md5_checksum, NULL,
                                    NULL, NULL, NULL, NULL, NULL,
                                    NULL, NULL, NULL,
                                    NULL, NULL, NULL,
                                    db, local_abspath,
                                    scratch_pool, scratch_pool));
+      /* SVN_EXPERIMENTAL_PRISTINE:
+         If we got a SHA-1, get the corresponding MD-5. */
+      if (expected_md5_checksum
+          && expected_md5_checksum->kind != svn_checksum_md5)
+        SVN_ERR(svn_wc__db_pristine_get_md5(&expected_md5_checksum,
+                                            db, local_abspath,
+                                            expected_md5_checksum,
+                                            scratch_pool, scratch_pool));
 
-#ifdef SVN_EXPERIMENTAL
-      /* ### expected_checksum is originally MD-5 but will later be SHA-1... */
-#endif
-
-      /* ### We want expected_checksum to ALWAYS be present, but on old
-         ### working copies maybe it won't be (unclear?). If it is there,
-         ### then we can use it as an expected value. If it is NOT there,
-         ### then we must compute it for the apply_textdelta() call. */
-      if (expected_checksum)
+      /* ### We want expected_md5_checksum to ALWAYS be present, but on old
+         working copies maybe it won't be (unclear?).  If it is there,
+         then we can pass it to apply_textdelta() as required, and later on
+         we can use it as an expected value to verify against.  Therefore
+         we prepare now to calculate (during the later reading of the base
+         stream) the actual checksum of the base stream as VERIFY_CHECKSUM.
+
+         If the base checksum was NOT recorded, then we must compute it NOW
+         for the apply_textdelta() call.  In this case, we won't bother to
+         calculate it a second time during the later reading of the stream
+         for the purpose of verification, and will leave VERIFY_CHECKSUM as
+         NULL. */
+      if (expected_md5_checksum)
         {
-          /* Compute a checksum for what is *actually* found */
+          /* Arrange to set VERIFY_CHECKSUM to the MD5 of what is *actually*
+             found when the base stream is read. */
           base_stream = svn_stream_checksummed2(base_stream, &verify_checksum,
                                                 NULL, svn_checksum_md5, TRUE,
                                                 scratch_pool);
@@ -1139,6 +1147,8 @@ svn_wc__internal_transmit_text_deltas(co
           svn_stream_t *p_stream;
           svn_checksum_t *p_checksum;
 
+          /* Set EXPECTED_CHECKSUM to the MD5 checksum of the existing
+           * pristine text, by reading the text and calculating it. */
           /* ### we should ALREADY have the checksum for pristine. */
           SVN_ERR(svn_wc__get_pristine_contents(&p_stream, db, local_abspath,
                                                 scratch_pool, scratch_pool));
@@ -1152,24 +1162,32 @@ svn_wc__internal_transmit_text_deltas(co
           /* Closing this will cause a full read/checksum. */
           SVN_ERR(svn_stream_close(p_stream));
 
-          expected_checksum = p_checksum;
+          expected_md5_checksum = p_checksum;
         }
-
-      /* apply_textdelta() is working against a base with this checksum */
-      base_digest_hex = svn_checksum_to_cstring_display(expected_checksum,
-                                                        scratch_pool);
     }
   else
     {
       /* Send a fulltext. */
       base_stream = svn_stream_empty(scratch_pool);
-      base_digest_hex = NULL;
+      expected_md5_checksum = NULL;
     }
 
   /* Tell the editor that we're about to apply a textdelta to the
      file baton; the editor returns to us a window consumer and baton.  */
-  SVN_ERR(editor->apply_textdelta(file_baton, base_digest_hex, scratch_pool,
-                                  &handler, &wh_baton));
+  {
+    /* apply_textdelta() is working against a base with this checksum */
+    const char *base_digest_hex = NULL;
+
+    if (expected_md5_checksum)
+      /* ### Why '..._display()'?  expected_md5_checksum should never be all-
+       * zero, but if it is, we would want to pass NULL not an all-zero
+       * digest to apply_textdelta(), wouldn't we? */
+      base_digest_hex = svn_checksum_to_cstring_display(expected_md5_checksum,
+                                                        scratch_pool);
+
+    SVN_ERR(editor->apply_textdelta(file_baton, base_digest_hex, scratch_pool,
+                                    &handler, &wh_baton));
+  }
 
   /* Run diff processing, throwing windows at the handler. */
   err = svn_txdelta_run(base_stream, local_stream,
@@ -1193,8 +1211,8 @@ svn_wc__internal_transmit_text_deltas(co
 
   /* If we have an error, it may be caused by a corrupt text base.
      Check the checksum and discard `err' if they don't match. */
-  if (expected_checksum && verify_checksum
-      && !svn_checksum_match(expected_checksum, verify_checksum))
+  if (expected_md5_checksum && verify_checksum
+      && !svn_checksum_match(expected_md5_checksum, verify_checksum))
     {
       /* The entry checksum does not match the actual text
          base checksum.  Extreme badness. Of course,
@@ -1225,7 +1243,7 @@ svn_wc__internal_transmit_text_deltas(co
                         "   expected:  %s\n"
                         "     actual:  %s\n"),
                       svn_dirent_local_style(text_base, scratch_pool),
-                      svn_checksum_to_cstring_display(expected_checksum,
+                      svn_checksum_to_cstring_display(expected_md5_checksum,
                                                       scratch_pool),
                       svn_checksum_to_cstring_display(verify_checksum,
                                                       scratch_pool));

Modified: subversion/branches/svn-patch-improvements/subversion/libsvn_wc/adm_ops.c
URL: http://svn.apache.org/viewvc/subversion/branches/svn-patch-improvements/subversion/libsvn_wc/adm_ops.c?rev=934607&r1=934606&r2=934607&view=diff
==============================================================================
--- subversion/branches/svn-patch-improvements/subversion/libsvn_wc/adm_ops.c (original)
+++ subversion/branches/svn-patch-improvements/subversion/libsvn_wc/adm_ops.c Thu Apr 15 21:48:42 2010
@@ -376,10 +376,10 @@ process_committed_leaf(svn_wc__db_t *db,
                                NULL, NULL, NULL, NULL, NULL,
                                db, local_abspath,
                                scratch_pool, scratch_pool));
-
-#ifdef SVN_EXPERIMENTAL
-  /* ### copied_checksum is originally MD-5 but will later be SHA-1... */
-#endif
+  /* SVN_EXPERIMENTAL_PRISTINE:
+     copied_checksum is originally MD-5 but will later be SHA-1.  That's OK
+     because we are just reading it from one place in the DB and writing it
+     to another. */
 
   if (kind == svn_wc__db_kind_dir)
     adm_abspath = local_abspath;

Modified: subversion/branches/svn-patch-improvements/subversion/libsvn_wc/entries.c
URL: http://svn.apache.org/viewvc/subversion/branches/svn-patch-improvements/subversion/libsvn_wc/entries.c?rev=934607&r1=934606&r2=934607&view=diff
==============================================================================
--- subversion/branches/svn-patch-improvements/subversion/libsvn_wc/entries.c (original)
+++ subversion/branches/svn-patch-improvements/subversion/libsvn_wc/entries.c Thu Apr 15 21:48:42 2010
@@ -267,9 +267,9 @@ get_base_info_for_deleted(svn_wc_entry_t
                                  entry_abspath,
                                  result_pool,
                                  scratch_pool);
-#ifdef SVN_EXPERIMENTAL
-  /* ### *checksum is originally MD-5 but will later be SHA-1... */
-#endif
+  /* SVN_EXPERIMENTAL_PRISTINE:
+     *checksum is originally MD-5 but will later be SHA-1.  That's OK here -
+     we are just returning what is stored. */
 
   if (err)
     {
@@ -1064,13 +1064,12 @@ read_entries_new(apr_hash_t **result_ent
 
       if (checksum)
         {
-#ifdef SVN_EXPERIMENTAL
-          /* If we get a SHA-1, as expected in WC-NG, convert it to MD-5. */
-          if (checksum->kind == svn_checksum_sha1)
-            SVN_ERR(svn_wc__db_get_pristine_md5(&checksum, db,
+          /* SVN_EXPERIMENTAL_PRISTINE:
+             If we got a SHA-1, get the corresponding MD-5. */
+          if (checksum->kind != svn_checksum_md5)
+            SVN_ERR(svn_wc__db_pristine_get_md5(&checksum, db,
                                                 entry_abspath, checksum,
                                                 scratch_pool, scratch_pool));
-#endif
 
           SVN_ERR_ASSERT(checksum->kind == svn_checksum_md5);
           entry->checksum = svn_checksum_to_cstring(checksum, result_pool);
@@ -2385,9 +2384,9 @@ write_one_entry_cb(void *baton,
                                            scratch_pool);
 
       err = svn_sqlite__column_checksum(&base_checksum, stmt, 5, scratch_pool);
-#ifdef SVN_EXPERIMENTAL
-      /* ### base_checksum is originally MD-5 but will later be SHA-1... */
-#endif
+      /* ### SVN_EXPERIMENTAL_PRISTINE:
+         base_checksum is originally MD-5 but will later be SHA-1.  The
+         base_checksum is not yet handled by this function. */
 
       SVN_ERR(svn_error_compose_create(err, svn_sqlite__reset(stmt)));
     }

Modified: subversion/branches/svn-patch-improvements/subversion/libsvn_wc/questions.c
URL: http://svn.apache.org/viewvc/subversion/branches/svn-patch-improvements/subversion/libsvn_wc/questions.c?rev=934607&r1=934606&r2=934607&view=diff
==============================================================================
--- subversion/branches/svn-patch-improvements/subversion/libsvn_wc/questions.c (original)
+++ subversion/branches/svn-patch-improvements/subversion/libsvn_wc/questions.c Thu Apr 15 21:48:42 2010
@@ -80,11 +80,18 @@
 
 
 /* Set *MODIFIED_P to TRUE if (after translation) VERSIONED_FILE_ABSPATH
- * differs from BASE_FILE_ABSPATH, else to FALSE if not.  Also verify that
- * BASE_FILE_ABSPATH matches the stored checksum for VERSIONED_FILE_ABSPATH,
+ * differs from PRISTINE_STREAM, else to FALSE if not.  Also verify that
+ * PRISTINE_STREAM matches the stored checksum for VERSIONED_FILE_ABSPATH,
  * if verify_checksum is TRUE. If checksum does not match, return the error
  * SVN_ERR_WC_CORRUPT_TEXT_BASE.
  *
+ * If COMPARE_TEXTBASES is true, translate VERSIONED_FILE_ABSPATH's EOL
+ * style and keywords to repository-normal form according to its properties,
+ * and compare the result with PRISTINE_STREAM.  If COMPARE_TEXTBASES is
+ * false, translate PRISTINE_STREAM's EOL style and keywords to working-copy
+ * form according to VERSIONED_FILE_ABSPATH's properties, and compare the
+ * result with VERSIONED_FILE_ABSPATH.
+ *
  * PRISTINE_STREAM will be closed before a successful return.
  *
  * DB is a wc_db; use SCRATCH_POOL for temporary allocation.
@@ -137,15 +144,15 @@ compare_and_verify(svn_boolean_t *modifi
                                        NULL, NULL,
                                        db, versioned_file_abspath,
                                        scratch_pool, scratch_pool));
-
-#ifdef SVN_EXPERIMENTAL
-          /* ### node_checksum is originally MD-5 but will later be SHA-1... */
-#endif
+          /* SVN_EXPERIMENTAL_PRISTINE:
+             node_checksum is originally MD-5 but will later be SHA-1.  To
+             allow for this, we calculate CHECKSUM as the same kind so that
+             we can compare them. */
 
           if (node_checksum)
             pristine_stream = svn_stream_checksummed2(pristine_stream,
                                                       &checksum, NULL,
-                                                      svn_checksum_md5, TRUE,
+                                                      node_checksum->kind, TRUE,
                                                       scratch_pool);
         }
 
@@ -167,17 +174,19 @@ compare_and_verify(svn_boolean_t *modifi
                        && eol_style != svn_subst_eol_style_none)
                 return svn_error_create(SVN_ERR_IO_UNKNOWN_EOL, NULL, NULL);
 
-              /* Wrap file stream to detranslate into normal form. */
+              /* Wrap file stream to detranslate into normal form,
+               * "repairing" the EOL style if it is inconsistent. */
               v_stream = svn_subst_stream_translated(v_stream,
                                                      eol_str,
-                                                     TRUE,
+                                                     TRUE /* repair */,
                                                      keywords,
                                                      FALSE /* expand */,
                                                      scratch_pool);
             }
           else if (need_translation)
             {
-              /* Wrap base stream to translate into working copy form. */
+              /* Wrap base stream to translate into working copy form, and
+               * arrange to throw an error if its EOL style is inconsistent. */
               pristine_stream = svn_subst_stream_translated(pristine_stream,
                                                             eol_str, FALSE,
                                                             keywords, TRUE,

Modified: subversion/branches/svn-patch-improvements/subversion/libsvn_wc/update_editor.c
URL: http://svn.apache.org/viewvc/subversion/branches/svn-patch-improvements/subversion/libsvn_wc/update_editor.c?rev=934607&r1=934606&r2=934607&view=diff
==============================================================================
--- subversion/branches/svn-patch-improvements/subversion/libsvn_wc/update_editor.c (original)
+++ subversion/branches/svn-patch-improvements/subversion/libsvn_wc/update_editor.c Thu Apr 15 21:48:42 2010
@@ -373,10 +373,9 @@ struct handler_baton
 
   /* Where we are assembling the new file. */
   const char *new_text_base_tmp_abspath;
-#ifdef SVN_EXPERIMENTAL
-  /* The WC-NG equivalent of NEW_TEXT_BASE_TMP_ABSPATH. */
+  /* ### SVN_EXPERIMENTAL_PRISTINE:
+     The WC-NG equivalent of NEW_TEXT_BASE_TMP_ABSPATH. */
   const char *new_pristine_tmp_abspath;
-#endif
 
     /* The expected MD5 checksum of the text source or NULL if no base
      checksum is available */
@@ -1000,10 +999,9 @@ struct file_baton
      in-progress in the tmp area).  This gets set if there are file
      content changes. */
   const char *new_text_base_tmp_abspath;
-#ifdef SVN_EXPERIMENTAL
-  /* The WC-NG equivalent of NEW_TEXT_BASE_TMP_ABSPATH. */
+  /* ### SVN_EXPERIMENTAL_PRISTINE:
+     The WC-NG equivalent of NEW_TEXT_BASE_TMP_ABSPATH. */
   const char *new_pristine_tmp_abspath;
-#endif
 
   /* The MD5 checksum of the incoming text base (pristine text). */
   svn_checksum_t *new_text_base_md5_checksum;
@@ -1146,20 +1144,18 @@ window_handler(svn_txdelta_window_t *win
       /* We failed to apply the delta; clean up the temporary file.  */
       svn_error_clear(svn_io_remove_file2(hb->new_text_base_tmp_abspath, TRUE,
                                           hb->pool));
-#ifdef SVN_EXPERIMENTAL
+      /* ### SVN_EXPERIMENTAL_PRISTINE: */
       svn_error_clear(svn_io_remove_file2(hb->new_pristine_tmp_abspath, TRUE,
                                           hb->pool));
-#endif
     }
   else
     {
       /* Tell the file baton about the new text base. */
       fb->new_text_base_tmp_abspath = apr_pstrdup(fb->pool,
                                               hb->new_text_base_tmp_abspath);
-#ifdef SVN_EXPERIMENTAL
+      /* ### SVN_EXPERIMENTAL_PRISTINE: */
       fb->new_pristine_tmp_abspath = apr_pstrdup(fb->pool,
                                               hb->new_pristine_tmp_abspath);
-#endif
 
       /* ... and its checksums. */
       fb->new_text_base_md5_checksum =
@@ -3234,7 +3230,7 @@ absent_directory(const char *path,
 }
 
 
-#ifdef SVN_EXPERIMENTAL
+/* ### SVN_EXPERIMENTAL_PRISTINE: */
 /* Set *TEE_OUTPUT_STREAM to a writable stream that copies its data to both
    OUTPUT_STREAM and a new WC-NG pristine temp file corresponding to (DB,
    LOCAL_ABSPATH). Set *NEW_PRISTINE_TMP_ABSPATH to the path of that file.
@@ -3263,7 +3259,6 @@ get_pristine_tee_stream(svn_stream_t **t
 
   return SVN_NO_ERROR;
 }
-#endif
 
 
 /* Beginning at DIR_ABSPATH (from repository with uuid DIR_REPOS_UUID and
@@ -3525,12 +3520,12 @@ add_file_with_history(const char *path,
                                      &tfb->copied_text_base_sha1_checksum,
                                      db, pb->local_abspath,
                                      pool, pool));
-#ifdef SVN_EXPERIMENTAL
-  /* Copy the 'copied_stream' into a WC-NG pristine temp file as well. */
+  /* ### SVN_EXPERIMENTAL_PRISTINE:
+     Copy the 'copied_stream' into a WC-NG pristine temp file as well.
+     This is currently tee'd for compat. */
   SVN_ERR(get_pristine_tee_stream(&copied_stream, &tfb->new_pristine_tmp_abspath,
                                   db, tfb->local_abspath, copied_stream,
                                   pool, subpool));
-#endif
 
   if (src_local_abspath != NULL) /* Found a file to copy */
     {
@@ -4159,13 +4154,12 @@ apply_textdelta(void *file_baton,
       return svn_error_return(err);
     }
 
-#ifdef SVN_EXPERIMENTAL
-  /* Copy the 'target' stream into a WC-NG pristine temp file as well.
-     ###: This is currently tee'd for compat. */
+  /* ### SVN_EXPERIMENTAL_PRISTINE:
+     Copy the 'target' stream into a WC-NG pristine temp file as well.
+     This is currently tee'd for compat. */
   SVN_ERR(get_pristine_tee_stream(&target, &hb->new_pristine_tmp_abspath,
                                   fb->edit_baton->db, fb->local_abspath,
                                   target, handler_pool, pool));
-#endif
 
   /* Prepare to apply the delta.  */
   svn_txdelta_apply(source, target,
@@ -4740,8 +4734,10 @@ close_file(void *file_baton,
             expected_md5_digest,
             svn_checksum_to_cstring_display(new_text_base_md5_checksum, pool));
 
-#ifdef SVN_EXPERIMENTAL
+#ifdef SVN_EXPERIMENTAL_PRISTINE
   /* If we had a text change, drop the pristine into it's proper place. */
+  /* ### Caution: there is as yet no code to ever remove these pristine
+     files when they are superseded. */
   /* The WC-1 equivalent code is in merge_file(). Shouldn't they be together?
      Bert said: In 1.0 the install of the .svn-base has to be done in loggy/wq
      (or it can break your wc), while with the new pristine the file can and
@@ -4753,6 +4749,12 @@ close_file(void *file_baton,
     SVN_ERR(svn_wc__db_pristine_install(eb->db, fb->new_pristine_tmp_abspath,
                                         new_text_base_sha1_checksum,
                                         new_text_base_md5_checksum, pool));
+#else
+  /* ### We're compiling without experimental support for the new pristine
+     store. Nevertheless, we have created a temp file with this end in mind.
+     Delete it now so it doesn't fill up the poor developer's disk. */
+  if (fb->new_pristine_tmp_abspath)
+    SVN_ERR(svn_io_remove_file2(fb->new_pristine_tmp_abspath, FALSE, pool));
 #endif
 
   /* Get a copy of the entry *before* we begin mucking around with the
@@ -4834,7 +4836,7 @@ close_file(void *file_baton,
 
   /* Insert/replace the BASE node with all of the new metadata.  */
   {
-#ifdef SVN_EXPERIMENTAL
+#ifdef SVN_EXPERIMENTAL_PRISTINE
       /* Set the 'checksum' column of the file's BASE_NODE row to
        * NEW_TEXT_BASE_SHA1_CHECKSUM.  The pristine text identified by that
        * checksum is already in the pristine store. */
@@ -4854,10 +4856,9 @@ close_file(void *file_baton,
                                          &new_checksum, NULL, NULL, NULL,
                                          eb->db, fb->local_abspath,
                                          pool, pool));
-#ifdef SVN_EXPERIMENTAL
-        /* ### new_checksum is originally MD-5 but will later be SHA-1... */
-#endif
-
+        /* SVN_EXPERIMENTAL_PRISTINE:
+           new_checksum is originally MD-5 but will later be SHA-1.  That's
+           OK here because we just read it and write it back. */
       }
 
     SVN_ERR(svn_wc__db_base_add_file(eb->db, fb->local_abspath,

Modified: subversion/branches/svn-patch-improvements/subversion/libsvn_wc/wc.h
URL: http://svn.apache.org/viewvc/subversion/branches/svn-patch-improvements/subversion/libsvn_wc/wc.h?rev=934607&r1=934606&r2=934607&view=diff
==============================================================================
--- subversion/branches/svn-patch-improvements/subversion/libsvn_wc/wc.h (original)
+++ subversion/branches/svn-patch-improvements/subversion/libsvn_wc/wc.h Thu Apr 15 21:48:42 2010
@@ -361,9 +361,12 @@ void svn_wc__compat_call_notify_func(voi
  * the text base is much longer than the working file, every byte of
  * the text base will still be examined.)
  *
- * If COMPARE_TEXTBASES is true, the comparison will be between a
- * detranslated version of *LOCAL_ABSPATH and the text base, otherwise, a
- * translated version of the text base and *LOCAL_ABSPATH will be compared.
+ * If COMPARE_TEXTBASES is true, translate LOCAL_ABSPATH's EOL
+ * style and keywords to repository-normal form according to its properties,
+ * and compare the result with the text base.  If COMPARE_TEXTBASES is
+ * false, translate the text base's EOL style and keywords to working-copy
+ * form according to LOCAL_ABSPATH's properties, and compare the
+ * result with LOCAL_ABSPATH.
  *
  * If LOCAL_ABSPATH does not exist, consider it unmodified.  If it exists
  * but is not under revision control (not even scheduled for
@@ -488,7 +491,15 @@ svn_wc__internal_conflicted_p(svn_boolea
 
 
 /* Similar to svn_wc__versioned_file_modcheck(), but with a wc_db parameter
- * instead of a wc_context. */
+ * instead of a wc_context.
+ *
+ * If COMPARE_TEXTBASES is true, translate VERSIONED_FILE_ABSPATH's EOL
+ * style and keywords to repository-normal form according to its properties,
+ * and compare the result with BASE_FILE_ABSPATH.  If COMPARE_TEXTBASES is
+ * false, translate BASE_FILE_ABSPATH's EOL style and keywords to working-copy
+ * form according to VERSIONED_FILE_ABSPATH's properties, and compare the
+ * result with VERSIONED_FILE_ABSPATH.
+ */
 svn_error_t *
 svn_wc__internal_versioned_file_modcheck(svn_boolean_t *modified_p,
                                          svn_wc__db_t *db,

Modified: subversion/branches/svn-patch-improvements/subversion/libsvn_wc/wc_db.c
URL: http://svn.apache.org/viewvc/subversion/branches/svn-patch-improvements/subversion/libsvn_wc/wc_db.c?rev=934607&r1=934606&r2=934607&view=diff
==============================================================================
--- subversion/branches/svn-patch-improvements/subversion/libsvn_wc/wc_db.c (original)
+++ subversion/branches/svn-patch-improvements/subversion/libsvn_wc/wc_db.c Thu Apr 15 21:48:42 2010
@@ -7219,7 +7219,7 @@ svn_wc__db_temp_get_file_external(const 
 
 
 svn_error_t *
-svn_wc__db_get_pristine_md5(const svn_checksum_t **md5_checksum,
+svn_wc__db_pristine_get_md5(const svn_checksum_t **md5_checksum,
                             svn_wc__db_t *db,
                             const char *wri_abspath,
                             const svn_checksum_t *sha1_checksum,
@@ -7251,9 +7251,9 @@ svn_wc__db_get_pristine_md5(const svn_ch
                              svn_checksum_to_cstring_display(sha1_checksum,
                                                              scratch_pool));
 
-  SVN_ERR(svn_sqlite__column_checksum(md5_checksum, stmt, 0, scratch_pool));
-
+  SVN_ERR(svn_sqlite__column_checksum(md5_checksum, stmt, 0, result_pool));
   SVN_ERR_ASSERT((*md5_checksum)->kind == svn_checksum_md5);
+
   return svn_error_return(svn_sqlite__reset(stmt));
 }
 

Modified: subversion/branches/svn-patch-improvements/subversion/libsvn_wc/wc_db.h
URL: http://svn.apache.org/viewvc/subversion/branches/svn-patch-improvements/subversion/libsvn_wc/wc_db.h?rev=934607&r1=934606&r2=934607&view=diff
==============================================================================
--- subversion/branches/svn-patch-improvements/subversion/libsvn_wc/wc_db.h (original)
+++ subversion/branches/svn-patch-improvements/subversion/libsvn_wc/wc_db.h Thu Apr 15 21:48:42 2010
@@ -848,6 +848,18 @@ svn_wc__db_pristine_install(svn_wc__db_t
                             apr_pool_t *scratch_pool);
 
 
+/* Set *PRISTINE_MD5_CHECKSUM to the MD-5 checksum of a pristine text
+   identified by its SHA-1 checksum PRISTINE_SHA1_CHECKSUM. Return an error
+   if the pristine text does not exist or its MD5 checksum is not found. */
+svn_error_t *
+svn_wc__db_pristine_get_md5(const svn_checksum_t **pristine_md5_checksum,
+                            svn_wc__db_t *db,
+                            const char *wri_abspath,
+                            const svn_checksum_t *pristine_sha1_checksum,
+                            apr_pool_t *result_pool,
+                            apr_pool_t *scratch_pool);
+
+
 /* ### check for presence, according to the given mode (on how hard we
    ### should examine things)
 */
@@ -2166,17 +2178,6 @@ svn_wc__db_temp_remove_subdir_record(svn
                                      apr_pool_t *scratch_pool);
 
 
-/* Set *PRISTINE_MD5_CHECKSUM to the MD-5 checksum of a pristine text
-   identified by its SHA-1 checksum PRISTINE_SHA1_CHECKSUM. Return an error
-   if the pristine text does not exist or its MD5 checksum is not found. */
-svn_error_t *
-svn_wc__db_get_pristine_md5(const svn_checksum_t **pristine_md5_checksum,
-                            svn_wc__db_t *db,
-                            const char *wri_abspath,
-                            const svn_checksum_t *pristine_sha1_checksum,
-                            apr_pool_t *result_pool,
-                            apr_pool_t *scratch_pool);
-
 /* @} */
 
 

Modified: subversion/branches/svn-patch-improvements/subversion/svn/cl.h
URL: http://svn.apache.org/viewvc/subversion/branches/svn-patch-improvements/subversion/svn/cl.h?rev=934607&r1=934606&r2=934607&view=diff
==============================================================================
--- subversion/branches/svn-patch-improvements/subversion/svn/cl.h (original)
+++ subversion/branches/svn-patch-improvements/subversion/svn/cl.h Thu Apr 15 21:48:42 2010
@@ -226,6 +226,8 @@ typedef struct svn_cl__opt_state_t
   svn_boolean_t reverse_diff;     /* reverse a diff (e.g. when patching) */
   apr_array_header_t *include_patterns; /* targets to include in operation */
   apr_array_header_t *exclude_patterns; /* targets to exclude from operation */
+  svn_boolean_t ignore_whitespaces; /* don't account for whitespaces when
+                                       patching */
 } svn_cl__opt_state_t;
 
 

Modified: subversion/branches/svn-patch-improvements/subversion/svn/main.c
URL: http://svn.apache.org/viewvc/subversion/branches/svn-patch-improvements/subversion/svn/main.c?rev=934607&r1=934606&r2=934607&view=diff
==============================================================================
--- subversion/branches/svn-patch-improvements/subversion/svn/main.c (original)
+++ subversion/branches/svn-patch-improvements/subversion/svn/main.c Thu Apr 15 21:48:42 2010
@@ -119,6 +119,7 @@ typedef enum {
   opt_reverse_diff,
   opt_include_pattern,
   opt_exclude_pattern,
+  opt_ignore_whitespaces,
 } svn_cl__longopt_t;
 
 /* Option codes and descriptions for the command line client.
@@ -379,6 +380,10 @@ const apr_getopt_option_t svn_cl__option
                        "See also the --include-pattern option.\n"
                        "                             "
                        "[alias: --ep]")},
+  {"ignore-whitespaces", opt_ignore_whitespaces, 0,
+                       N_("don't take whitespaces into account when,\n"
+                       "                             "
+                       "determining where a patch should be applied")},
   /* Long-opt Aliases
    *
    * These have NULL desriptions, but an option code that matches some
@@ -847,7 +852,7 @@ const svn_opt_subcommand_desc2_t svn_cl_
      "  do not agree with.\n"
      ),
     {'q', opt_dry_run, 'p', opt_reverse_diff, opt_include_pattern,
-     opt_exclude_pattern} },
+     opt_exclude_pattern, opt_ignore_whitespaces} },
 
   { "propdel", svn_cl__propdel, {"pdel", "pd"}, N_
     ("Remove a property from files, dirs, or revisions.\n"
@@ -1774,6 +1779,9 @@ main(int argc, const char *argv[])
                                                       sizeof (const char *));
         APR_ARRAY_PUSH(opt_state.exclude_patterns, const char *) = opt_arg;
         break;
+      case opt_ignore_whitespaces:
+          opt_state.ignore_whitespaces = TRUE;
+          break;
       default:
         /* Hmmm. Perhaps this would be a good place to squirrel away
            opts that commands like svn diff might need. Hmmm indeed. */

Modified: subversion/branches/svn-patch-improvements/subversion/svn/patch-cmd.c
URL: http://svn.apache.org/viewvc/subversion/branches/svn-patch-improvements/subversion/svn/patch-cmd.c?rev=934607&r1=934606&r2=934607&view=diff
==============================================================================
--- subversion/branches/svn-patch-improvements/subversion/svn/patch-cmd.c (original)
+++ subversion/branches/svn-patch-improvements/subversion/svn/patch-cmd.c Thu Apr 15 21:48:42 2010
@@ -81,7 +81,9 @@ svn_cl__patch(apr_getopt_t *os,
                            opt_state->reverse_diff,
                            opt_state->include_patterns,
                            opt_state->exclude_patterns,
-                           NULL, NULL, ctx, pool, pool));
+                           NULL, NULL, 
+                           opt_state->ignore_whitespaces, ctx, pool, pool));
+
 
   if (! opt_state->quiet)
     SVN_ERR(svn_cl__print_conflict_stats(ctx->notify_baton2, pool));

Modified: subversion/branches/svn-patch-improvements/subversion/tests/cmdline/merge_tests.py
URL: http://svn.apache.org/viewvc/subversion/branches/svn-patch-improvements/subversion/tests/cmdline/merge_tests.py?rev=934607&r1=934606&r2=934607&view=diff
==============================================================================
--- subversion/branches/svn-patch-improvements/subversion/tests/cmdline/merge_tests.py (original)
+++ subversion/branches/svn-patch-improvements/subversion/tests/cmdline/merge_tests.py Thu Apr 15 21:48:42 2010
@@ -11026,27 +11026,119 @@ def reintegrate_fail_on_switched_wc(sbox
     ".*Cannot reintegrate into a working copy with a switched subtree.*",
     None, None, None, None, True, False, '--reintegrate')
 
-def reintegrate_fail_on_shallow_wc(sbox):
-  "merge --reintegrate should fail in shallow wc"
+
+# Test for issue #3603 'allow reintegrate merges into WCs with
+# missing subtrees'.
+def reintegrate_on_shallow_wc(sbox):
+  "merge --reintegrate in shallow wc"
+
+  # Create a standard greek tree, branch A to A_COPY in r2.
   sbox.build()
   wc_dir = sbox.wc_dir
-  expected_disk, expected_status = set_up_branch(sbox)
-  A_path = os.path.join(wc_dir, "A")
-  G_path = os.path.join(A_path, "D", "G")
-  # Our default checkout doesn't have any subdirs at non-infinite
-  # depth, so we'll have to create one the old-fashioned way: remove a
-  # tree, then "update" it back into existence at a shallower depth.
-  svntest.main.safe_rmtree(G_path)
-  svntest.actions.run_and_verify_svn(None, None, [], 'update', G_path,
-                                     '--depth=files')
-  # Even though everything is actually present (as G has no subdirs
-  # anyway), the reintegration should fail, because G's depth is other
-  # than infinity.
-  svntest.actions.run_and_verify_merge(
-    A_path, None, None, sbox.repo_url + '/A_COPY', None, None, None, None,
-    None, None, None,
-    ".*Cannot reintegrate into a working copy not.*at infinite depth.*",
-    None, None, None, None, True, False, '--reintegrate')
+  expected_disk, expected_status = set_up_branch(sbox, branch_only = True)
+
+  # Some paths we'll care about
+  A_path         = os.path.join(wc_dir, "A")
+  A_D_path       = os.path.join(wc_dir, "A", "D")
+  mu_COPY_path   = os.path.join(wc_dir, "A_COPY", "mu")
+  psi_COPY_path  = os.path.join(wc_dir, "A_COPY", "D", "H", "psi")
+  A_COPY_path    = os.path.join(wc_dir, "A_COPY")
+
+  # r3 - Make a change on the A_COPY branch that will be
+  # reintegrated back to A.
+  svntest.main.file_write(mu_COPY_path, "branch work")
+  svntest.main.run_svn(None, 'commit', '-m',
+                       'Some work on the A_COPY branch', wc_dir)
+
+  # First try a reintegrate where the target WC has a shallow subtree
+  # that is not affected by the reintegrate.  In this case we set the
+  # depth of A/D to empty.  Since the only change made on the branch
+  # since the branch point is to A_COPY/mu, the reintegrate should
+  # simply work and update A/mu with the branch's contents.
+  svntest.actions.run_and_verify_svn(None, None, [], 'up', wc_dir)
+  svntest.actions.run_and_verify_svn(None, None, [], 'up',
+                                     '--set-depth', 'empty', A_D_path)
+  expected_output = wc.State(A_path, {
+    'mu' : Item(status='U '),
+    })
+  expected_mergeinfo_output = wc.State(A_path, {
+    '' : Item(status=' U'),
+    })
+  expected_elision_output = wc.State(A_path, {
+    })
+  expected_A_status = wc.State(A_path, {
+    ''          : Item(status=' M'),
+    'B'         : Item(status='  '),
+    'mu'        : Item(status='M '),
+    'B/E'       : Item(status='  '),
+    'B/E/alpha' : Item(status='  '),
+    'B/E/beta'  : Item(status='  '),
+    'B/lambda'  : Item(status='  '),
+    'B/F'       : Item(status='  '),
+    'C'         : Item(status='  '),
+    'D'         : Item(status='  '), # Don't expect anything under D,
+                                     # its depth is empty!
+    })
+  expected_A_status.tweak(wc_rev=3)
+  expected_A_disk = wc.State('', {
+    ''          : Item(props={SVN_PROP_MERGEINFO : '/A_COPY:2-3'}),
+    'B'         : Item(),
+    'mu'        : Item("branch work"),
+    'B/E'       : Item(),
+    'B/E/alpha' : Item("This is the file 'alpha'.\n"),
+    'B/E/beta'  : Item("This is the file 'beta'.\n"),
+    'B/lambda'  : Item("This is the file 'lambda'.\n"),
+    'B/F'       : Item(),
+    'C'         : Item(),
+    'D'         : Item(), # Don't expect anything under D, its depth is empty!
+    })
+  expected_A_skip = wc.State(A_COPY_path, {})
+  svntest.actions.run_and_verify_merge(A_path, None, None,
+                                       sbox.repo_url + '/A_COPY', None,
+                                       expected_output,
+                                       expected_mergeinfo_output,
+                                       expected_elision_output,
+                                       expected_A_disk,
+                                       expected_A_status,
+                                       expected_A_skip,
+                                       None, None, None, None,
+                                       None, 1, 1, "--reintegrate")
+
+  # Now revert the reintegrate and make a second change on the
+  # branch in r4, but this time change a subtree that corresponds
+  # to the missing (shallow) portion of the source.  The reintegrate
+  # should still succeed, albeit with a tree-conflict.
+  svntest.actions.run_and_verify_svn(None, None, [], 'revert', '-R', wc_dir)
+  svntest.main.file_write(psi_COPY_path, "more branch work")
+  svntest.main.run_svn(None, 'commit', '-m',
+                       'Some more work on the A_COPY branch', wc_dir)
+  # Reuse the same expectations as the prior merge, except that...
+  #
+  # ...a tree conflict occurs...
+  expected_output.add({
+      'D/H' : Item(status='  ', treeconflict='C')
+      })
+  expected_A_status.add({
+      'D/H' : Item(status='! ', treeconflict='C')
+      })
+  # ...non-inheritable mergeinfo is set on the root of the missing subtree...
+  expected_mergeinfo_output.add({
+      'D' : Item(status=' U')
+      })
+  expected_A_status.tweak('D', status=' M')
+  expected_A_disk.tweak('D', props={SVN_PROP_MERGEINFO : '/A_COPY/D:2-4*'})
+  # ...the mergeinfo on the target root includes the latest rev on the branch.
+  expected_A_disk.tweak('', props={SVN_PROP_MERGEINFO : '/A_COPY:2-4'})
+  svntest.actions.run_and_verify_merge(A_path, None, None,
+                                       sbox.repo_url + '/A_COPY', None,
+                                       expected_output,
+                                       expected_mergeinfo_output,
+                                       expected_elision_output,
+                                       expected_A_disk,
+                                       expected_A_status,
+                                       expected_A_skip,
+                                       None, None, None, None,
+                                       None, 1, 1, "--reintegrate")
 
 def reintegrate_fail_on_stale_source(sbox):
   "merge --reintegrate should fail on stale source"
@@ -18719,10 +18811,11 @@ def reintegrate_with_subtree_merges(sbox
                                      'Merge everything from A to A_COPY',
                                      wc_dir)
 
-  # Now update the WC and try to reintegrate.  Currently this fails because
-  # while we really have merged everything from A to A_COPY, the naive
-  # interpretation of the mergeinfo on A_COPY doesn't reflect this which
-  # previously caused the test to fail with this error:
+  # Now update the WC and try to reintegrate.  Since we really have merged
+  # everything from A to A_COPY, even though it was done via subtree merges,
+  # the reintegrate should succeed.  Previously it failed because the naive
+  # interpretation of the mergeinfo on A_COPY didn't reflect that it was 
+  # fully synced with A, resulting in this error:
   #
   #    svn merge ^/A_COPY A --reintegrate
   #    ..\..\..\subversion\svn\merge-cmd.c:358: (apr_err=195016)
@@ -19032,7 +19125,7 @@ test_list = [ None,
               reintegrate_fail_on_modified_wc,
               reintegrate_fail_on_mixed_rev_wc,
               reintegrate_fail_on_switched_wc,
-              reintegrate_fail_on_shallow_wc,
+              reintegrate_on_shallow_wc,
               SkipUnless(reintegrate_fail_on_stale_source,
                          server_has_mergeinfo),
               SkipUnless(dont_add_mergeinfo_from_own_history,

Modified: subversion/branches/svn-patch-improvements/subversion/tests/cmdline/patch_tests.py
URL: http://svn.apache.org/viewvc/subversion/branches/svn-patch-improvements/subversion/tests/cmdline/patch_tests.py?rev=934607&r1=934606&r2=934607&view=diff
==============================================================================
--- subversion/branches/svn-patch-improvements/subversion/tests/cmdline/patch_tests.py (original)
+++ subversion/branches/svn-patch-improvements/subversion/tests/cmdline/patch_tests.py Thu Apr 15 21:48:42 2010
@@ -2352,6 +2352,140 @@ def patch_with_include_exclude_patterns(
                                        "--include-pattern", "*a",
                                        "--exclude-pattern", "A/*/gamma")
 
+def patch_with_ignore_whitespaces(sbox):
+  "ignore whitespaces when patching"
+
+  sbox.build()
+  wc_dir = sbox.wc_dir
+
+  patch_file_path = tempfile.mkstemp(dir=os.path.abspath(svntest.main.temp_dir))[1]
+  mu_path = os.path.join(wc_dir, 'A', 'mu')
+
+  mu_contents = [
+    "Dear internet user,\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\t\tindividual 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",
+    "    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"
+  ]
+
+  # Set mu contents
+  svntest.main.file_write(mu_path, ''.join(mu_contents))
+  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)
+
+  # Apply patch with leading and trailing spaces removed and tabs transformed 
+  # to spaces. The patch should match and the hunks should be written to the
+  # target as-is.
+
+  unidiff_patch = [
+    "Index: A/mu\n",
+    "===================================================================\n",
+    "--- A/mu.orig	2009-06-24 15:23:55.000000000 +0100\n",
+    "+++ A/mu	2009-06-24 15:21:23.000000000 +0100\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 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",
+    "@@ -14,11 +17,8 @@\n",
+    "BATCH NUMBERS :\n",
+    "EULO/1007/444/606/08;\n",
+    "SERIAL NUMBER: 45327\n",
+    "-and PROMOTION DATE: 13th June. 2009\n",
+    "+and PROMOTION DATE: 14th 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",
+  ]
+
+  svntest.main.file_write(patch_file_path, ''.join(unidiff_patch))
+
+  gamma_contents = "It is the file 'gamma'.\n"
+  iota_contents = "This is the file 'iota'.\nSome more bytes\n"
+  new_contents = "new\n"
+  mu_contents = [
+    "Dear internet user,\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",
+    "\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 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: 14th 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",
+  ]
+
+  expected_output = [
+    'U         %s\n' % os.path.join(wc_dir, 'A', 'mu'),
+  ]
+
+  expected_disk = svntest.main.greek_state.copy()
+  expected_disk.tweak('A/mu', contents=''.join(mu_contents))
+
+  expected_status = svntest.actions.get_virginal_state(wc_dir, 1)
+  expected_status.tweak('A/mu', status='M ', wc_rev=2)
+
+  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
+                                       "--ignore-whitespaces",)
+
 ########################################################################
 #Run the tests
 
@@ -2375,6 +2509,7 @@ test_list = [ None,
               patch_with_include_patterns,
               patch_with_exclude_patterns,
               patch_with_include_exclude_patterns,
+              patch_with_ignore_whitespaces,
             ]
 
 if __name__ == '__main__':

Modified: subversion/branches/svn-patch-improvements/subversion/tests/libsvn_client/client-test.c
URL: http://svn.apache.org/viewvc/subversion/branches/svn-patch-improvements/subversion/tests/libsvn_client/client-test.c?rev=934607&r1=934606&r2=934607&view=diff
==============================================================================
--- subversion/branches/svn-patch-improvements/subversion/tests/libsvn_client/client-test.c (original)
+++ subversion/branches/svn-patch-improvements/subversion/tests/libsvn_client/client-test.c Thu Apr 15 21:48:42 2010
@@ -350,7 +350,7 @@ test_patch(const svn_test_opts_t *opts,
   /* Apply the patch. */
   SVN_ERR(svn_client_patch(patch_file_path, wc_path, FALSE, 0, FALSE,
                            NULL, NULL, &patched_tempfiles, &reject_tempfiles,
-                           ctx, pool, pool));
+                           FALSE, ctx, pool, pool));
   SVN_ERR(svn_io_file_close(patch_file, pool));
 
   SVN_ERR_ASSERT(apr_hash_count(patched_tempfiles) == 1);

Modified: subversion/branches/svn-patch-improvements/subversion/tests/libsvn_diff/parse-diff-test.c
URL: http://svn.apache.org/viewvc/subversion/branches/svn-patch-improvements/subversion/tests/libsvn_diff/parse-diff-test.c?rev=934607&r1=934606&r2=934607&view=diff
==============================================================================
--- subversion/branches/svn-patch-improvements/subversion/tests/libsvn_diff/parse-diff-test.c (original)
+++ subversion/branches/svn-patch-improvements/subversion/tests/libsvn_diff/parse-diff-test.c Thu Apr 15 21:48:42 2010
@@ -64,6 +64,7 @@ test_parse_unidiff(apr_pool_t *pool)
   apr_size_t len;
   const char *fname = "test_parse_unidiff.patch";
   svn_boolean_t reverse;
+  svn_boolean_t ignore_whitespaces;
   int i;
   apr_pool_t *iterpool;
 
@@ -81,6 +82,7 @@ test_parse_unidiff(apr_pool_t *pool)
                              "Cannot write to '%s'", fname);
 
   reverse = FALSE;
+  ignore_whitespaces = FALSE;
   iterpool = svn_pool_create(pool);
   for (i = 0; i < 2; i++)
     {
@@ -101,7 +103,8 @@ test_parse_unidiff(apr_pool_t *pool)
       /* We have two patches with one hunk each.
        * Parse the first patch. */
       SVN_ERR(svn_diff_parse_next_patch(&patch, patch_file, reverse,
-                                        iterpool, iterpool));
+                                        ignore_whitespaces, iterpool, 
+                                        iterpool));
       SVN_ERR_ASSERT(patch);
       SVN_ERR_ASSERT(! strcmp(patch->old_filename, "A/C/gamma"));
       SVN_ERR_ASSERT(! strcmp(patch->new_filename, "A/C/gamma"));
@@ -143,7 +146,8 @@ test_parse_unidiff(apr_pool_t *pool)
       SVN_ERR_ASSERT(buf->len == 0);
 
       /* Parse the second patch. */
-      SVN_ERR(svn_diff_parse_next_patch(&patch, patch_file, reverse, pool, pool));
+      SVN_ERR(svn_diff_parse_next_patch(&patch, patch_file, reverse, 
+                                        ignore_whitespaces, pool, pool));
       SVN_ERR_ASSERT(patch);
       if (reverse)
         {



Mime
View raw message