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

svn commit: r1058221 [2/3] - in /subversion/branches/ignore-mergeinfo-log: ./ build/ contrib/hook-scripts/ notes/api-errata/1.7/ notes/commit-access-templates/ subversion/include/ subversion/include/private/ subversion/libsvn_client/ subversion/libsvn_...

Modified: subversion/branches/ignore-mergeinfo-log/subversion/libsvn_diff/parse-diff.c
URL: http://svn.apache.org/viewvc/subversion/branches/ignore-mergeinfo-log/subversion/libsvn_diff/parse-diff.c?rev=1058221&r1=1058220&r2=1058221&view=diff
==============================================================================
--- subversion/branches/ignore-mergeinfo-log/subversion/libsvn_diff/parse-diff.c (original)
+++ subversion/branches/ignore-mergeinfo-log/subversion/libsvn_diff/parse-diff.c Wed Jan 12 16:29:32 2011
@@ -35,20 +35,33 @@
 #include "svn_diff.h"
 
 #include "private/svn_eol_private.h"
+#include "private/svn_dep_compat.h"
 
 /* Helper macro for readability */
 #define starts_with(str, start)  \
   (strncmp((str), (start), strlen(start)) == 0)
 
-struct svn_diff_hunk_t {
-  /* Hunk texts (see include/svn_diff.h). */
-  svn_stream_t *diff_text;
-  svn_stream_t *original_text;
-  svn_stream_t *modified_text;
+/* This struct describes a range within a file, as well as the
+ * current cursor position within the range. All numbers are in bytes. */
+struct svn_diff__hunk_range {
+  apr_off_t start;
+  apr_off_t end;
+  apr_off_t current;
+};
 
+struct svn_diff_hunk_t {
   /* The patch this hunk belongs to. */
   svn_patch_t *patch;
 
+  /* APR file handle to the patch file this hunk came from. */
+  apr_file_t *apr_file;
+
+  /* Ranges used to keep track of this hunk's texts positions within
+   * the patch file. */
+  struct svn_diff__hunk_range diff_text_range;
+  struct svn_diff__hunk_range original_text_range;
+  struct svn_diff__hunk_range modified_text_range;
+
   /* Hunk ranges as they appeared in the patch file.
    * All numbers are lines, not bytes. */
   svn_linenum_t original_start;
@@ -61,28 +74,28 @@ struct svn_diff_hunk_t {
   svn_linenum_t trailing_context;
 };
 
-svn_error_t *
-svn_diff_hunk_reset_diff_text(const svn_diff_hunk_t *hunk)
+void
+svn_diff_hunk_reset_diff_text(svn_diff_hunk_t *hunk)
 {
-  return svn_error_return(svn_stream_reset(hunk->diff_text));
+  hunk->diff_text_range.current = hunk->diff_text_range.start;
 }
 
-svn_error_t *
-svn_diff_hunk_reset_original_text(const svn_diff_hunk_t *hunk)
+void
+svn_diff_hunk_reset_original_text(svn_diff_hunk_t *hunk)
 {
   if (hunk->patch->reverse)
-    return svn_error_return(svn_stream_reset(hunk->modified_text));
+    hunk->modified_text_range.current = hunk->modified_text_range.start;
   else
-    return svn_error_return(svn_stream_reset(hunk->original_text));
+    hunk->original_text_range.current = hunk->original_text_range.start;
 }
 
-svn_error_t *
-svn_diff_hunk_reset_modified_text(const svn_diff_hunk_t *hunk)
+void
+svn_diff_hunk_reset_modified_text(svn_diff_hunk_t *hunk)
 {
   if (hunk->patch->reverse)
-    return svn_error_return(svn_stream_reset(hunk->original_text));
+    hunk->original_text_range.current = hunk->original_text_range.start;
   else
-    return svn_error_return(svn_stream_reset(hunk->modified_text));
+    hunk->modified_text_range.current = hunk->modified_text_range.start;
 }
 
 svn_linenum_t
@@ -253,32 +266,49 @@ parse_hunk_header(const char *header, sv
   return TRUE;
 }
 
-/* Set *EOL to the first end-of-line string found in the stream
- * accessed through READ_FN, MARK_FN and SEEK_FN, whose stream baton
- * is BATON.  Leave the stream read position unchanged.
+/* Set *EOL to the first end-of-line string found in FILE.
+ * Start scanning at the current file cursor offset and scan up
+ * to MAX_LEN bytes. Leave the current file cursor position unchanged.
  * Allocate *EOL statically; POOL is a scratch pool. */
 static svn_error_t *
-scan_eol(const char **eol, svn_stream_t *stream, apr_pool_t *pool)
+scan_eol(const char **eol, apr_file_t *file, apr_size_t max_len,
+         apr_pool_t *pool)
 {
   const char *eol_str;
-  svn_stream_mark_t *mark;
+  apr_off_t pos;
+  apr_size_t total_len;
 
-  SVN_ERR(svn_stream_mark(stream, &mark, pool));
+  pos = 0;
+  SVN_ERR(svn_io_file_seek(file, APR_CUR, &pos, pool));
 
   eol_str = NULL;
+  total_len = 0;
   while (! eol_str)
     {
-      char buf[512];
+      char buf[256];
       apr_size_t len;
+      svn_error_t *err;
+
+      if (total_len >= max_len)
+        break;
+
+      len = sizeof(buf) - 1 < (max_len - total_len) ? sizeof(buf) - 1
+                                                    : (max_len - total_len);
+      err = svn_io_file_read_full(file, buf, sizeof(buf) - 1, &len, pool);
+      if (err && APR_STATUS_IS_EOF(err->apr_err))
+        svn_error_clear(err);
+      else
+        SVN_ERR(err);
 
-      len = sizeof(buf);
-      SVN_ERR(svn_stream_read(stream, buf, &len));
       if (len == 0)
         break; /* EOF */
+
+      buf[len] = '\0';
+      total_len += len;
       eol_str = svn_eol__detect_eol(buf, buf + len);
     }
 
-  SVN_ERR(svn_stream_seek(stream, mark));
+  SVN_ERR(svn_io_file_seek(file, APR_SET, &pos, pool));
 
   *eol = eol_str;
 
@@ -286,95 +316,129 @@ scan_eol(const char **eol, svn_stream_t 
 }
 
 /* A helper function similar to svn_stream_readline_detect_eol(),
- * suitable for reading original or modified hunk text from a STREAM
- * which has been mapped onto a hunk region within a unidiff patch file.
- *
- * Allocate *STRINGBUF in RESULT_POOL, and read into it one line from STREAM.
+ * suitable for reading a line of text from a range in the patch file.
  *
- * STREAM is expected to contain unidiff text.
- * Leading unidiff symbols ('+', '-', and ' ') are removed from the line,
- * Any lines commencing with the VERBOTEN character are discarded.
- * VERBOTEN should be '+' or '-', depending on which form of hunk text
- * is being read.
+ * Allocate *STRINGBUF in RESULT_POOL, and read into it one line from FILE.
+ * Reading stops either after a line-terminator was found or after
+ * MAX_LEN bytes have been read.
  *
  * The line-terminator is detected automatically and stored in *EOL
- * if EOL is not NULL. If EOF is reached and the stream does not end
+ * if EOL is not NULL. If EOF is reached and FILE does not end
  * with a newline character, and EOL is not NULL, *EOL is set to NULL.
  *
  * SCRATCH_POOL is used for temporary allocations.
  */
 static svn_error_t *
-hunk_readline(svn_stream_t *stream,
-              svn_stringbuf_t **stringbuf,
-              const char **eol,
-              svn_boolean_t *eof,
-              char verboten,
-              apr_pool_t *result_pool,
-              apr_pool_t *scratch_pool)
+readline(apr_file_t *file,
+         svn_stringbuf_t **stringbuf,
+         const char **eol,
+         svn_boolean_t *eof,
+         apr_size_t max_len,
+         apr_pool_t *result_pool,
+         apr_pool_t *scratch_pool)
 {
   svn_stringbuf_t *str;
-  apr_pool_t *iterpool;
-  svn_boolean_t filtered;
   const char *eol_str;
+  apr_size_t numbytes;
+  const char *match;
+  char c;
+  apr_size_t len;
+
+  str = svn_stringbuf_create_ensure(80, result_pool);
+
+  SVN_ERR(scan_eol(&eol_str, file, max_len, scratch_pool));
+  if (eol)
+    *eol = eol_str;
+  if (eol_str == NULL)
+    {
+      /* No newline until EOF, EOL_STR can be anything. */
+      eol_str = APR_EOL_STR;
+    }
+
+  /* Read into STR up to and including the next EOL sequence. */
+  match = eol_str;
+  numbytes = 1;
+  len = 0;
+  while (*match)
+    {
+      svn_error_t *err;
+
+      err = svn_io_file_read_full(file, &c, sizeof(c), &numbytes,
+                                  scratch_pool);
+      if (err && APR_STATUS_IS_EOF(err->apr_err))
+        svn_error_clear(err);
+      else
+        SVN_ERR(err);
+      len++;
+      if (numbytes != 1 || len > max_len)
+        {
+          *eof = TRUE;
+          *stringbuf = str;
+          return SVN_NO_ERROR;
+        }
+      if (c == *match)
+        match++;
+      else
+        match = eol_str;
 
-  *eof = FALSE;
+      svn_stringbuf_appendbyte(str, c);
+    }
 
-  iterpool = svn_pool_create(scratch_pool);
-  do
-    {
-      apr_size_t numbytes;
-      const char *match;
-      char c;
+  *eof = FALSE;
+  svn_stringbuf_chop(str, match - eol_str);
+  *stringbuf = str;
 
-      svn_pool_clear(iterpool);
+  return SVN_NO_ERROR;
+}
 
-      /* Since we're reading one character at a time, let's at least
-         optimize for the 90% case.  90% of the time, we can avoid the
-         stringbuf ever having to realloc() itself if we start it out at
-         80 chars.  */
-      str = svn_stringbuf_create_ensure(80, iterpool);
+/* Read a line of original or modified hunk text from the specified
+ * RANGE within FILE. FILE is expected to contain unidiff text.
+ * Leading unidiff symbols ('+', '-', and ' ') are removed from the line,
+ * Any lines commencing with the VERBOTEN character are discarded.
+ * VERBOTEN should be '+' or '-', depending on which form of hunk text
+ * is being read.
+ * 
+ * All other parameters are as in svn_diff_hunk_readline_original_text()
+ * and svn_diff_hunk_readline_modified_text().
+ */
+static svn_error_t *
+hunk_readline_original_or_modified(apr_file_t *file,
+                                   struct svn_diff__hunk_range *range,
+                                   svn_stringbuf_t **stringbuf,
+                                   const char **eol,
+                                   svn_boolean_t *eof,
+                                   char verboten,
+                                   apr_pool_t *result_pool,
+                                   apr_pool_t *scratch_pool)
+{
+  apr_size_t max_len;
+  svn_boolean_t filtered;
+  apr_off_t pos;
+  svn_stringbuf_t *str;
 
-      SVN_ERR(scan_eol(&eol_str, stream, iterpool));
+  if (range->current >= range->end)
+    {
+      /* We're past the range. Indicate that no bytes can be read. */
+      *eof = TRUE;
       if (eol)
-        *eol = eol_str;
-      if (eol_str == NULL)
-        {
-          /* No newline until EOF, EOL_STR can be anything. */
-          eol_str = APR_EOL_STR;
-        }
-
-      /* Read into STR up to and including the next EOL sequence. */
-      match = eol_str;
-      numbytes = 1;
-      while (*match)
-        {
-          SVN_ERR(svn_stream_read(stream, &c, &numbytes));
-          if (numbytes != 1)
-            {
-              /* a 'short' read means the stream has run out. */
-              *eof = TRUE;
-              /* We know we don't have a whole EOL sequence, but ensure we
-               * don't chop off any partial EOL sequence that we may have. */
-              match = eol_str;
-              /* Process this short (or empty) line just like any other
-               * except with *EOF set. */
-              break;
-            }
-
-          if (c == *match)
-            match++;
-          else
-            match = eol_str;
-
-          svn_stringbuf_appendbyte(str, c);
-        }
+        *eol = NULL;
+      *stringbuf = svn_stringbuf_create("", result_pool);
+      return SVN_NO_ERROR;
+    }
 
-      svn_stringbuf_chop(str, match - eol_str);
+  pos = 0;
+  SVN_ERR(svn_io_file_seek(file, APR_CUR, &pos,  scratch_pool));
+  SVN_ERR(svn_io_file_seek(file, APR_SET, &range->current, scratch_pool));
+  do
+    {
+      max_len = range->end - range->current;
+      SVN_ERR(readline(file, &str, eol, eof, max_len,
+                       result_pool, scratch_pool));
+      range->current = 0;
+      SVN_ERR(svn_io_file_seek(file, APR_CUR, &range->current, scratch_pool));
       filtered = (str->data[0] == verboten || str->data[0] == '\\');
     }
   while (filtered && ! *eof);
-  /* Not destroying the iterpool just yet since we still need STR
-   * which is allocated in it. */
 
   if (filtered)
     {
@@ -392,46 +456,49 @@ hunk_readline(svn_stream_t *stream,
       *stringbuf = svn_stringbuf_dup(str, result_pool);
     }
 
-  /* Done. RIP iterpool. */
-  svn_pool_destroy(iterpool);
+  SVN_ERR(svn_io_file_seek(file, APR_SET, &pos, scratch_pool));
 
   return SVN_NO_ERROR;
 }
 
 svn_error_t *
-svn_diff_hunk_readline_original_text(const svn_diff_hunk_t *hunk,
+svn_diff_hunk_readline_original_text(svn_diff_hunk_t *hunk,
                                      svn_stringbuf_t **stringbuf,
                                      const char **eol,
                                      svn_boolean_t *eof,
                                      apr_pool_t *result_pool,
                                      apr_pool_t *scratch_pool)
 {
-  return svn_error_return(hunk_readline(hunk->patch->reverse ?
-                                          hunk->modified_text :
-                                          hunk->original_text,
-                                        stringbuf, eol, eof,
-                                        hunk->patch->reverse ? '-' : '+',
-                                        result_pool, scratch_pool));
+  return svn_error_return(
+    hunk_readline_original_or_modified(hunk->apr_file,
+                                       hunk->patch->reverse ?
+                                         &hunk->modified_text_range :
+                                         &hunk->original_text_range,
+                                       stringbuf, eol, eof,
+                                       hunk->patch->reverse ? '-' : '+',
+                                       result_pool, scratch_pool));
 }
 
 svn_error_t *
-svn_diff_hunk_readline_modified_text(const svn_diff_hunk_t *hunk,
+svn_diff_hunk_readline_modified_text(svn_diff_hunk_t *hunk,
                                      svn_stringbuf_t **stringbuf,
                                      const char **eol,
                                      svn_boolean_t *eof,
                                      apr_pool_t *result_pool,
                                      apr_pool_t *scratch_pool)
 {
-  return svn_error_return(hunk_readline(hunk->patch->reverse ?
-                                          hunk->original_text :
-                                          hunk->modified_text,
-                                        stringbuf, eol, eof,
-                                        hunk->patch->reverse ? '+' : '-',
-                                        result_pool, scratch_pool));
+  return svn_error_return(
+    hunk_readline_original_or_modified(hunk->apr_file,
+                                       hunk->patch->reverse ?
+                                         &hunk->original_text_range :
+                                         &hunk->modified_text_range,
+                                       stringbuf, eol, eof,
+                                       hunk->patch->reverse ? '+' : '-',
+                                       result_pool, scratch_pool));
 }
 
 svn_error_t *
-svn_diff_hunk_readline_diff_text(const svn_diff_hunk_t *hunk,
+svn_diff_hunk_readline_diff_text(svn_diff_hunk_t *hunk,
                                  svn_stringbuf_t **stringbuf,
                                  const char **eol,
                                  svn_boolean_t *eof,
@@ -440,31 +507,52 @@ svn_diff_hunk_readline_diff_text(const s
 {
   svn_diff_hunk_t dummy;
   svn_stringbuf_t *line;
+  apr_size_t max_len;
+  apr_off_t pos;
 
-  SVN_ERR(svn_stream_readline_detect_eol(hunk->diff_text, &line, eol, eof,
-                                         result_pool));
+  if (hunk->diff_text_range.current >= hunk->diff_text_range.end)
+    {
+      /* We're past the range. Indicate that no bytes can be read. */
+      *eof = TRUE;
+      if (eol)
+        *eol = NULL;
+      *stringbuf = svn_stringbuf_create("", result_pool);
+      return SVN_NO_ERROR;
+    }
 
+  pos = 0;
+  SVN_ERR(svn_io_file_seek(hunk->apr_file, APR_CUR, &pos, scratch_pool));
+  SVN_ERR(svn_io_file_seek(hunk->apr_file, APR_SET,
+                           &hunk->diff_text_range.current, scratch_pool));
+  max_len = hunk->diff_text_range.end - hunk->diff_text_range.current;
+  SVN_ERR(readline(hunk->apr_file, &line, eol, eof, max_len, result_pool,
+                   scratch_pool));
+  hunk->diff_text_range.current = 0;
+  SVN_ERR(svn_io_file_seek(hunk->apr_file, APR_CUR,
+                           &hunk->diff_text_range.current, scratch_pool));
+  SVN_ERR(svn_io_file_seek(hunk->apr_file, APR_SET, &pos, scratch_pool));
+  
   if (hunk->patch->reverse)
     {
       if (parse_hunk_header(line->data, &dummy, "@@", scratch_pool))
         {
           /* Line is a hunk header, reverse it. */
-          *stringbuf = svn_stringbuf_createf(result_pool,
-                                             "@@ -%lu,%lu +%lu,%lu @@",
-                                             hunk->modified_start,
-                                             hunk->modified_length,
-                                             hunk->original_start,
-                                             hunk->original_length);
+          line = svn_stringbuf_createf(result_pool,
+                                       "@@ -%lu,%lu +%lu,%lu @@",
+                                       hunk->modified_start,
+                                       hunk->modified_length,
+                                       hunk->original_start,
+                                       hunk->original_length);
         }
       else if (parse_hunk_header(line->data, &dummy, "##", scratch_pool))
         {
           /* Line is a hunk header, reverse it. */
-          *stringbuf = svn_stringbuf_createf(result_pool,
-                                             "## -%lu,%lu +%lu,%lu ##",
-                                             hunk->modified_start,
-                                             hunk->modified_length,
-                                             hunk->original_start,
-                                             hunk->original_length);
+          line = svn_stringbuf_createf(result_pool,
+                                       "## -%lu,%lu +%lu,%lu ##",
+                                       hunk->modified_start,
+                                       hunk->modified_length,
+                                       hunk->original_start,
+                                       hunk->original_length);
         }
       else
         {
@@ -472,12 +560,10 @@ svn_diff_hunk_readline_diff_text(const s
             line->data[0] = '-';
           else if (line->data[0] == '-')
             line->data[0] = '+';
-
-          *stringbuf = line;
         }
     }
-  else
-    *stringbuf = line;
+
+  *stringbuf = line;
 
   return SVN_NO_ERROR;
 }
@@ -504,21 +590,21 @@ parse_prop_name(const char **prop_name, 
   return SVN_NO_ERROR;
 }
 
-/* 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. 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
+/* Return the next *HUNK from a PATCH in APR_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 IGNORE_WHITESPACE is TRUE, let lines without leading spaces be
- * recognized as context lines.  Allocate results in
- * RESULT_POOL.  Use SCRATCH_POOL for all other allocations. */
+ * NULL.  If IGNORE_WHITESPACE is TRUE, lines without leading spaces will be
+ * treated as context lines.  Allocate results in RESULT_POOL.
+ * Use SCRATCH_POOL for all other allocations. */
 static svn_error_t *
 parse_next_hunk(svn_diff_hunk_t **hunk,
                 svn_boolean_t *is_property,
                 const char **prop_name,
                 svn_diff_operation_kind_t *prop_operation,
                 svn_patch_t *patch,
-                svn_stream_t *stream,
+                apr_file_t *apr_file,
                 svn_boolean_t ignore_whitespace,
                 apr_pool_t *result_pool,
                 apr_pool_t *scratch_pool)
@@ -530,9 +616,6 @@ parse_next_hunk(svn_diff_hunk_t **hunk,
   svn_boolean_t eof, in_hunk, hunk_seen;
   apr_off_t pos, last_line;
   apr_off_t start, end;
-  svn_stream_t *diff_text;
-  svn_stream_t *original_text;
-  svn_stream_t *modified_text;
   svn_linenum_t original_lines;
   svn_linenum_t modified_lines;
   svn_linenum_t leading_context;
@@ -546,7 +629,7 @@ parse_next_hunk(svn_diff_hunk_t **hunk,
   *prop_name = NULL;
   *is_property = FALSE;
 
-  if (apr_file_eof(patch->patch_file) == APR_EOF)
+  if (apr_file_eof(apr_file) == APR_EOF)
     {
       /* No more hunks here. */
       *hunk = NULL;
@@ -562,7 +645,7 @@ parse_next_hunk(svn_diff_hunk_t **hunk,
 
   /* Get current seek position -- APR has no ftell() :( */
   pos = 0;
-  SVN_ERR(svn_io_file_seek(patch->patch_file, APR_CUR, &pos, scratch_pool));
+  SVN_ERR(svn_io_file_seek(apr_file, APR_CUR, &pos, scratch_pool));
 
   iterpool = svn_pool_create(scratch_pool);
   do
@@ -572,15 +655,14 @@ parse_next_hunk(svn_diff_hunk_t **hunk,
 
       /* Remember the current line's offset, and read the line. */
       last_line = pos;
-      SVN_ERR(svn_stream_readline_detect_eol(stream, &line, NULL, &eof,
-                                             iterpool));
+      SVN_ERR(readline(apr_file, &line, NULL, &eof, APR_SIZE_MAX,
+                       iterpool, iterpool));
 
       if (! eof)
         {
-          /* Update line offset for next iteration.
-           * APR has no ftell() :( */
+          /* Update line offset for next iteration. */
           pos = 0;
-          SVN_ERR(svn_io_file_seek(patch->patch_file, APR_CUR, &pos, iterpool));
+          SVN_ERR(svn_io_file_seek(apr_file, APR_CUR, &pos, iterpool));
         }
 
       /* Lines starting with a backslash are comments, such as
@@ -603,10 +685,9 @@ parse_next_hunk(svn_diff_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)
-              || (ignore_whitespace && c != del && c != add)))
+          if (original_lines > 0 && modified_lines > 0 &&
+              ((c == ' ') || (! eof && line->len == 0) ||
+               (ignore_whitespace && c != del && c != add)))
             {
               hunk_seen = TRUE;
               original_lines--;
@@ -653,9 +734,6 @@ parse_next_hunk(svn_diff_hunk_t **hunk,
         }
       else
         {
-          /* ### Add an is_hunk_header() helper function that returns
-           * ### the proper atat string? Then we could collapse the
-           * ### following two if-clauses. */
           if (starts_with(line->data, text_atat))
             {
               /* Looks like we have a hunk header, try to rip it apart. */
@@ -717,41 +795,23 @@ parse_next_hunk(svn_diff_hunk_t **hunk,
     /* Rewind to the start of the line just read, so subsequent calls
      * to this function or svn_diff_parse_next_patch() don't end
      * up skipping the line -- it may contain a patch or hunk header. */
-    SVN_ERR(svn_io_file_seek(patch->patch_file, APR_SET, &last_line,
-                             scratch_pool));
+    SVN_ERR(svn_io_file_seek(apr_file, APR_SET, &last_line, scratch_pool));
 
   if (hunk_seen && start < end)
     {
-      apr_file_t *f;
-      apr_int32_t flags = APR_READ | APR_BUFFERED;
-
-      /* Create a stream which returns the hunk text itself. */
-      SVN_ERR(svn_io_file_open(&f, patch->path, flags, APR_OS_DEFAULT,
-                               result_pool));
-      diff_text = svn_stream_from_aprfile_range_readonly(f, FALSE,
-                                                         start, end,
-                                                         result_pool);
-
-      /* Create a stream which returns the original hunk text. */
-      SVN_ERR(svn_io_file_open(&f, patch->path, flags, APR_OS_DEFAULT,
-                               result_pool));
-      original_text = svn_stream_from_aprfile_range_readonly(f, FALSE,
-                                                             start, end,
-                                                             result_pool);
-
-      /* Create a stream which returns the modified hunk text. */
-      SVN_ERR(svn_io_file_open(&f, patch->path, flags, APR_OS_DEFAULT,
-                               result_pool));
-      modified_text = svn_stream_from_aprfile_range_readonly(f, FALSE,
-                                                             start, end,
-                                                             result_pool);
-
-      (*hunk)->diff_text = diff_text;
       (*hunk)->patch = patch;
-      (*hunk)->original_text = original_text;
-      (*hunk)->modified_text = modified_text;
+      (*hunk)->apr_file = apr_file;
       (*hunk)->leading_context = leading_context;
       (*hunk)->trailing_context = trailing_context;
+      (*hunk)->diff_text_range.start = start;
+      (*hunk)->diff_text_range.current = start;
+      (*hunk)->diff_text_range.end = end;
+      (*hunk)->original_text_range.start = start;
+      (*hunk)->original_text_range.current = start;
+      (*hunk)->original_text_range.end = end;
+      (*hunk)->modified_text_range.start = start;
+      (*hunk)->modified_text_range.current = start;
+      (*hunk)->modified_text_range.end = end;
     }
   else
     /* Something went wrong, just discard the result. */
@@ -775,18 +835,6 @@ compare_hunks(const void *a, const void 
   return 0;
 }
 
-/*
- * Ensure that all streams which were opened for HUNK are closed.
- */
-static svn_error_t *
-close_hunk(const svn_diff_hunk_t *hunk)
-{
-  SVN_ERR(svn_stream_close(hunk->original_text));
-  SVN_ERR(svn_stream_close(hunk->modified_text));
-  SVN_ERR(svn_stream_close(hunk->diff_text));
-  return SVN_NO_ERROR;
-}
-
 /* Possible states of the diff header parser. */
 enum parse_state
 {
@@ -1134,70 +1182,131 @@ add_property_hunk(svn_patch_t *patch, co
   return SVN_NO_ERROR;
 }
 
+struct svn_patch_file_t
+{
+  /* The APR file handle to the patch file. */
+  apr_file_t *apr_file;
+
+  /* The file offset at which the next patch is expected. */
+  apr_off_t next_patch_offset;
+};
+
+svn_error_t *
+svn_diff_open_patch_file(svn_patch_file_t **patch_file,
+                         const char *local_abspath,
+                         apr_pool_t *result_pool)
+{
+  svn_patch_file_t *p;
+
+  p = apr_palloc(result_pool, sizeof(*p));
+  SVN_ERR(svn_io_file_open(&p->apr_file, local_abspath,
+                           APR_READ | APR_BINARY, 0, result_pool));
+  p->next_patch_offset = 0;
+  *patch_file = p;
+
+  return SVN_NO_ERROR;
+}
+
+/* Parse hunks from APR_FILE and store them in PATCH->HUNKS.
+ * Parsing stops if no valid next hunk can be found.
+ * If IGNORE_WHITESPACE is TRUE, lines without
+ * leading spaces will be treated as context lines.
+ * Allocate results in RESULT_POOL.
+ * Use SCRATCH_POOL for temporary allocations. */
+static svn_error_t *
+parse_hunks(svn_patch_t *patch, apr_file_t *apr_file,
+            svn_boolean_t ignore_whitespace,
+            apr_pool_t *result_pool, apr_pool_t *scratch_pool)
+{
+  svn_diff_hunk_t *hunk;
+  svn_boolean_t is_property;
+  const char *last_prop_name;
+  const char *prop_name;
+  svn_diff_operation_kind_t prop_operation;
+  apr_pool_t *iterpool;
+
+  last_prop_name = NULL;
+
+  patch->hunks = apr_array_make(result_pool, 10, sizeof(svn_diff_hunk_t *));
+  patch->prop_patches = apr_hash_make(result_pool);
+  iterpool = svn_pool_create(scratch_pool);
+  do
+    {
+      svn_pool_clear(iterpool);
+
+      SVN_ERR(parse_next_hunk(&hunk, &is_property, &prop_name, &prop_operation,
+                              patch, apr_file, ignore_whitespace, result_pool,
+                              iterpool));
+
+      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, prop_operation,
+                                    result_pool));
+        }
+      else if (hunk)
+        {
+          APR_ARRAY_PUSH(patch->hunks, svn_diff_hunk_t *) = hunk;
+          last_prop_name = NULL;
+        }
+
+    }
+  while (hunk);
+  svn_pool_destroy(iterpool);
+
+  return SVN_NO_ERROR;
+}
+
+/* State machine for the diff header parser.
+ * Expected Input   Required state          Function to call */
+static struct transition transitions[] =
+{
+  {"--- ",          state_start,            diff_minus},
+  {"+++ ",          state_minus_seen,       diff_plus},
+  {"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},
+  {"+++ b/",        state_git_minus_seen,   git_plus},
+  {"+++ /dev/null", state_git_minus_seen,   git_plus},
+  {"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},
+  {"deleted file ", state_git_diff_seen,    git_deleted_file},
+};
+
 svn_error_t *
 svn_diff_parse_next_patch(svn_patch_t **patch,
-                          apr_file_t *patch_file,
+                          svn_patch_file_t *patch_file,
                           svn_boolean_t reverse,
                           svn_boolean_t ignore_whitespace,
                           apr_pool_t *result_pool,
                           apr_pool_t *scratch_pool)
 {
-  const char *fname;
-  svn_stream_t *stream;
   apr_off_t pos, last_line;
   svn_boolean_t eof;
   svn_boolean_t line_after_tree_header_read = FALSE;
-
   apr_pool_t *iterpool;
-
   enum parse_state state = state_start;
 
-  /* Our table consisting of:
-   * Expected Input     Required state          Function to call */
-  struct transition transitions[] =
-    {
-      {"--- ",          state_start,            diff_minus},
-      {"+++ ",          state_minus_seen,       diff_plus},
-      {"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},
-      {"+++ b/",        state_git_minus_seen,   git_plus},
-      {"+++ /dev/null", state_git_minus_seen,   git_plus},
-      {"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},
-      {"deleted file ", state_git_diff_seen,    git_deleted_file},
-    };
-
-  if (apr_file_eof(patch_file) == APR_EOF)
+  if (apr_file_eof(patch_file->apr_file) == APR_EOF)
     {
       /* No more patches here. */
       *patch = NULL;
       return SVN_NO_ERROR;
     }
 
-  /* Get the patch's filename. */
-  SVN_ERR(svn_io_file_name_get(&fname, patch_file, result_pool));
-
-  /* Record what we already know about the patch. */
   *patch = apr_pcalloc(result_pool, sizeof(**patch));
-  (*patch)->patch_file = patch_file;
-  (*patch)->path = fname;
 
-  /* Get a stream to read lines from the patch file.
-   * The file should not be closed when we close the stream so
-   * make sure it is disowned. */
-  stream = svn_stream_from_aprfile2(patch_file, TRUE, scratch_pool);
-
-  /* Get current seek position -- APR has no ftell() :( */
-  pos = 0;
-  SVN_ERR(svn_io_file_seek((*patch)->patch_file, APR_CUR, &pos, scratch_pool));
+  pos = patch_file->next_patch_offset;
+  SVN_ERR(svn_io_file_seek(patch_file->apr_file, APR_SET, &pos, scratch_pool));
 
   iterpool = svn_pool_create(scratch_pool);
-
   do
     {
       svn_stringbuf_t *line;
@@ -1207,15 +1316,15 @@ svn_diff_parse_next_patch(svn_patch_t **
 
       /* Remember the current line's offset, and read the line. */
       last_line = pos;
-      SVN_ERR(svn_stream_readline_detect_eol(stream, &line, NULL, &eof,
-                                             iterpool));
+      SVN_ERR(readline(patch_file->apr_file, &line, NULL, &eof,
+                       APR_SIZE_MAX, iterpool, iterpool));
 
       if (! eof)
         {
-          /* Update line offset for next iteration.
-           * APR has no ftell() :( */
+          /* Update line offset for next iteration. */
           pos = 0;
-          SVN_ERR(svn_io_file_seek((*patch)->patch_file, APR_CUR, &pos, iterpool));
+          SVN_ERR(svn_io_file_seek(patch_file->apr_file, APR_CUR, &pos,
+                                   iterpool));
         }
 
       /* Run the state machine. */
@@ -1231,27 +1340,26 @@ svn_diff_parse_next_patch(svn_patch_t **
             }
         }
 
-      if (state == state_unidiff_found
-          || state == state_git_header_found)
+      if (state == state_unidiff_found || state == state_git_header_found)
         {
           /* We have a valid diff header, yay! */
           break;
         }
-      else if (state == state_git_tree_seen
-               && line_after_tree_header_read)
+      else if (state == state_git_tree_seen && line_after_tree_header_read)
         {
           /* We have a valid diff header for a patch with only tree changes.
            * Rewind to the start of the line just read, so subsequent calls
            * to this function don't end up skipping the line -- it may
            * contain a patch. */
-          SVN_ERR(svn_io_file_seek((*patch)->patch_file, APR_SET, &last_line,
+          SVN_ERR(svn_io_file_seek(patch_file->apr_file, APR_SET, &last_line,
                                    scratch_pool));
           break;
         }
       else if (state == state_git_tree_seen)
-          line_after_tree_header_read = TRUE;
+        line_after_tree_header_read = TRUE;
 
-    } while (! eof);
+    }
+  while (! eof);
 
   (*patch)->reverse = reverse;
   if (reverse)
@@ -1268,49 +1376,14 @@ svn_diff_parse_next_patch(svn_patch_t **
       *patch = NULL;
     }
   else
-    {
-      svn_diff_hunk_t *hunk;
-      svn_boolean_t is_property;
-      const char *last_prop_name;
-      const char *prop_name;
-      svn_diff_operation_kind_t prop_operation;
-
-      last_prop_name = NULL;
-
-      /* Parse hunks. */
-      (*patch)->hunks = apr_array_make(result_pool, 10,
-                                       sizeof(svn_diff_hunk_t *));
-      (*patch)->prop_patches = apr_hash_make(result_pool);
-      do
-        {
-          svn_pool_clear(iterpool);
-
-          SVN_ERR(parse_next_hunk(&hunk, &is_property, &prop_name,
-                                  &prop_operation, *patch, stream,
-                                  ignore_whitespace,
-                                  result_pool, iterpool));
-
-          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, prop_operation,
-                                        result_pool));
-            }
-          else if (hunk)
-            {
-              APR_ARRAY_PUSH((*patch)->hunks, svn_diff_hunk_t *) = hunk;
-              last_prop_name = NULL;
-            }
-
-        }
-      while (hunk);
-    }
+    SVN_ERR(parse_hunks(*patch, patch_file->apr_file, ignore_whitespace,
+                        result_pool, iterpool));
 
   svn_pool_destroy(iterpool);
-  SVN_ERR(svn_stream_close(stream));
+
+  patch_file->next_patch_offset = 0;
+  SVN_ERR(svn_io_file_seek(patch_file->apr_file, APR_CUR,
+                           &patch_file->next_patch_offset, scratch_pool));
 
   if (*patch)
     {
@@ -1326,34 +1399,9 @@ svn_diff_parse_next_patch(svn_patch_t **
 }
 
 svn_error_t *
-svn_diff_close_patch(const svn_patch_t *patch, apr_pool_t *scratch_pool)
+svn_diff_close_patch_file(svn_patch_file_t *patch_file,
+                          apr_pool_t *scratch_pool)
 {
-  int i;
-  apr_hash_index_t *hi;
-
-  for (i = 0; i < patch->hunks->nelts; i++)
-    {
-      const svn_diff_hunk_t *hunk = APR_ARRAY_IDX(patch->hunks, i,
-                                                  svn_diff_hunk_t *);
-      SVN_ERR(close_hunk(hunk));
-    }
-
-  for (hi = apr_hash_first(scratch_pool, patch->prop_patches);
-       hi;
-       hi = apr_hash_next(hi))
-    {
-          svn_prop_patch_t *prop_patch;
-
-          prop_patch = svn__apr_hash_index_val(hi);
-
-          for (i = 0; i < prop_patch->hunks->nelts; i++)
-            {
-              const svn_diff_hunk_t *hunk;
-
-              hunk = APR_ARRAY_IDX(prop_patch->hunks, i, svn_diff_hunk_t *);
-              SVN_ERR(close_hunk(hunk));
-            }
-    }
-
-  return SVN_NO_ERROR;
+  return svn_error_return(svn_io_file_close(patch_file->apr_file,
+                                            scratch_pool));
 }

Modified: subversion/branches/ignore-mergeinfo-log/subversion/libsvn_fs_base/bdb/env.c
URL: http://svn.apache.org/viewvc/subversion/branches/ignore-mergeinfo-log/subversion/libsvn_fs_base/bdb/env.c?rev=1058221&r1=1058220&r2=1058221&view=diff
==============================================================================
--- subversion/branches/ignore-mergeinfo-log/subversion/libsvn_fs_base/bdb/env.c (original)
+++ subversion/branches/ignore-mergeinfo-log/subversion/libsvn_fs_base/bdb/env.c Wed Jan 12 16:29:32 2011
@@ -373,7 +373,7 @@ clear_cache(void *data)
 }
 #endif /* APR_HAS_THREADS */
 
-static volatile svn_atomic_t bdb_cache_state;
+static volatile svn_atomic_t bdb_cache_state = 0;
 
 static svn_error_t *
 bdb_init_cb(void *baton, apr_pool_t *pool)

Modified: subversion/branches/ignore-mergeinfo-log/subversion/libsvn_fs_base/lock.c
URL: http://svn.apache.org/viewvc/subversion/branches/ignore-mergeinfo-log/subversion/libsvn_fs_base/lock.c?rev=1058221&r1=1058220&r2=1058221&view=diff
==============================================================================
--- subversion/branches/ignore-mergeinfo-log/subversion/libsvn_fs_base/lock.c (original)
+++ subversion/branches/ignore-mergeinfo-log/subversion/libsvn_fs_base/lock.c Wed Jan 12 16:29:32 2011
@@ -33,6 +33,7 @@
 #include "err.h"
 #include "bdb/locks-table.h"
 #include "bdb/lock-tokens-table.h"
+#include "util/fs_skels.h"
 #include "../libsvn_fs/fs-loader.h"
 #include "private/svn_fs_util.h"
 
@@ -394,13 +395,41 @@ svn_fs_base__get_lock(svn_lock_t **lock,
   return svn_fs_base__retry_txn(fs, txn_body_get_lock, &args, FALSE, pool);
 }
 
+/* Implements `svn_fs_get_locks_callback_t', spooling lock information
+   to disk as the filesystem provides it.  BATON is an 'apr_file_t *'
+   object pointing to open, writable spool file.  We'll write the
+   spool file with a format like so:
+
+      SKEL1_LEN "\n" SKEL1 "\n" SKEL2_LEN "\n" SKEL2 "\n" ...
+
+   where each skel is a lock skel (the same format we use to store
+   locks in the `locks' table). */
+static svn_error_t *
+spool_locks_info(void *baton,
+                 svn_lock_t *lock,
+                 apr_pool_t *pool)
+{
+  svn_skel_t *lock_skel;
+  apr_file_t *spool_file = (apr_file_t *)baton;
+  const char *skel_len;
+  svn_stringbuf_t *skel_buf;
+
+  SVN_ERR(svn_fs_base__unparse_lock_skel(&lock_skel, lock, pool));
+  skel_buf = svn_skel__unparse(lock_skel, pool);
+  skel_len = apr_psprintf(pool, "%" APR_SIZE_T_FMT "\n", skel_buf->len);
+  SVN_ERR(svn_io_file_write_full(spool_file, skel_len, strlen(skel_len),
+                                 NULL, pool));
+  SVN_ERR(svn_io_file_write_full(spool_file, skel_buf->data,
+                                 skel_buf->len, NULL, pool));
+  return svn_io_file_write_full(spool_file, "\n", 1, NULL, pool);
+}
+
 
 struct locks_get_args
 {
   const char *path;
   svn_depth_t depth;
-  svn_fs_get_locks_callback_t get_locks_func;
-  void *get_locks_baton;
+  apr_file_t *spool_file;
 };
 
 
@@ -409,7 +438,7 @@ txn_body_get_locks(void *baton, trail_t 
 {
   struct locks_get_args *args = baton;
   return svn_fs_bdb__locks_get(trail->fs, args->path, args->depth,
-                               args->get_locks_func, args->get_locks_baton,
+                               spool_locks_info, args->spool_file,
                                trail, trail->pool);
 }
 
@@ -423,13 +452,62 @@ svn_fs_base__get_locks(svn_fs_t *fs,
                        apr_pool_t *pool)
 {
   struct locks_get_args args;
+  apr_off_t offset = 0;
+  svn_stream_t *stream;
+  svn_stringbuf_t *buf;
+  svn_boolean_t eof;
+  apr_pool_t *iterpool = svn_pool_create(pool);
 
   SVN_ERR(svn_fs__check_fs(fs, TRUE));
+
   args.path = svn_fs__canonicalize_abspath(path, pool);
   args.depth = depth;
-  args.get_locks_func = get_locks_func;
-  args.get_locks_baton = get_locks_baton;
-  return svn_fs_base__retry_txn(fs, txn_body_get_locks, &args, FALSE, pool);
+  SVN_ERR(svn_io_open_uniquely_named(&(args.spool_file), NULL, NULL, NULL,
+                                     NULL, svn_io_file_del_on_close,
+                                     pool, pool));
+  SVN_ERR(svn_fs_base__retry_txn(fs, txn_body_get_locks, &args, FALSE, pool));
+
+  /* Rewind the spool file, then re-read it, calling GET_LOCKS_FUNC(). */
+  SVN_ERR(svn_io_file_seek(args.spool_file, APR_SET, &offset, pool));
+  stream = svn_stream_from_aprfile2(args.spool_file, FALSE, pool);
+
+  while (1)
+    {
+      apr_size_t len, skel_len;
+      char c, *end, *skel_buf;
+      svn_skel_t *lock_skel;
+      svn_lock_t *lock;
+
+      svn_pool_clear(iterpool);
+
+      /* Read a skel length line and parse it for the skel's length.  */
+      SVN_ERR(svn_stream_readline(stream, &buf, "\n", &eof, iterpool));
+      if (eof)
+        break;
+      skel_len = (size_t) strtoul(buf->data, &end, 10);
+      if (skel_len == (size_t) ULONG_MAX || *end != '\0')
+        return svn_error_create(SVN_ERR_MALFORMED_FILE, NULL, NULL);
+
+      /* Now read that much into a buffer. */
+      skel_buf = apr_palloc(pool, skel_len + 1);
+      SVN_ERR(svn_stream_read(stream, skel_buf, &skel_len));
+      skel_buf[skel_len] = '\0';
+
+      /* Read the extra newline that follows the skel. */
+      len = 1;
+      SVN_ERR(svn_stream_read(stream, &c, &len));
+      if (c != '\n')
+        return svn_error_create(SVN_ERR_MALFORMED_FILE, NULL, NULL);
+
+      /* Parse the skel into a lock, and notify the caller. */
+      lock_skel = svn_skel__parse(skel_buf, skel_len, iterpool);
+      SVN_ERR(svn_fs_base__parse_lock_skel(&lock, lock_skel, iterpool));
+      SVN_ERR(get_locks_func(get_locks_baton, lock, iterpool));
+    }
+
+  SVN_ERR(svn_stream_close(stream));
+  svn_pool_destroy(iterpool);
+  return SVN_NO_ERROR;
 }
 
 

Modified: subversion/branches/ignore-mergeinfo-log/subversion/libsvn_ra_svn/cyrus_auth.c
URL: http://svn.apache.org/viewvc/subversion/branches/ignore-mergeinfo-log/subversion/libsvn_ra_svn/cyrus_auth.c?rev=1058221&r1=1058220&r2=1058221&view=diff
==============================================================================
--- subversion/branches/ignore-mergeinfo-log/subversion/libsvn_ra_svn/cyrus_auth.c (original)
+++ subversion/branches/ignore-mergeinfo-log/subversion/libsvn_ra_svn/cyrus_auth.c Wed Jan 12 16:29:32 2011
@@ -54,8 +54,9 @@
  *       in atexit processing, at which point we are already running in
  *       single threaded mode.
  */
-volatile svn_atomic_t svn_ra_svn__sasl_status;
+volatile svn_atomic_t svn_ra_svn__sasl_status = 0;
 
+/* Initialized by svn_ra_svn__sasl_common_init(). */
 static volatile svn_atomic_t sasl_ctx_count;
 
 static apr_pool_t *sasl_pool = NULL;

Propchange: subversion/branches/ignore-mergeinfo-log/subversion/libsvn_subr/adler32.c
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Wed Jan 12 16:29:32 2011
@@ -0,0 +1 @@
+/subversion/trunk/subversion/libsvn_subr/adler32.c:1054732-1058220

Modified: subversion/branches/ignore-mergeinfo-log/subversion/libsvn_subr/dirent_uri.c
URL: http://svn.apache.org/viewvc/subversion/branches/ignore-mergeinfo-log/subversion/libsvn_subr/dirent_uri.c?rev=1058221&r1=1058220&r2=1058221&view=diff
==============================================================================
--- subversion/branches/ignore-mergeinfo-log/subversion/libsvn_subr/dirent_uri.c (original)
+++ subversion/branches/ignore-mergeinfo-log/subversion/libsvn_subr/dirent_uri.c Wed Jan 12 16:29:32 2011
@@ -1819,6 +1819,7 @@ svn_uri_is_canonical(const char *uri, ap
    *  - no '//'
    *  - lowercase URL scheme
    *  - lowercase URL hostname
+   *  - uppercase hex-encoded pair digits ("%AB", not "%ab")
    */
 
   if (*uri == '\0')

Modified: subversion/branches/ignore-mergeinfo-log/subversion/libsvn_subr/io.c
URL: http://svn.apache.org/viewvc/subversion/branches/ignore-mergeinfo-log/subversion/libsvn_subr/io.c?rev=1058221&r1=1058220&r2=1058221&view=diff
==============================================================================
--- subversion/branches/ignore-mergeinfo-log/subversion/libsvn_subr/io.c (original)
+++ subversion/branches/ignore-mergeinfo-log/subversion/libsvn_subr/io.c Wed Jan 12 16:29:32 2011
@@ -637,7 +637,7 @@ svn_io_copy_link(const char *src,
 }
 
 /* Temporary directory name cache for svn_io_temp_dir() */
-static volatile svn_atomic_t temp_dir_init_state;
+static volatile svn_atomic_t temp_dir_init_state = 0;
 static const char *temp_dir;
 
 /* Helper function to initialize temp dir. Passed to svn_atomic__init_once */
@@ -1067,14 +1067,15 @@ svn_error_t *svn_io_file_create(const ch
 {
   apr_file_t *f;
   apr_size_t written;
-  svn_error_t *err;
+  svn_error_t *err = SVN_NO_ERROR;
 
   SVN_ERR(svn_io_file_open(&f, file,
                            (APR_WRITE | APR_CREATE | APR_EXCL),
                            APR_OS_DEFAULT,
                            pool));
-  err= svn_io_file_write_full(f, contents, strlen(contents),
-                              &written, pool);
+  if (contents && *contents)
+    err = svn_io_file_write_full(f, contents, strlen(contents),
+                                 &written, pool);
 
 
   return svn_error_return(

Modified: subversion/branches/ignore-mergeinfo-log/subversion/libsvn_subr/sqlite.c
URL: http://svn.apache.org/viewvc/subversion/branches/ignore-mergeinfo-log/subversion/libsvn_subr/sqlite.c?rev=1058221&r1=1058220&r2=1058221&view=diff
==============================================================================
--- subversion/branches/ignore-mergeinfo-log/subversion/libsvn_subr/sqlite.c (original)
+++ subversion/branches/ignore-mergeinfo-log/subversion/libsvn_subr/sqlite.c Wed Jan 12 16:29:32 2011
@@ -694,7 +694,7 @@ check_format(svn_sqlite__db_t *db,
                            current_schema);
 }
 
-static volatile svn_atomic_t sqlite_init_state;
+static volatile svn_atomic_t sqlite_init_state = 0;
 
 /* If possible, verify that SQLite was compiled in a thread-safe
    manner. */

Modified: subversion/branches/ignore-mergeinfo-log/subversion/libsvn_subr/stream.c
URL: http://svn.apache.org/viewvc/subversion/branches/ignore-mergeinfo-log/subversion/libsvn_subr/stream.c?rev=1058221&r1=1058220&r2=1058221&view=diff
==============================================================================
--- subversion/branches/ignore-mergeinfo-log/subversion/libsvn_subr/stream.c (original)
+++ subversion/branches/ignore-mergeinfo-log/subversion/libsvn_subr/stream.c Wed Jan 12 16:29:32 2011
@@ -555,11 +555,6 @@ svn_stream_disown(svn_stream_t *stream, 
 struct baton_apr {
   apr_file_t *file;
   apr_pool_t *pool;
-
-  /* Offsets when reading from a range of the file.
-   * When either of these is negative, no range has been specified. */
-  apr_off_t start;
-  apr_off_t end;
 };
 
 /* svn_stream_mark_t for streams backed by APR files. */
@@ -626,12 +621,7 @@ seek_handler_apr(void *baton, svn_stream
     }
   else
     {
-      apr_off_t offset;
-
-      /* If we're reading from a range, reset to the start of the range.
-       * Otherwise, reset to the start of the file. */
-      offset = btn->start >= 0 ? btn->start : 0;
-
+      apr_off_t offset = 0;
       SVN_ERR(svn_io_file_seek(btn->file, APR_SET, &offset, btn->pool));
     }
 
@@ -707,8 +697,6 @@ svn_stream_from_aprfile2(apr_file_t *fil
   baton = apr_palloc(pool, sizeof(*baton));
   baton->file = file;
   baton->pool = pool;
-  baton->start = -1;
-  baton->end = -1;
   stream = svn_stream_create(baton, pool);
   svn_stream_set_read(stream, read_handler_apr);
   svn_stream_set_write(stream, write_handler_apr);
@@ -721,83 +709,6 @@ svn_stream_from_aprfile2(apr_file_t *fil
   return stream;
 }
 
-/* A read handler (#svn_read_fn_t) that forwards to read_handler_apr()
-   but only allows reading between BATON->start and BATON->end. */
-static svn_error_t *
-read_range_handler_apr(void *baton, char *buffer, apr_size_t *len)
-{
-  struct baton_apr *btn = baton;
-
-  /* ### BH: I think this can be simplified/optimized by just keeping
-             track of the current position. */
-
-  /* Check for range restriction. */
-  if (btn->start >= 0 && btn->end > 0)
-    {
-      /* Get the current file position and make sure it is in range. */
-      apr_off_t pos;
-
-      pos = 0;
-      SVN_ERR(svn_io_file_seek(btn->file, APR_CUR, &pos, btn->pool));
-      if (pos < btn->start)
-        {
-          /* We're before the range, so forward the file cursor to
-           * the start of the range. */
-          pos = btn->start;
-          SVN_ERR(svn_io_file_seek(btn->file, APR_SET, &pos, btn->pool));
-        }
-      else if (pos >= btn->end)
-        {
-          /* We're past the range, indicate that no bytes can be read. */
-          *len = 0;
-          return SVN_NO_ERROR;
-        }
-
-      /* We're in range, but don't read over the end of the range. */
-      if (pos + *len > btn->end)
-        *len = (apr_size_t)(btn->end - pos);
-    }
-
-  return read_handler_apr(baton, buffer, len);
-}
-
-
-svn_stream_t *
-svn_stream_from_aprfile_range_readonly(apr_file_t *file,
-                                       svn_boolean_t disown,
-                                       apr_off_t start,
-                                       apr_off_t end,
-                                       apr_pool_t *pool)
-{
-  struct baton_apr *baton;
-  svn_stream_t *stream;
-  apr_off_t pos;
-
-  /* ### HACK: These shortcuts don't handle disown FALSE properly */
-  if (file == NULL || start < 0 || end <= 0 || start >= end)
-    return svn_stream_empty(pool);
-
-  /* Set the file pointer to the start of the range. */
-  pos = start;
-  if (apr_file_seek(file, APR_SET, &pos) != APR_SUCCESS)
-    return svn_stream_empty(pool);
-
-  baton = apr_palloc(pool, sizeof(*baton));
-  baton->file = file;
-  baton->pool = pool;
-  baton->start = start;
-  baton->end = end;
-  stream = svn_stream_create(baton, pool);
-  svn_stream_set_read(stream, read_range_handler_apr);
-  svn_stream_set_mark(stream, mark_handler_apr);
-  svn_stream_set_seek(stream, seek_handler_apr);
-
-  if (! disown)
-    svn_stream_set_close(stream, close_handler_apr);
-
-  return stream;
-}
-
 
 /* Compressed stream support */
 

Modified: subversion/branches/ignore-mergeinfo-log/subversion/libsvn_wc/update_editor.c
URL: http://svn.apache.org/viewvc/subversion/branches/ignore-mergeinfo-log/subversion/libsvn_wc/update_editor.c?rev=1058221&r1=1058220&r2=1058221&view=diff
==============================================================================
--- subversion/branches/ignore-mergeinfo-log/subversion/libsvn_wc/update_editor.c (original)
+++ subversion/branches/ignore-mergeinfo-log/subversion/libsvn_wc/update_editor.c Wed Jan 12 16:29:32 2011
@@ -275,9 +275,6 @@ struct dir_baton
   /* Set if updates to this directory are skipped */
   svn_boolean_t skip_this;
 
-  /* Set if updates to all descendants of this directory are skipped */
-  svn_boolean_t skip_descendants;
-
   /* Set if there was a previous notification for this directory */
   svn_boolean_t already_notified;
 
@@ -1212,7 +1209,6 @@ open_root(void *edit_baton,
   if (already_conflicted)
     {
       db->skip_this = TRUE;
-      db->skip_descendants = TRUE;
       db->already_notified = TRUE;
       db->bump_info->skipped = TRUE;
 
@@ -2082,13 +2078,8 @@ delete_entry(const char *path,
 
   local_abspath = svn_dirent_join(pb->local_abspath, base, pool);
 
-  if (pb->skip_descendants)
-    {
-      if (!pb->skip_this)
-        SVN_ERR(remember_skipped_tree(pb->edit_baton, local_abspath));
-
-      return SVN_NO_ERROR;
-    }
+  if (pb->skip_this)
+    return SVN_NO_ERROR;
 
   SVN_ERR(check_path_under_root(pb->local_abspath, base, pool));
 
@@ -2126,13 +2117,9 @@ add_directory(const char *path,
   SVN_ERR(make_dir_baton(&db, path, eb, pb, TRUE, pool));
   *child_baton = db;
 
-  if (pb->skip_descendants)
+  if (pb->skip_this)
     {
-      if (!pb->skip_this)
-        SVN_ERR(remember_skipped_tree(eb, db->local_abspath));
-
       db->skip_this = TRUE;
-      db->skip_descendants = TRUE;
       db->already_notified = TRUE;
 
       return SVN_NO_ERROR;
@@ -2229,7 +2216,6 @@ add_directory(const char *path,
       SVN_ERR(remember_skipped_tree(eb, db->local_abspath));
 
       db->skip_this = TRUE;
-      db->skip_descendants = TRUE;
       db->already_notified = TRUE;
 
       /* ### TODO: Also print victim_path in the skip msg. */
@@ -2414,7 +2400,6 @@ add_directory(const char *path,
       SVN_ERR(remember_skipped_tree(eb, db->local_abspath));
 
       db->skip_this = TRUE;
-      db->skip_descendants = TRUE;
       db->already_notified = TRUE;
 
       do_notification(eb, db->local_abspath, svn_node_unknown,
@@ -2484,13 +2469,9 @@ open_directory(const char *path,
   /* We should have a write lock on every directory touched.  */
   SVN_ERR(svn_wc__write_check(eb->db, db->local_abspath, pool));
 
-  if (pb->skip_descendants)
+  if (pb->skip_this)
     {
-      if (!pb->skip_this)
-        SVN_ERR(remember_skipped_tree(eb, db->local_abspath));
-
       db->skip_this = TRUE;
-      db->skip_descendants = TRUE;
       db->already_notified = TRUE;
 
       db->bump_info->skipped = TRUE;
@@ -2527,7 +2508,6 @@ open_directory(const char *path,
       SVN_ERR(remember_skipped_tree(eb, db->local_abspath));
 
       db->skip_this = TRUE;
-      db->skip_descendants = TRUE;
       db->already_notified = TRUE;
 
       do_notification(eb, db->local_abspath, svn_node_unknown,
@@ -2564,7 +2544,6 @@ open_directory(const char *path,
           tree_conflict->reason != svn_wc_conflict_reason_replaced)
         {
           SVN_ERR(remember_skipped_tree(eb, db->local_abspath));
-          db->skip_descendants = TRUE;
           db->skip_this = TRUE;
 
           return SVN_NO_ERROR;
@@ -3033,14 +3012,10 @@ add_file(const char *path,
   SVN_ERR(make_file_baton(&fb, pb, path, TRUE, pool));
   *file_baton = fb;
 
-  if (pb->skip_descendants)
+  if (pb->skip_this)
     {
-      if (!pb->skip_this)
-        SVN_ERR(remember_skipped_tree(eb, fb->local_abspath));
-
       fb->skip_this = TRUE;
       fb->already_notified = TRUE;
-
       return SVN_NO_ERROR;
     }
 
@@ -3320,14 +3295,10 @@ open_file(const char *path,
   SVN_ERR(make_file_baton(&fb, pb, path, FALSE, pool));
   *file_baton = fb;
 
-  if (pb->skip_descendants)
+  if (pb->skip_this)
     {
-      if (!pb->skip_this)
-        SVN_ERR(remember_skipped_tree(eb, fb->local_abspath));
-
       fb->skip_this = TRUE;
       fb->already_notified = TRUE;
-
       return SVN_NO_ERROR;
     }
 

Modified: subversion/branches/ignore-mergeinfo-log/subversion/libsvn_wc/wc-metadata.sql
URL: http://svn.apache.org/viewvc/subversion/branches/ignore-mergeinfo-log/subversion/libsvn_wc/wc-metadata.sql?rev=1058221&r1=1058220&r2=1058221&view=diff
==============================================================================
--- subversion/branches/ignore-mergeinfo-log/subversion/libsvn_wc/wc-metadata.sql (original)
+++ subversion/branches/ignore-mergeinfo-log/subversion/libsvn_wc/wc-metadata.sql Wed Jan 12 16:29:32 2011
@@ -492,9 +492,9 @@ INSERT INTO NODES (
        changed_revision, changed_date, changed_author,
        checksum, properties, translated_size, last_mod_time,
        dav_cache, symlink_target, file_external )
-SELECT wc_id, local_relpath, 0 AS op_depth, parent_relpath,
+SELECT wc_id, local_relpath, 0 /*op_depth*/, parent_relpath,
        repos_id, repos_relpath, revnum,
-       presence, depth, NULL AS moved_here, NULL AS moved_to, kind,
+       presence, depth, NULL /*moved_here*/, NULL /*moved_to*/, kind,
        changed_rev, changed_date, changed_author,
        checksum, properties, translated_size, last_mod_time,
        dav_cache, symlink_target, file_external
@@ -506,12 +506,12 @@ INSERT INTO NODES (
        changed_revision, changed_date, changed_author,
        checksum, properties, translated_size, last_mod_time,
        dav_cache, symlink_target, file_external )
-SELECT wc_id, local_relpath, 2 AS op_depth, parent_relpath,
+SELECT wc_id, local_relpath, 2 /*op_depth*/, parent_relpath,
        copyfrom_repos_id, copyfrom_repos_path, copyfrom_revnum,
-       presence, depth, NULL AS moved_here, NULL AS moved_to, kind,
+       presence, depth, NULL /*moved_here*/, NULL /*moved_to*/, kind,
        changed_rev, changed_date, changed_author,
        checksum, properties, translated_size, last_mod_time,
-       NULL AS dav_cache, symlink_target, NULL AS file_external
+       NULL /*dav_cache*/, symlink_target, NULL /*file_external*/
 FROM WORKING_NODE;
 
 DROP TABLE BASE_NODE;

Modified: subversion/branches/ignore-mergeinfo-log/subversion/libsvn_wc/wc-queries.sql
URL: http://svn.apache.org/viewvc/subversion/branches/ignore-mergeinfo-log/subversion/libsvn_wc/wc-queries.sql?rev=1058221&r1=1058220&r2=1058221&view=diff
==============================================================================
--- subversion/branches/ignore-mergeinfo-log/subversion/libsvn_wc/wc-queries.sql (original)
+++ subversion/branches/ignore-mergeinfo-log/subversion/libsvn_wc/wc-queries.sql Wed Jan 12 16:29:32 2011
@@ -426,11 +426,6 @@ WHERE md5_checksum = ?1
 -- STMT_SELECT_ANY_PRISTINE_REFERENCE
 SELECT 1 FROM nodes
   WHERE checksum = ?1 OR checksum = ?2
-UNION ALL
-SELECT 1 FROM actual_node
-  WHERE older_checksum = ?1 OR older_checksum = ?2
-    OR  left_checksum  = ?1 OR left_checksum  = ?2
-    OR  right_checksum = ?1 OR right_checksum = ?2
 LIMIT 1
 
 -- STMT_SELECT_UNREFERENCED_PRISTINES
@@ -439,15 +434,6 @@ FROM pristine
 EXCEPT
 SELECT checksum FROM nodes
   WHERE checksum IS NOT NULL
-EXCEPT
-SELECT older_checksum FROM actual_node
-  WHERE older_checksum IS NOT NULL
-EXCEPT
-SELECT left_checksum FROM actual_node
-  WHERE left_checksum  IS NOT NULL
-EXCEPT
-SELECT right_checksum FROM actual_node
-  WHERE right_checksum IS NOT NULL
 
 -- STMT_DELETE_PRISTINE
 DELETE FROM pristine
@@ -516,7 +502,7 @@ INSERT OR REPLACE INTO nodes (
     wc_id, local_relpath, op_depth, parent_relpath, presence, kind, checksum,
     changed_revision, changed_date, changed_author, depth, symlink_target,
     translated_size, last_mod_time, properties)
-SELECT wc_id, local_relpath, ?3 AS op_depth, parent_relpath, ?4 AS presence,
+SELECT wc_id, local_relpath, ?3 /*op_depth*/, parent_relpath, ?4 /*presence*/,
        kind, checksum, changed_revision, changed_date, changed_author, depth,
        symlink_target, translated_size, last_mod_time, properties
 FROM nodes
@@ -527,7 +513,7 @@ INSERT OR REPLACE INTO nodes (
     wc_id, local_relpath, op_depth, parent_relpath, presence, kind, checksum,
     changed_revision, changed_date, changed_author, depth, symlink_target,
     translated_size, last_mod_time, properties)
-SELECT wc_id, local_relpath, ?3 AS op_depth, parent_relpath, ?4 AS presence,
+SELECT wc_id, local_relpath, ?3 /*op_depth*/, parent_relpath, ?4 /*presence*/,
        kind, checksum, changed_revision, changed_date, changed_author, depth,
        symlink_target, translated_size, last_mod_time, properties
 FROM nodes
@@ -541,7 +527,7 @@ INSERT INTO nodes (
     revision, presence, depth, kind, changed_revision, changed_date,
     changed_author, checksum, properties, translated_size, last_mod_time,
     symlink_target )
-SELECT wc_id, local_relpath, ?3 AS op_depth, parent_relpath, repos_id,
+SELECT wc_id, local_relpath, ?3 /*op_depth*/, parent_relpath, repos_id,
     repos_path, revision, presence, depth, kind, changed_revision,
     changed_date, changed_author, checksum, properties, translated_size,
     last_mod_time, symlink_target
@@ -554,8 +540,8 @@ INSERT INTO nodes (
     revision, presence, depth, kind, changed_revision, changed_date,
     changed_author, checksum, properties, translated_size, last_mod_time,
     symlink_target )
-SELECT wc_id, local_relpath, ?3 AS op_depth, parent_relpath, repos_id,
-    repos_path, revision, ?4 AS presence, depth, kind, changed_revision,
+SELECT wc_id, local_relpath, ?3 /*op_depth*/, parent_relpath, repos_id,
+    repos_path, revision, ?4 /*presence*/, depth, kind, changed_revision,
     changed_date, changed_author, checksum, properties, translated_size,
     last_mod_time, symlink_target
 FROM nodes
@@ -607,8 +593,8 @@ INSERT OR REPLACE INTO nodes (
     repos_path, revision, presence, depth, kind, changed_revision,
     changed_date, changed_author, checksum, properties, translated_size,
     last_mod_time, symlink_target )
-SELECT wc_id, ?3 AS local_relpath, ?4 AS op_depth, ?5 AS parent_relpath,
-    ?6 AS repos_id, ?7 AS repos_path, ?8 AS revision, ?9 AS presence, depth,
+SELECT wc_id, ?3 /*local_relpath*/, ?4 /*op_depth*/, ?5 /*parent_relpath*/,
+    ?6 /*repos_id*/, ?7 /*repos_path*/, ?8 /*revision*/, ?9 /*presence*/, depth,
     kind, changed_revision, changed_date, changed_author, checksum, properties,
     translated_size, last_mod_time, symlink_target
 FROM nodes
@@ -620,8 +606,8 @@ INSERT OR REPLACE INTO nodes (
     revision, presence, depth, kind, changed_revision, changed_date,
     changed_author, checksum, properties, translated_size, last_mod_time,
     symlink_target )
-SELECT wc_id, ?3 AS local_relpath, ?4 AS op_depth, ?5 AS parent_relpath,
-    ?6 AS repos_id, ?7 AS repos_path, ?8 AS revision, ?9 AS presence, depth,
+SELECT wc_id, ?3 /*local_relpath*/, ?4 /*op_depth*/, ?5 /*parent_relpath*/,
+    ?6 /*repos_id*/, ?7 /*repos_path*/, ?8 /*revision*/, ?9 /*presence*/, depth,
     kind, changed_revision, changed_date, changed_author, checksum, properties,
     translated_size, last_mod_time, symlink_target
 FROM nodes
@@ -634,7 +620,7 @@ INSERT OR REPLACE INTO actual_node (
      wc_id, local_relpath, parent_relpath, properties,
      conflict_old, conflict_new, conflict_working,
      prop_reject, changelist, text_mod, tree_conflict_data )
-SELECT wc_id, ?3 AS local_relpath, ?4 AS parent_relpath, properties,
+SELECT wc_id, ?3 /*local_relpath*/, ?4 /*parent_relpath*/, properties,
      conflict_old, conflict_new, conflict_working,
      prop_reject, changelist, text_mod, tree_conflict_data
 FROM actual_node

Modified: subversion/branches/ignore-mergeinfo-log/subversion/libsvn_wc/wc_db.c
URL: http://svn.apache.org/viewvc/subversion/branches/ignore-mergeinfo-log/subversion/libsvn_wc/wc_db.c?rev=1058221&r1=1058220&r2=1058221&view=diff
==============================================================================
--- subversion/branches/ignore-mergeinfo-log/subversion/libsvn_wc/wc_db.c (original)
+++ subversion/branches/ignore-mergeinfo-log/subversion/libsvn_wc/wc_db.c Wed Jan 12 16:29:32 2011
@@ -856,11 +856,12 @@ insert_base_node(void *baton, svn_sqlite
                             (pibb->kind == svn_wc__db_kind_symlink) ?
                                 pibb->target : NULL)); /* 19 */
 
-  if (pibb->kind == svn_wc__db_kind_file) {
-    SVN_ERR(svn_sqlite__bind_checksum(stmt, 14, pibb->checksum, scratch_pool));
-    if (pibb->translated_size != SVN_INVALID_FILESIZE)
-      SVN_ERR(svn_sqlite__bind_int64(stmt, 16, pibb->translated_size));
-  }
+  if (pibb->kind == svn_wc__db_kind_file)
+    {
+      SVN_ERR(svn_sqlite__bind_checksum(stmt, 14, pibb->checksum, scratch_pool));
+      if (pibb->translated_size != SVN_INVALID_FILESIZE)
+        SVN_ERR(svn_sqlite__bind_int64(stmt, 16, pibb->translated_size));
+    }
 
   SVN_ERR(svn_sqlite__bind_properties(stmt, 15, pibb->props,
                                       scratch_pool));
@@ -2489,10 +2490,10 @@ svn_wc__db_pristine_get_sha1(const svn_c
 }
 
 
-/* Delete the pristine text referenced by SHA1_CHECKSUM in the database
- * referenced by PDH. */
+/* Delete the pristine text referenced by SHA1_CHECKSUM from the pristine
+ * store of WCROOT.  Delete both the database row and the file on disk. */
 static svn_error_t *
-pristine_remove(svn_wc__db_pdh_t *pdh,
+pristine_remove(svn_wc__db_wcroot_t *wcroot,
                 const svn_checksum_t *sha1_checksum,
                 apr_pool_t *scratch_pool)
 {
@@ -2500,13 +2501,13 @@ pristine_remove(svn_wc__db_pdh_t *pdh,
   const char *pristine_abspath;
 
   /* Remove the DB row. */
-  SVN_ERR(svn_sqlite__get_statement(&stmt, pdh->wcroot->sdb,
+  SVN_ERR(svn_sqlite__get_statement(&stmt, wcroot->sdb,
                                     STMT_DELETE_PRISTINE));
   SVN_ERR(svn_sqlite__bind_checksum(stmt, 1, sha1_checksum, scratch_pool));
   SVN_ERR(svn_sqlite__update(NULL, stmt));
 
   /* Remove the file */
-  SVN_ERR(get_pristine_fname(&pristine_abspath, pdh->wcroot->abspath,
+  SVN_ERR(get_pristine_fname(&pristine_abspath, wcroot->abspath,
                              sha1_checksum, TRUE /* create_subdir */,
                              scratch_pool, scratch_pool));
   SVN_ERR(svn_io_remove_file2(pristine_abspath, TRUE /* ignore_enoent */,
@@ -2577,31 +2578,21 @@ svn_wc__db_pristine_remove(svn_wc__db_t 
   /* If not referenced, remove the PRISTINE table row and the file. */
   if (! is_referenced)
     {
-      SVN_ERR(pristine_remove(pdh, sha1_checksum, scratch_pool));
+      SVN_ERR(pristine_remove(pdh->wcroot, sha1_checksum, scratch_pool));
     }
 
   return SVN_NO_ERROR;
 }
 
 
-svn_error_t *
-svn_wc__db_pristine_cleanup(svn_wc__db_t *db,
-                            const char *wri_abspath,
-                            apr_pool_t *scratch_pool)
+static svn_error_t *
+pristine_cleanup_wcroot(svn_wc__db_wcroot_t *wcroot,
+                        apr_pool_t *scratch_pool)
 {
-  svn_wc__db_pdh_t *pdh;
-  const char *local_relpath;
   svn_sqlite__stmt_t *stmt;
 
-  SVN_ERR_ASSERT(svn_dirent_is_absolute(wri_abspath));
-
-  SVN_ERR(svn_wc__db_pdh_parse_local_abspath(&pdh, &local_relpath, db,
-                              wri_abspath, svn_sqlite__mode_readonly,
-                              scratch_pool, scratch_pool));
-  VERIFY_USABLE_PDH(pdh);
-
   /* Find each unreferenced pristine in the DB and remove it. */
-  SVN_ERR(svn_sqlite__get_statement(&stmt, pdh->wcroot->sdb,
+  SVN_ERR(svn_sqlite__get_statement(&stmt, wcroot->sdb,
                                     STMT_SELECT_UNREFERENCED_PRISTINES));
   while (1)
     {
@@ -2614,7 +2605,7 @@ svn_wc__db_pristine_cleanup(svn_wc__db_t
 
       SVN_ERR(svn_sqlite__column_checksum(&sha1_checksum, stmt, 0,
                                           scratch_pool));
-      SVN_ERR(pristine_remove(pdh, sha1_checksum, scratch_pool));
+      SVN_ERR(pristine_remove(wcroot, sha1_checksum, scratch_pool));
     }
   SVN_ERR(svn_sqlite__reset(stmt));
 
@@ -2623,6 +2614,27 @@ svn_wc__db_pristine_cleanup(svn_wc__db_t
 
 
 svn_error_t *
+svn_wc__db_pristine_cleanup(svn_wc__db_t *db,
+                            const char *wri_abspath,
+                            apr_pool_t *scratch_pool)
+{
+  svn_wc__db_pdh_t *pdh;
+  const char *local_relpath;
+
+  SVN_ERR_ASSERT(svn_dirent_is_absolute(wri_abspath));
+
+  SVN_ERR(svn_wc__db_pdh_parse_local_abspath(&pdh, &local_relpath, db,
+                              wri_abspath, svn_sqlite__mode_readonly,
+                              scratch_pool, scratch_pool));
+  VERIFY_USABLE_PDH(pdh);
+
+  SVN_ERR(pristine_cleanup_wcroot(pdh->wcroot, scratch_pool));
+
+  return SVN_NO_ERROR;
+}
+
+
+svn_error_t *
 svn_wc__db_pristine_check(svn_boolean_t *present,
                           svn_wc__db_t *db,
                           const char *wri_abspath,
@@ -4051,17 +4063,18 @@ svn_wc__db_op_revert_actual(svn_wc__db_t
   SVN_ERR(svn_sqlite__bindf(stmt, "is", pdh->wcroot->wc_id, local_relpath));
   SVN_ERR(svn_sqlite__update(&affected_rows, stmt));
 
-  if (affected_rows == 0) {
-    /* Failed to delete the row.
-       Presumably because there was a changelist set on it */
+  if (affected_rows == 0)
+    {
+      /* Failed to delete the row.
+         Presumably because there was a changelist set on it */
 
-    SVN_ERR(svn_sqlite__get_statement(&stmt, pdh->wcroot->sdb,
-                               STMT_CLEAR_ACTUAL_NODE_LEAVING_CHANGELIST));
-    SVN_ERR(svn_sqlite__bindf(stmt, "is", pdh->wcroot->wc_id, local_relpath));
-    SVN_ERR(svn_sqlite__step_done(stmt));
-    /* We're not interested here if there was an affected row or not:
-       If there isn't by now, then there simply was no row to begin with */
-  }
+      SVN_ERR(svn_sqlite__get_statement(&stmt, pdh->wcroot->sdb,
+                                 STMT_CLEAR_ACTUAL_NODE_LEAVING_CHANGELIST));
+      SVN_ERR(svn_sqlite__bindf(stmt, "is", pdh->wcroot->wc_id, local_relpath));
+      SVN_ERR(svn_sqlite__step_done(stmt));
+      /* We're not interested here if there was an affected row or not:
+         If there isn't by now, then there simply was no row to begin with */
+    }
 
   /* Some entries have cached the above values. Kapow!!  */
   SVN_ERR(flush_entries(db, pdh, local_abspath, scratch_pool));

Modified: subversion/branches/ignore-mergeinfo-log/subversion/svn/info-cmd.c
URL: http://svn.apache.org/viewvc/subversion/branches/ignore-mergeinfo-log/subversion/svn/info-cmd.c?rev=1058221&r1=1058220&r2=1058221&view=diff
==============================================================================
--- subversion/branches/ignore-mergeinfo-log/subversion/svn/info-cmd.c (original)
+++ subversion/branches/ignore-mergeinfo-log/subversion/svn/info-cmd.c Wed Jan 12 16:29:32 2011
@@ -566,24 +566,11 @@ svn_cl__info(apr_getopt_t *os,
         {
           /* If one of the targets is a non-existent URL or wc-entry,
              don't bail out.  Just warn and move on to the next target. */
-          if (err->apr_err == SVN_ERR_UNVERSIONED_RESOURCE
-              || err->apr_err == SVN_ERR_ENTRY_NOT_FOUND)
+          if (err->apr_err == SVN_ERR_WC_PATH_NOT_FOUND ||
+              err->apr_err == SVN_ERR_RA_ILLEGAL_URL)
             {
-              SVN_ERR(svn_cmdline_fprintf
-                      (stderr, subpool,
-                       _("%s:  (Not a versioned resource)\n\n"),
-                       svn_path_is_url(truepath)
-                         ? truepath
-                         : svn_dirent_local_style(truepath, pool)));
-            }
-          else if (err->apr_err == SVN_ERR_RA_ILLEGAL_URL)
-            {
-              SVN_ERR(svn_cmdline_fprintf
-                      (stderr, subpool,
-                       _("%s:  (Not a valid URL)\n\n"),
-                       svn_path_is_url(truepath)
-                         ? truepath
-                         : svn_dirent_local_style(truepath, pool)));
+              svn_handle_warning2(stderr, err, "svn: ");
+              svn_error_clear(svn_cmdline_fprintf(stderr, subpool, "\n"));
             }
           else
             {

Modified: subversion/branches/ignore-mergeinfo-log/subversion/svn/main.c
URL: http://svn.apache.org/viewvc/subversion/branches/ignore-mergeinfo-log/subversion/svn/main.c?rev=1058221&r1=1058220&r2=1058221&view=diff
==============================================================================
--- subversion/branches/ignore-mergeinfo-log/subversion/svn/main.c (original)
+++ subversion/branches/ignore-mergeinfo-log/subversion/svn/main.c Wed Jan 12 16:29:32 2011
@@ -1191,7 +1191,7 @@ const svn_opt_subcommand_desc2_t svn_cl_
   { "upgrade", svn_cl__upgrade, {0}, N_
     ("Upgrade the metadata storage format for a working copy.\n"
      "usage: upgrade WCPATH...\n"),
-    {0} },
+    { 'q' } },
 
   { NULL, NULL, {0}, NULL, {0} }
 };

Modified: subversion/branches/ignore-mergeinfo-log/subversion/svn/propset-cmd.c
URL: http://svn.apache.org/viewvc/subversion/branches/ignore-mergeinfo-log/subversion/svn/propset-cmd.c?rev=1058221&r1=1058220&r2=1058221&view=diff
==============================================================================
--- subversion/branches/ignore-mergeinfo-log/subversion/svn/propset-cmd.c (original)
+++ subversion/branches/ignore-mergeinfo-log/subversion/svn/propset-cmd.c Wed Jan 12 16:29:32 2011
@@ -85,8 +85,9 @@ svn_cl__propset(apr_getopt_t *os,
   /* We only want special Subversion property values to be in UTF-8
      and LF line endings.  All other propvals are taken literally. */
   if (svn_prop_needs_translation(pname_utf8))
-    SVN_ERR(svn_subst_translate_string(&propval, propval,
-                                       opt_state->encoding, scratch_pool));
+    SVN_ERR(svn_subst_translate_string2(&propval, NULL, NULL, propval,
+                                        opt_state->encoding, scratch_pool,
+                                        scratch_pool));
   else if (opt_state->encoding)
     return svn_error_create
       (SVN_ERR_UNSUPPORTED_FEATURE, NULL,

Modified: subversion/branches/ignore-mergeinfo-log/subversion/svnadmin/main.c
URL: http://svn.apache.org/viewvc/subversion/branches/ignore-mergeinfo-log/subversion/svnadmin/main.c?rev=1058221&r1=1058220&r2=1058221&view=diff
==============================================================================
--- subversion/branches/ignore-mergeinfo-log/subversion/svnadmin/main.c (original)
+++ subversion/branches/ignore-mergeinfo-log/subversion/svnadmin/main.c Wed Jan 12 16:29:32 2011
@@ -926,7 +926,8 @@ subcommand_help(apr_getopt_t *os, void *
 
   SVN_ERR(svn_opt_print_help3(os, "svnadmin",
                               opt_state ? opt_state->version : FALSE,
-                              FALSE, version_footer->data,
+                              opt_state ? opt_state->quiet : FALSE,
+                              version_footer->data,
                               header, cmd_table, options_table, NULL, NULL,
                               pool));
 
@@ -1766,6 +1767,7 @@ main(int argc, const char *argv[])
               static const svn_opt_subcommand_desc2_t pseudo_cmd =
                 { "--version", subcommand_help, {0}, "",
                   {svnadmin__version,  /* must accept its own option */
+                   'q',  /* --quiet */
                   } };
 
               subcommand = &pseudo_cmd;

Modified: subversion/branches/ignore-mergeinfo-log/subversion/svndumpfilter/main.c
URL: http://svn.apache.org/viewvc/subversion/branches/ignore-mergeinfo-log/subversion/svndumpfilter/main.c?rev=1058221&r1=1058220&r2=1058221&view=diff
==============================================================================
--- subversion/branches/ignore-mergeinfo-log/subversion/svndumpfilter/main.c (original)
+++ subversion/branches/ignore-mergeinfo-log/subversion/svndumpfilter/main.c Wed Jan 12 16:29:32 2011
@@ -1054,7 +1054,7 @@ subcommand_help(apr_getopt_t *os, void *
 
   SVN_ERR(svn_opt_print_help3(os, "svndumpfilter",
                               opt_state ? opt_state->version : FALSE,
-                              FALSE, NULL,
+                              opt_state ? opt_state->quiet : FALSE, NULL,
                               header, cmd_table, options_table, NULL,
                               NULL, pool));
 
@@ -1336,6 +1336,7 @@ main(int argc, const char *argv[])
           break;
         case svndumpfilter__version:
           opt_state.version = TRUE;
+          break;
         case svndumpfilter__quiet:
           opt_state.quiet = TRUE;
           break;
@@ -1385,6 +1386,7 @@ main(int argc, const char *argv[])
               static const svn_opt_subcommand_desc2_t pseudo_cmd =
                 { "--version", subcommand_help, {0}, "",
                   {svndumpfilter__version,  /* must accept its own option */
+                   svndumpfilter__quiet,
                   } };
 
               subcommand = &pseudo_cmd;

Modified: subversion/branches/ignore-mergeinfo-log/subversion/svnlook/main.c
URL: http://svn.apache.org/viewvc/subversion/branches/ignore-mergeinfo-log/subversion/svnlook/main.c?rev=1058221&r1=1058220&r2=1058221&view=diff
==============================================================================
--- subversion/branches/ignore-mergeinfo-log/subversion/svnlook/main.c (original)
+++ subversion/branches/ignore-mergeinfo-log/subversion/svnlook/main.c Wed Jan 12 16:29:32 2011
@@ -147,34 +147,37 @@ static const apr_getopt_option_t options
   {"xml",               svnlook__xml_opt, 0,
    N_("output in XML")},
 
-  {"extensions",    'x', 1,
-                    N_("Default: '-u'. When Subversion is invoking an\n"
-                       "                            "
-                       " external diff program, ARG is simply passed along\n"
-                       "                            "
-                       " to the program. But when Subversion is using its\n"
-                       "                            "
-                       " default internal diff implementation, or when\n"
-                       "                            "
-                       " Subversion is displaying blame annotations, ARG\n"
-                       "                            "
-                       " could be any of the following:\n"
-                       "                            "
-                       "    -u (--unified):\n"
-                       "                            "
-                       "       Output 3 lines of unified context.\n"
-                       "                            "
-                       "    -b (--ignore-space-change):\n"
-                       "                            "
-                       "       Ignore changes in the amount of white space.\n"
-                       "                            "
-                       "    -w (--ignore-all-space):\n"
-                       "                            "
-                       "       Ignore all white space.\n"
-                       "                            "
-                       "    --ignore-eol-style:\n"
-                       "                            "
-                       "       Ignore changes in EOL style")},
+  {"extensions",        'x', 1,
+   N_("Default: '-u'. When Subversion is invoking an\n"
+      "                            "
+      " external diff program, ARG is simply passed along\n"
+      "                            "
+      " to the program. But when Subversion is using its\n"
+      "                            "
+      " default internal diff implementation, or when\n"
+      "                            "
+      " Subversion is displaying blame annotations, ARG\n"
+      "                            "
+      " could be any of the following:\n"
+      "                            "
+      "    -u (--unified):\n"
+      "                            "
+      "       Output 3 lines of unified context.\n"
+      "                            "
+      "    -b (--ignore-space-change):\n"
+      "                            "
+      "       Ignore changes in the amount of white space.\n"
+      "                            "
+      "    -w (--ignore-all-space):\n"
+      "                            "
+      "       Ignore all white space.\n"
+      "                            "
+      "    --ignore-eol-style:\n"
+      "                            "
+      "       Ignore changes in EOL style")},
+
+  {"quiet",             'q', 0,
+   N_("no progress (only errors) to stderr")},
 
   {0,                   0, 0, 0}
 };
@@ -310,6 +313,7 @@ struct svnlook_opt_state
   svn_boolean_t non_recursive;    /* --non-recursive */
   svn_boolean_t xml;              /* --xml */
   const char *extensions;         /* diff extension args (UTF-8!) */
+  svn_boolean_t quiet;            /* --quiet */
 };
 
 
@@ -2021,7 +2025,8 @@ subcommand_help(apr_getopt_t *os, void *
 
   SVN_ERR(svn_opt_print_help3(os, "svnlook",
                               opt_state ? opt_state->version : FALSE,
-                              FALSE, version_footer->data,
+                              opt_state ? opt_state->quiet : FALSE,
+                              version_footer->data,
                               header, cmd_table, options_table, NULL,
                               NULL, pool));
 
@@ -2326,6 +2331,10 @@ main(int argc, const char *argv[])
           opt_state.help = TRUE;
           break;
 
+        case 'q':
+          opt_state.quiet = TRUE;
+          break;
+
         case svnlook__revprop_opt:
           opt_state.revprop = TRUE;
           break;
@@ -2419,6 +2428,7 @@ main(int argc, const char *argv[])
               static const svn_opt_subcommand_desc2_t pseudo_cmd =
                 { "--version", subcommand_help, {0}, "",
                   {svnlook__version,  /* must accept its own option */
+                   'q',
                   } };
 
               subcommand = &pseudo_cmd;

Modified: subversion/branches/ignore-mergeinfo-log/subversion/svnrdump/svnrdump.c
URL: http://svn.apache.org/viewvc/subversion/branches/ignore-mergeinfo-log/subversion/svnrdump/svnrdump.c?rev=1058221&r1=1058220&r2=1058221&view=diff
==============================================================================
--- subversion/branches/ignore-mergeinfo-log/subversion/svnrdump/svnrdump.c (original)
+++ subversion/branches/ignore-mergeinfo-log/subversion/svnrdump/svnrdump.c Wed Jan 12 16:29:32 2011
@@ -484,6 +484,7 @@ usage(const char *progname,
  */
 static svn_error_t *
 version(const char *progname,
+        svn_boolean_t quiet,
         apr_pool_t *pool)
 {
   svn_stringbuf_t *version_footer =
@@ -493,7 +494,7 @@ version(const char *progname,
 
   SVN_ERR(svn_ra_print_modules(version_footer, pool));
   return svn_opt_print_help3(NULL, ensure_appname(progname, pool),
-                             TRUE, FALSE, version_footer->data,
+                             TRUE, quiet, version_footer->data,
                              NULL, NULL, NULL, NULL, NULL, pool);
 }
 
@@ -796,6 +797,7 @@ main(int argc, const char **argv)
               static const svn_opt_subcommand_desc2_t pseudo_cmd =
                 { "--version", help_cmd, {0}, "",
                   {opt_version,  /* must accept its own option */
+                   'q',  /* --quiet */
                   } };
               subcommand = &pseudo_cmd;
             }
@@ -863,7 +865,7 @@ main(int argc, const char **argv)
 
   if (subcommand && strcmp(subcommand->name, "--version") == 0)
     {
-      SVNRDUMP_ERR(version(argv[0], pool));
+      SVNRDUMP_ERR(version(argv[0], opt_baton->quiet, pool));
       svn_pool_destroy(pool);
       exit(EXIT_SUCCESS);
     }

Modified: subversion/branches/ignore-mergeinfo-log/subversion/svnserve/main.c
URL: http://svn.apache.org/viewvc/subversion/branches/ignore-mergeinfo-log/subversion/svnserve/main.c?rev=1058221&r1=1058220&r2=1058221&view=diff
==============================================================================
--- subversion/branches/ignore-mergeinfo-log/subversion/svnserve/main.c (original)
+++ subversion/branches/ignore-mergeinfo-log/subversion/svnserve/main.c Wed Jan 12 16:29:32 2011
@@ -218,6 +218,8 @@ static const apr_getopt_option_t svnserv
     {"help",             'h', 0, N_("display this help")},
     {"version",           SVNSERVE_OPT_VERSION, 0,
      N_("show program version information")},
+    {"quiet",            'q', 0,
+     N_("no progress (only errors) to stderr")},
     {0,                  0,   0, 0}
   };
 
@@ -260,7 +262,7 @@ static void help(apr_pool_t *pool)
   exit(0);
 }
 
-static svn_error_t * version(apr_pool_t *pool)
+static svn_error_t * version(svn_boolean_t quiet, apr_pool_t *pool)
 {
   const char *fs_desc_start
     = _("The following repository back-end (FS) modules are available:\n\n");
@@ -275,7 +277,7 @@ static svn_error_t * version(apr_pool_t 
                            _("\nCyrus SASL authentication is available.\n"));
 #endif
 
-  return svn_opt_print_help3(NULL, "svnserve", TRUE, FALSE, version_footer->data,
+  return svn_opt_print_help3(NULL, "svnserve", TRUE, quiet, version_footer->data,
                              NULL, NULL, NULL, NULL, NULL, pool);
 }
 
@@ -393,6 +395,8 @@ int main(int argc, const char *argv[])
   int family = APR_INET;
   apr_int32_t sockaddr_info_flags = 0;
   svn_boolean_t prefer_v6 = FALSE;
+  svn_boolean_t quiet = FALSE;
+  svn_boolean_t is_version = FALSE;
   int mode_opt_count = 0;
   const char *config_filename = NULL;
   const char *pid_filename = NULL;
@@ -451,9 +455,12 @@ int main(int argc, const char *argv[])
           help(pool);
           break;
 
+        case 'q':
+          quiet = TRUE;
+          break;
+
         case SVNSERVE_OPT_VERSION:
-          SVN_INT_ERR(version(pool));
-          exit(0);
+          is_version = TRUE;
           break;
 
         case 'd':
@@ -575,6 +582,13 @@ int main(int argc, const char *argv[])
 
         }
     }
+
+  if (is_version)
+    {
+      SVN_INT_ERR(version(quiet, pool));
+      exit(0);
+    }
+
   if (os->ind != argc)
     usage(argv[0], pool);
 

Modified: subversion/branches/ignore-mergeinfo-log/subversion/svnsync/main.c
URL: http://svn.apache.org/viewvc/subversion/branches/ignore-mergeinfo-log/subversion/svnsync/main.c?rev=1058221&r1=1058220&r2=1058221&view=diff
==============================================================================
--- subversion/branches/ignore-mergeinfo-log/subversion/svnsync/main.c (original)
+++ subversion/branches/ignore-mergeinfo-log/subversion/svnsync/main.c Wed Jan 12 16:29:32 2011
@@ -1681,7 +1681,8 @@ help_cmd(apr_getopt_t *os, void *baton, 
 
   SVN_ERR(svn_opt_print_help3(os, "svnsync",
                               opt_baton ? opt_baton->version : FALSE,
-                              FALSE, version_footer->data, header,
+                              opt_baton ? opt_baton->quiet : FALSE,
+                              version_footer->data, header,
                               svnsync_cmd_table, svnsync_options, NULL,
                               NULL, pool));
 
@@ -1961,6 +1962,7 @@ main(int argc, const char *argv[])
               static const svn_opt_subcommand_desc2_t pseudo_cmd =
                 { "--version", help_cmd, {0}, "",
                   {svnsync_opt_version,  /* must accept its own option */
+                   'q',  /* --quiet */
                   } };
 
               subcommand = &pseudo_cmd;

Modified: subversion/branches/ignore-mergeinfo-log/subversion/svnversion/main.c
URL: http://svn.apache.org/viewvc/subversion/branches/ignore-mergeinfo-log/subversion/svnversion/main.c?rev=1058221&r1=1058220&r2=1058221&view=diff
==============================================================================
--- subversion/branches/ignore-mergeinfo-log/subversion/svnversion/main.c (original)
+++ subversion/branches/ignore-mergeinfo-log/subversion/svnversion/main.c Wed Jan 12 16:29:32 2011
@@ -32,9 +32,9 @@
 
 
 static svn_error_t *
-version(apr_pool_t *pool)
+version(svn_boolean_t quiet, apr_pool_t *pool)
 {
-  return svn_opt_print_help3(NULL, "svnversion", TRUE, FALSE, NULL, NULL,
+  return svn_opt_print_help3(NULL, "svnversion", TRUE, quiet, NULL, NULL,
                              NULL, NULL, NULL, NULL, pool);
 }
 
@@ -128,6 +128,8 @@ main(int argc, const char *argv[])
   apr_getopt_t *os;
   svn_node_kind_t kind;
   svn_wc_context_t *wc_ctx;
+  svn_boolean_t quiet = FALSE;
+  svn_boolean_t is_version = FALSE;
   const apr_getopt_option_t options[] =
     {
       {"no-newline", 'n', 0, N_("do not output the trailing newline")},
@@ -135,6 +137,8 @@ main(int argc, const char *argv[])
       {"help", 'h', 0, N_("display this help")},
       {"version", SVNVERSION_OPT_VERSION, 0,
        N_("show program version information")},
+      {"quiet",         'q', 0,
+       N_("no progress (only errors) to stderr")},
       {0,             0,  0,  0}
     };
 
@@ -193,12 +197,14 @@ main(int argc, const char *argv[])
         case 'c':
           committed = TRUE;
           break;
+        case 'q':
+          quiet = TRUE;
+          break;
         case 'h':
           help(options, pool);
           break;
         case SVNVERSION_OPT_VERSION:
-          SVN_INT_ERR(version(pool));
-          exit(0);
+          is_version = TRUE;
           break;
         default:
           usage(pool);
@@ -206,6 +212,11 @@ main(int argc, const char *argv[])
         }
     }
 
+  if (is_version)
+    {
+      SVN_INT_ERR(version(quiet, pool));
+      exit(0);
+    }
   if (os->ind > argc || os->ind < argc - 2)
     {
       usage(pool);

Modified: subversion/branches/ignore-mergeinfo-log/subversion/tests/cmdline/basic_tests.py
URL: http://svn.apache.org/viewvc/subversion/branches/ignore-mergeinfo-log/subversion/tests/cmdline/basic_tests.py?rev=1058221&r1=1058220&r2=1058221&view=diff
==============================================================================
--- subversion/branches/ignore-mergeinfo-log/subversion/tests/cmdline/basic_tests.py (original)
+++ subversion/branches/ignore-mergeinfo-log/subversion/tests/cmdline/basic_tests.py Wed Jan 12 16:29:32 2011
@@ -2260,7 +2260,8 @@ def info_nonexisting_file(sbox):
 
   # Check for the correct error message
   for line in errput:
-    if re.match(".*\(Not a valid URL\).*", line):
+    if re.match(".*" + idonotexist_url + ".*non-existent in revision 1.*",
+                line):
       return
 
   # Else never matched the expected error output, so the test failed.