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/02/07 20:18:33 UTC

svn commit: r1068059 [2/7] - in /subversion/branches/ignore-mergeinfo-log: ./ build/ notes/ notes/commit-access-templates/ subversion/include/ subversion/include/private/ subversion/libsvn_client/ subversion/libsvn_delta/ subversion/libsvn_diff/ subver...

Modified: subversion/branches/ignore-mergeinfo-log/subversion/libsvn_diff/diff_file.c
URL: http://svn.apache.org/viewvc/subversion/branches/ignore-mergeinfo-log/subversion/libsvn_diff/diff_file.c?rev=1068059&r1=1068058&r2=1068059&view=diff
==============================================================================
--- subversion/branches/ignore-mergeinfo-log/subversion/libsvn_diff/diff_file.c (original)
+++ subversion/branches/ignore-mergeinfo-log/subversion/libsvn_diff/diff_file.c Mon Feb  7 19:18:29 2011
@@ -83,6 +83,10 @@ typedef struct svn_diff__file_baton_t
     char *endp;    /* next memory address after the current chunk */
 
     svn_diff__normalize_state_t normalize_state;
+
+    /* Where the identical suffix starts in this datasource */
+    int suffix_start_chunk;
+    apr_off_t suffix_offset_in_chunk;
   } files[4];
 
   /* List of free tokens that may be reused. */
@@ -204,47 +208,545 @@ map_or_read_file(apr_file_t **file,
 }
 
 
-/* Let FILE stand for the file_info struct element of BATON->files that is
- * indexed by DATASOURCE.  BATON's type is (svn_diff__file_baton_t *).
+/* For all files in the FILE array, increment the curp pointer.  If a file
+ * points before the beginning of file, let it point at the first byte again.
+ * If the end of the current chunk is reached, read the next chunk in the
+ * buffer and point curp to the start of the chunk.  If EOF is reached, set
+ * curp equal to endp to indicate EOF. */
+#define INCREMENT_POINTERS(all_files, files_len, pool)                       \
+  do {                                                                       \
+    apr_size_t svn_macro__i;                                                 \
+                                                                             \
+    for (svn_macro__i = 0; svn_macro__i < (files_len); svn_macro__i++)       \
+    {                                                                        \
+      if ((all_files)[svn_macro__i].curp < (all_files)[svn_macro__i].endp - 1)\
+        (all_files)[svn_macro__i].curp++;                                    \
+      else                                                                   \
+        SVN_ERR(increment_chunk(&(all_files)[svn_macro__i], (pool)));        \
+    }                                                                        \
+  } while (0)
+
+
+/* For all files in the FILE array, decrement the curp pointer.  If the
+ * start of a chunk is reached, read the previous chunk in the buffer and
+ * point curp to the last byte of the chunk.  If the beginning of a FILE is
+ * reached, set chunk to -1 to indicate BOF. */
+#define DECREMENT_POINTERS(all_files, files_len, pool)                       \
+  do {                                                                       \
+    apr_size_t svn_macro__i;                                                 \
+                                                                             \
+    for (svn_macro__i = 0; svn_macro__i < (files_len); svn_macro__i++)       \
+    {                                                                        \
+      if ((all_files)[svn_macro__i].curp > (all_files)[svn_macro__i].buffer) \
+        (all_files)[svn_macro__i].curp--;                                    \
+      else                                                                   \
+        SVN_ERR(decrement_chunk(&(all_files)[svn_macro__i], (pool)));        \
+    }                                                                        \
+  } while (0)
+
+
+static svn_error_t *
+increment_chunk(struct file_info *file, apr_pool_t *pool)
+{
+  apr_off_t length;
+  apr_off_t last_chunk = offset_to_chunk(file->size);
+
+  if (file->chunk == -1)
+    {
+      /* We are at BOF (Beginning Of File). Point to first chunk/byte again. */
+      file->chunk = 0;
+      file->curp = file->buffer;
+    }
+  else if (file->chunk == last_chunk)
+    {
+      /* We are at the last chunk. Indicate EOF by setting curp == endp. */
+      file->curp = file->endp;
+    }
+  else
+    {
+      /* There are still chunks left. Read next chunk and reset pointers. */
+      file->chunk++;
+      length = file->chunk == last_chunk ? 
+        offset_in_chunk(file->size) : CHUNK_SIZE;
+      SVN_ERR(read_chunk(file->file, file->path, file->buffer,
+                         length, chunk_to_offset(file->chunk),
+                         pool));
+      file->endp = file->buffer + length;
+      file->curp = file->buffer;
+    }
+  
+  return SVN_NO_ERROR;
+}
+
+
+static svn_error_t *
+decrement_chunk(struct file_info *file, apr_pool_t *pool)
+{
+  if (file->chunk == 0)
+    {
+      /* We are already at the first chunk. Indicate BOF (Beginning Of File)
+         by setting chunk = -1 and curp = endp - 1. Both conditions are
+         important. They help the increment step to catch the BOF situation
+         in an efficient way. */
+      file->chunk--; 
+      file->curp = file->endp - 1;
+    }
+  else
+    {
+      /* Read previous chunk and reset pointers. */
+      file->chunk--;
+      SVN_ERR(read_chunk(file->file, file->path, file->buffer,
+                         CHUNK_SIZE, chunk_to_offset(file->chunk),
+                         pool));
+      file->endp = file->buffer + CHUNK_SIZE;
+      file->curp = file->endp - 1;
+    }
+  
+  return SVN_NO_ERROR;
+}
+
+
+/* Check whether one of the FILEs has its pointers 'before' the beginning of
+ * the file (this can happen while scanning backwards). This is the case if
+ * one of them has chunk == -1. */
+static svn_boolean_t
+is_one_at_bof(struct file_info file[], apr_size_t file_len)
+{
+  apr_size_t i;
+
+  for (i = 0; i < file_len; i++)
+    if (file[i].chunk == -1)
+      return TRUE;
+
+  return FALSE;
+}
+
+/* Check whether one of the FILEs has its pointers at EOF (this is the case if
+ * one of them has curp == endp (this can only happen at the last chunk)) */
+static svn_boolean_t
+is_one_at_eof(struct file_info file[], apr_size_t file_len)
+{
+  apr_size_t i;
+
+  for (i = 0; i < file_len; i++)
+    if (file[i].curp == file[i].endp)
+      return TRUE;
+
+  return FALSE;
+}
+
+/* Quickly determine whether there is a eol char in CHUNK.
+ * (mainly copy-n-paste from eol.c#svn_eol__find_eol_start).
+ */
+#if SVN_UNALIGNED_ACCESS_IS_OK
+#if APR_SIZEOF_VOIDP == 8
+#  define LOWER_7BITS_SET 0x7f7f7f7f7f7f7f7f
+#  define BIT_7_SET       0x8080808080808080
+#  define R_MASK          0x0a0a0a0a0a0a0a0a
+#  define N_MASK          0x0d0d0d0d0d0d0d0d
+#else
+#  define LOWER_7BITS_SET 0x7f7f7f7f
+#  define BIT_7_SET       0x80808080
+#  define R_MASK          0x0a0a0a0a
+#  define N_MASK          0x0d0d0d0d
+#endif
+#endif
+
+#if SVN_UNALIGNED_ACCESS_IS_OK
+static svn_boolean_t contains_eol(apr_size_t chunk)
+{
+  apr_size_t r_test = chunk ^ R_MASK;
+  apr_size_t n_test = chunk ^ N_MASK;
+
+  r_test |= (r_test & LOWER_7BITS_SET) + LOWER_7BITS_SET;
+  n_test |= (n_test & LOWER_7BITS_SET) + LOWER_7BITS_SET;
+
+  return (r_test & n_test & BIT_7_SET) != BIT_7_SET;
+}
+#endif
+
+/* Find the prefix which is identical between all elements of the FILE array.
+ * Return the number of prefix lines in PREFIX_LINES.  REACHED_ONE_EOF will be
+ * set to TRUE if one of the FILEs reached its end while scanning prefix,
+ * i.e. at least one file consisted entirely of prefix.  Otherwise, 
+ * REACHED_ONE_EOF is set to FALSE.
  *
- * Open the file at FILE.path; initialize FILE.file, FILE.size, FILE.buffer,
- * FILE.curp and FILE.endp; allocate a buffer and read the first chunk.
+ * After this function is finished, the buffers, chunks, curp's and endp's 
+ * of the FILEs are set to point at the first byte after the prefix. */
+static svn_error_t *
+find_identical_prefix(svn_boolean_t *reached_one_eof, apr_off_t *prefix_lines,
+                      struct file_info file[], apr_size_t file_len,
+                      apr_pool_t *pool)
+{
+  svn_boolean_t had_cr = FALSE;
+  svn_boolean_t is_match;
+  apr_off_t lines = 0;
+  apr_size_t i;
+
+  for (i = 1, is_match = TRUE; i < file_len; i++)
+    is_match = is_match && *file[0].curp == *file[i].curp;
+  while (is_match)
+    {
+#if SVN_UNALIGNED_ACCESS_IS_OK
+      apr_ssize_t max_delta, delta;
+#endif /* SVN_UNALIGNED_ACCESS_IS_OK */
+
+      /* ### TODO: see if we can take advantage of 
+         diff options like ignore_eol_style or ignore_space. */
+      /* check for eol, and count */
+      if (*file[0].curp == '\r')
+        {
+          lines++;
+          had_cr = TRUE;
+        }
+      else if (*file[0].curp == '\n' && !had_cr)
+        {
+          lines++;
+        }
+      else 
+        {
+          had_cr = FALSE;
+        }
+
+      INCREMENT_POINTERS(file, file_len, pool);
+
+#if SVN_UNALIGNED_ACCESS_IS_OK
+
+      /* Try to advance as far as possible with machine-word granularity.
+       * Determine how far we may advance with chunky ops without reaching
+       * endp for any of the files.
+       * Signedness is important here if curp gets close to endp.
+       */
+      max_delta = file[0].endp - file[0].curp - sizeof(apr_size_t);
+      for (i = 1; i < file_len; i++)
+        {
+          delta = file[i].endp - file[i].curp - sizeof(apr_size_t);
+          if (delta < max_delta)
+            max_delta = delta;
+        }
+
+      is_match = TRUE;
+      for (delta = 0; delta < max_delta && is_match; delta += sizeof(apr_size_t))
+        {
+          apr_size_t chunk = *(const apr_size_t *)(file[0].curp + delta);
+          if (contains_eol(chunk))
+            break;
+
+          for (i = 1; i < file_len; i++)
+            if (chunk != *(const apr_size_t *)(file[i].curp + delta))
+              {
+                is_match = FALSE;
+                delta -= sizeof(apr_size_t);
+                break;
+              }
+        }
+
+      /* We either found a mismatch or an EOL at or shortly behind curp+delta
+       * or we cannot proceed with chunky ops without exceeding endp.
+       * In any way, everything up to curp + delta is equal and not an EOL.
+       */
+      for (i = 0; i < file_len; i++)
+        file[i].curp += delta;
+
+#endif
+
+      *reached_one_eof = is_one_at_eof(file, file_len);
+      if (*reached_one_eof)
+        break;
+      else
+        for (i = 1, is_match = TRUE; i < file_len; i++)
+          is_match = is_match && *file[0].curp == *file[i].curp;
+    }
+
+  if (had_cr)
+    {
+      /* Check if we ended in the middle of a \r\n for one file, but \r for 
+         another. If so, back up one byte, so the next loop will back up
+         the entire line. Also decrement lines, since we counted one
+         too many for the \r. */
+      svn_boolean_t ended_at_nonmatching_newline = FALSE;
+      for (i = 0; i < file_len; i++)
+        ended_at_nonmatching_newline = ended_at_nonmatching_newline 
+                                       || *file[i].curp == '\n';
+      if (ended_at_nonmatching_newline)
+        {
+          lines--;
+          DECREMENT_POINTERS(file, file_len, pool);
+        }
+    }
+
+  /* Back up one byte, so we point at the last identical byte */
+  DECREMENT_POINTERS(file, file_len, pool);
+
+  /* Back up to the last eol sequence (\n, \r\n or \r) */
+  while (!is_one_at_bof(file, file_len) && 
+         *file[0].curp != '\n' && *file[0].curp != '\r')
+    DECREMENT_POINTERS(file, file_len, pool);
+
+  /* Slide one byte forward, to point past the eol sequence */
+  INCREMENT_POINTERS(file, file_len, pool);
+
+  *prefix_lines = lines;
+
+  return SVN_NO_ERROR;
+}
+
+
+#define SUFFIX_LINES_TO_KEEP 50
+
+/* Find the suffix which is identical between all elements of the FILE array.
  *
- * Implements svn_diff_fns_t::datasource_open. */
+ * Before this function is called the FILEs' pointers and chunks should be 
+ * positioned right after the identical prefix (which is the case after 
+ * find_identical_prefix), so we can determine where suffix scanning should 
+ * ultimately stop. */
 static svn_error_t *
-datasource_open(void *baton, svn_diff_datasource_e datasource)
+find_identical_suffix(struct file_info file[], apr_size_t file_len,
+                      apr_pool_t *pool)
 {
-  svn_diff__file_baton_t *file_baton = baton;
-  struct file_info *file = &file_baton->files[datasource_to_index(datasource)];
-  apr_finfo_t finfo;
-  apr_off_t length;
-  char *curp;
-  char *endp;
+  struct file_info file_for_suffix[4];
+  apr_off_t length[4];
+  apr_off_t suffix_min_chunk0;
+  apr_off_t suffix_min_offset0;
+  apr_off_t min_file_size;
+  int suffix_lines_to_keep = SUFFIX_LINES_TO_KEEP;
+  svn_boolean_t is_match, can_read, reached_prefix;
+  apr_size_t i;
+
+  memset(file_for_suffix, 0, sizeof(file_for_suffix));
+
+  /* Initialize file_for_suffix[].
+     Read last chunk, position curp at last byte. */
+  for (i = 0; i < file_len; i++)
+    {
+      file_for_suffix[i].path = file[i].path;
+      file_for_suffix[i].file = file[i].file;
+      file_for_suffix[i].size = file[i].size;
+      file_for_suffix[i].chunk =
+        (int) offset_to_chunk(file_for_suffix[i].size); /* last chunk */
+      length[i] = offset_in_chunk(file_for_suffix[i].size);
+      if (file_for_suffix[i].chunk == file[i].chunk)
+        {
+          /* Prefix ended in last chunk, so we can reuse the prefix buffer */
+          file_for_suffix[i].buffer = file[i].buffer;
+        }
+      else
+        {
+          /* There is at least more than 1 chunk,
+             so allocate full chunk size buffer */
+          file_for_suffix[i].buffer = apr_palloc(pool, CHUNK_SIZE);
+          SVN_ERR(read_chunk(file_for_suffix[i].file, file_for_suffix[i].path,
+                             file_for_suffix[i].buffer, length[i],
+                             chunk_to_offset(file_for_suffix[i].chunk),
+                             pool));
+        }
+      file_for_suffix[i].endp = file_for_suffix[i].buffer + length[i];
+      file_for_suffix[i].curp = file_for_suffix[i].endp - 1;
+    }
+
+  /* Get the chunk and pointer offset (for file[0]) at which we should stop
+     scanning backward for the identical suffix, i.e. when we reach prefix. */
+  suffix_min_chunk0 = file[0].chunk;
+  suffix_min_offset0 = file[0].curp - file[0].buffer;
+
+  /* Compensate if other files are smaller than file[0] */
+  for (i = 1, min_file_size = file[0].size; i < file_len; i++)
+    if (file[i].size < min_file_size)
+      min_file_size = file[i].size;
+  if (file[0].size > min_file_size)
+    {
+      suffix_min_chunk0 += (file[0].size - min_file_size) / CHUNK_SIZE;
+      suffix_min_offset0 += (file[0].size - min_file_size) % CHUNK_SIZE;
+    }
+
+  /* Scan backwards until mismatch or until we reach the prefix. */
+  while (1)
+    {
+      /* Initialize the minimum pointer positions. */
+      const char *min_curp[4];
+#if SVN_UNALIGNED_ACCESS_IS_OK
+      svn_boolean_t can_read_word;
+#endif /* SVN_UNALIGNED_ACCESS_IS_OK */
+
+      min_curp[0] = file_for_suffix[0].chunk == suffix_min_chunk0
+                  ? file_for_suffix[0].buffer + suffix_min_offset0 + 1
+                  : file_for_suffix[0].buffer + 1;
+      for (i = 1; i < file_len; i++)
+        min_curp[i] = file_for_suffix[i].buffer + 1;
+
+#if SVN_UNALIGNED_ACCESS_IS_OK
+
+      /* Scan quickly by reading with machine-word granularity. */
+      for (i = 0, can_read_word = TRUE; i < file_len; i++)
+        can_read_word = can_read_word 
+                        && (   file_for_suffix[i].curp - sizeof(apr_size_t)
+                            >= min_curp[i]);
+      if (can_read_word)
+        {
+          do
+            {
+              for (i = 0; i < file_len; i++)
+                file_for_suffix[i].curp -= sizeof(apr_size_t);
 
-  SVN_ERR(svn_io_file_open(&file->file, file->path,
-                           APR_READ, APR_OS_DEFAULT, file_baton->pool));
+              for (i = 0, can_read_word = TRUE; i < file_len; i++)
+                can_read_word = can_read_word 
+                                && (   file_for_suffix[i].curp - sizeof(apr_size_t)
+                                    >= min_curp[i]);
+              for (i = 1, is_match = TRUE; i < file_len; i++)
+                is_match = is_match
+                           && (   *(const apr_size_t *)(file_for_suffix[0].curp + 1)
+                               == *(const apr_size_t *)(file_for_suffix[i].curp + 1));
+            } while (can_read_word && is_match);
 
-  SVN_ERR(svn_io_file_info_get(&finfo, APR_FINFO_SIZE,
-                               file->file, file_baton->pool));
+            for (i = 0; i < file_len; i++)
+              file_for_suffix[i].curp += sizeof(apr_size_t);
+        }
 
-  file->size = finfo.size;
-  length = finfo.size > CHUNK_SIZE ? CHUNK_SIZE : finfo.size;
+#endif
 
-  if (length == 0)
-    return SVN_NO_ERROR;
+      for (i = 1, is_match = TRUE; i < file_len; i++)
+        is_match =
+          is_match && *file_for_suffix[0].curp == *file_for_suffix[i].curp;
+      for (i = 0, can_read = TRUE; i < file_len; i++)
+        can_read = can_read && (file_for_suffix[i].curp > min_curp[i]);
+      while (is_match && can_read)
+        {
+          for (i = 0; i < file_len; i++)
+            file_for_suffix[i].curp--;
+          for (i = 1, is_match = TRUE; i < file_len; i++)
+            is_match =
+              is_match && *file_for_suffix[0].curp == *file_for_suffix[i].curp;
+          for (i = 0, can_read = TRUE; i < file_len; i++)
+            can_read = can_read && (file_for_suffix[i].curp > min_curp[i]);
+        }
+
+      if (!is_match)
+        break;
+
+      DECREMENT_POINTERS(file_for_suffix, file_len, pool);
+
+      reached_prefix = file_for_suffix[0].chunk == suffix_min_chunk0 
+                       && (file_for_suffix[0].curp - file_for_suffix[0].buffer)
+                          == suffix_min_offset0;
+
+      if (reached_prefix || is_one_at_bof(file_for_suffix, file_len))
+        break;
+    }
+
+  /* Slide one byte forward, to point at the first byte of identical suffix */
+  INCREMENT_POINTERS(file_for_suffix, file_len, pool);
+
+  /* Slide forward until we find an eol sequence to add the rest of the line
+     we're in. Then add SUFFIX_LINES_TO_KEEP more lines. Stop if at least 
+     one file reaches its end. */
+  do
+    {
+      while (!is_one_at_eof(file_for_suffix, file_len)
+             && *file_for_suffix[0].curp != '\n'
+             && *file_for_suffix[0].curp != '\r')
+        INCREMENT_POINTERS(file_for_suffix, file_len, pool);
+
+      /* Slide one or two more bytes, to point past the eol. */
+      if (!is_one_at_eof(file_for_suffix, file_len)
+          && *file_for_suffix[0].curp == '\r')
+        INCREMENT_POINTERS(file_for_suffix, file_len, pool);
+      if (!is_one_at_eof(file_for_suffix, file_len)
+          && *file_for_suffix[0].curp == '\n')
+        INCREMENT_POINTERS(file_for_suffix, file_len, pool);
+    }
+  while (!is_one_at_eof(file_for_suffix, file_len) 
+         && suffix_lines_to_keep--);
 
-  endp = curp = apr_palloc(file_baton->pool, (apr_size_t) length);
-  endp += length;
+  /* Save the final suffix information in the original file_info */
+  for (i = 0; i < file_len; i++)
+    {
+      file[i].suffix_start_chunk = file_for_suffix[i].chunk;
+      file[i].suffix_offset_in_chunk = 
+        file_for_suffix[i].curp - file_for_suffix[i].buffer;
+    }
+
+  return SVN_NO_ERROR;
+}
 
-  file->buffer = file->curp = curp;
-  file->endp = endp;
 
-  return read_chunk(file->file, file->path,
-                    curp, length, 0, file_baton->pool);
+/* Let FILE stand for the array of file_info struct elements of BATON->files
+ * that are indexed by the elements of the DATASOURCE array.
+ * BATON's type is (svn_diff__file_baton_t *).
+ *
+ * For each file in the FILE array, open the file at FILE.path; initialize 
+ * FILE.file, FILE.size, FILE.buffer, FILE.curp and FILE.endp; allocate a 
+ * buffer and read the first chunk.  Then find the prefix and suffix lines
+ * which are identical between all the files.  Return the number of identical
+ * prefix lines in PREFIX_LINES.
+ *
+ * Finding the identical prefix and suffix allows us to exclude those from the
+ * rest of the diff algorithm, which increases performance by reducing the 
+ * problem space.
+ *
+ * Implements svn_diff_fns2_t::datasources_open. */
+static svn_error_t *
+datasources_open(void *baton, apr_off_t *prefix_lines,
+                 const svn_diff_datasource_e *datasources,
+                 apr_size_t datasources_len)
+{
+  svn_diff__file_baton_t *file_baton = baton;
+  struct file_info files[4];
+  apr_finfo_t finfo[4];
+  apr_off_t length[4];
+  svn_boolean_t reached_one_eof;
+  apr_size_t i;
+
+  /* Make sure prefix_lines is set correctly, even if we exit early because
+   * one of the files is empty. */
+  *prefix_lines = 0;
+
+  /* Open datasources and read first chunk */
+  for (i = 0; i < datasources_len; i++)
+    {
+      struct file_info *file
+          = &file_baton->files[datasource_to_index(datasources[i])];
+      SVN_ERR(svn_io_file_open(&file->file, file->path,
+                               APR_READ, APR_OS_DEFAULT, file_baton->pool));
+      SVN_ERR(svn_io_file_info_get(&finfo[i], APR_FINFO_SIZE,
+                                   file->file, file_baton->pool));
+      file->size = finfo[i].size;
+      length[i] = finfo[i].size > CHUNK_SIZE ? CHUNK_SIZE : finfo[i].size;
+      file->buffer = apr_palloc(file_baton->pool, (apr_size_t) length[i]);
+      SVN_ERR(read_chunk(file->file, file->path, file->buffer,
+                         length[i], 0, file_baton->pool));
+      file->endp = file->buffer + length[i];
+      file->curp = file->buffer;
+      /* Set suffix_start_chunk to a guard value, so if suffix scanning is
+       * skipped because one of the files is empty, or because of
+       * reached_one_eof, we can still easily check for the suffix during
+       * token reading (datasource_get_next_token). */
+      file->suffix_start_chunk = -1;
+
+      files[i] = *file;
+    }
+
+  for (i = 0; i < datasources_len; i++)
+    if (length[i] == 0)
+      /* There will not be any identical prefix/suffix, so we're done. */
+      return SVN_NO_ERROR;
+
+  SVN_ERR(find_identical_prefix(&reached_one_eof, prefix_lines,
+                                files, datasources_len, file_baton->pool));
+
+  if (!reached_one_eof)
+    /* No file consisted totally of identical prefix,
+     * so there may be some identical suffix.  */
+    SVN_ERR(find_identical_suffix(files, datasources_len, file_baton->pool));
+
+  /* Copy local results back to baton. */
+  for (i = 0; i < datasources_len; i++)
+    file_baton->files[datasource_to_index(datasources[i])] = files[i];
+
+  return SVN_NO_ERROR;
 }
 
 
-/* Implements svn_diff_fns_t::datasource_close */
+/* Implements svn_diff_fns2_t::datasource_close */
 static svn_error_t *
 datasource_close(void *baton, svn_diff_datasource_e datasource)
 {
@@ -255,7 +757,7 @@ datasource_close(void *baton, svn_diff_d
   return SVN_NO_ERROR;
 }
 
-/* Implements svn_diff_fns_t::datasource_get_next_token */
+/* Implements svn_diff_fns2_t::datasource_get_next_token */
 static svn_error_t *
 datasource_get_next_token(apr_uint32_t *hash, void **token, void *baton,
                           svn_diff_datasource_e datasource)
@@ -285,7 +787,14 @@ datasource_get_next_token(apr_uint32_t *
       return SVN_NO_ERROR;
     }
 
-  /* Get a new token */
+  /* Stop when we encounter the identical suffix. If suffix scanning was not
+   * performed, suffix_start_chunk will be -1, so this condition will never
+   * be true. */
+  if (file->chunk == file->suffix_start_chunk
+      && curp - file->buffer == file->suffix_offset_in_chunk)
+    return SVN_NO_ERROR;
+
+  /* Allocate a new token, or fetch one from the "reusable tokens" list. */
   file_token = file_baton->tokens;
   if (file_token)
     {
@@ -387,7 +896,7 @@ datasource_get_next_token(apr_uint32_t *
 
 #define COMPARE_CHUNK_SIZE 4096
 
-/* Implements svn_diff_fns_t::token_compare */
+/* Implements svn_diff_fns2_t::token_compare */
 static svn_error_t *
 token_compare(void *baton, void *token1, void *token2, int *compare)
 {
@@ -508,19 +1017,20 @@ token_compare(void *baton, void *token1,
 }
 
 
-/* Implements svn_diff_fns_t::token_discard */
+/* Implements svn_diff_fns2_t::token_discard */
 static void
 token_discard(void *baton, void *token)
 {
   svn_diff__file_baton_t *file_baton = baton;
   svn_diff__file_token_t *file_token = token;
 
+  /* Prepend FILE_TOKEN to FILE_BATON->TOKENS, for reuse. */
   file_token->next = file_baton->tokens;
   file_baton->tokens = file_token;
 }
 
 
-/* Implements svn_diff_fns_t::token_discard_all */
+/* Implements svn_diff_fns2_t::token_discard_all */
 static void
 token_discard_all(void *baton)
 {
@@ -531,9 +1041,9 @@ token_discard_all(void *baton)
 }
 
 
-static const svn_diff_fns_t svn_diff__file_vtable =
+static const svn_diff_fns2_t svn_diff__file_vtable =
 {
-  datasource_open,
+  datasources_open,
   datasource_close,
   datasource_get_next_token,
   token_compare,
@@ -675,7 +1185,7 @@ svn_diff_file_diff_2(svn_diff_t **diff,
   baton.files[1].path = modified;
   baton.pool = svn_pool_create(pool);
 
-  SVN_ERR(svn_diff_diff(diff, &baton, &svn_diff__file_vtable, pool));
+  SVN_ERR(svn_diff_diff_2(diff, &baton, &svn_diff__file_vtable, pool));
 
   svn_pool_destroy(baton.pool);
   return SVN_NO_ERROR;
@@ -698,7 +1208,7 @@ svn_diff_file_diff3_2(svn_diff_t **diff,
   baton.files[2].path = latest;
   baton.pool = svn_pool_create(pool);
 
-  SVN_ERR(svn_diff_diff3(diff, &baton, &svn_diff__file_vtable, pool));
+  SVN_ERR(svn_diff_diff3_2(diff, &baton, &svn_diff__file_vtable, pool));
 
   svn_pool_destroy(baton.pool);
   return SVN_NO_ERROR;
@@ -723,7 +1233,7 @@ svn_diff_file_diff4_2(svn_diff_t **diff,
   baton.files[3].path = ancestor;
   baton.pool = svn_pool_create(pool);
 
-  SVN_ERR(svn_diff_diff4(diff, &baton, &svn_diff__file_vtable, pool));
+  SVN_ERR(svn_diff_diff4_2(diff, &baton, &svn_diff__file_vtable, pool));
 
   svn_pool_destroy(baton.pool);
   return SVN_NO_ERROR;

Modified: subversion/branches/ignore-mergeinfo-log/subversion/libsvn_diff/diff_memory.c
URL: http://svn.apache.org/viewvc/subversion/branches/ignore-mergeinfo-log/subversion/libsvn_diff/diff_memory.c?rev=1068059&r1=1068058&r2=1068059&view=diff
==============================================================================
--- subversion/branches/ignore-mergeinfo-log/subversion/libsvn_diff/diff_memory.c (original)
+++ subversion/branches/ignore-mergeinfo-log/subversion/libsvn_diff/diff_memory.c Mon Feb  7 19:18:29 2011
@@ -88,16 +88,19 @@ datasource_to_index(svn_diff_datasource_
 }
 
 
-/* Implements svn_diff_fns_t::datasource_open */
+/* Implements svn_diff_fns2_t::datasources_open */
 static svn_error_t *
-datasource_open(void *baton, svn_diff_datasource_e datasource)
+datasources_open(void *baton, apr_off_t *prefix_lines,
+                 const svn_diff_datasource_e *datasources,
+                 apr_size_t datasources_len)
 {
   /* Do nothing: everything is already there and initialized to 0 */
+  *prefix_lines = 0;
   return SVN_NO_ERROR;
 }
 
 
-/* Implements svn_diff_fns_t::datasource_close */
+/* Implements svn_diff_fns2_t::datasource_close */
 static svn_error_t *
 datasource_close(void *baton, svn_diff_datasource_e datasource)
 {
@@ -109,7 +112,7 @@ datasource_close(void *baton, svn_diff_d
 }
 
 
-/* Implements svn_diff_fns_t::datasource_get_next_token */
+/* Implements svn_diff_fns2_t::datasource_get_next_token */
 static svn_error_t *
 datasource_get_next_token(apr_uint32_t *hash, void **token, void *baton,
                           svn_diff_datasource_e datasource)
@@ -138,7 +141,7 @@ datasource_get_next_token(apr_uint32_t *
   return SVN_NO_ERROR;
 }
 
-/* Implements svn_diff_fns_t::token_compare */
+/* Implements svn_diff_fns2_t::token_compare */
 static svn_error_t *
 token_compare(void *baton, void *token1, void *token2, int *result)
 {
@@ -167,7 +170,7 @@ token_compare(void *baton, void *token1,
   return SVN_NO_ERROR;
 }
 
-/* Implements svn_diff_fns_t::token_discard */
+/* Implements svn_diff_fns2_t::token_discard */
 static void
 token_discard(void *baton, void *token)
 {
@@ -175,7 +178,7 @@ token_discard(void *baton, void *token)
 }
 
 
-/* Implements svn_diff_fns_t::token_discard_all */
+/* Implements svn_diff_fns2_t::token_discard_all */
 static void
 token_discard_all(void *baton)
 {
@@ -187,9 +190,9 @@ token_discard_all(void *baton)
 }
 
 
-static const svn_diff_fns_t svn_diff__mem_vtable =
+static const svn_diff_fns2_t svn_diff__mem_vtable =
 {
-  datasource_open,
+  datasources_open,
   datasource_close,
   datasource_get_next_token,
   token_compare,
@@ -284,7 +287,7 @@ svn_diff_mem_string_diff(svn_diff_t **di
 
   baton.normalization_options = options;
 
-  return svn_diff_diff(diff, &baton, &svn_diff__mem_vtable, pool);
+  return svn_diff_diff_2(diff, &baton, &svn_diff__mem_vtable, pool);
 }
 
 svn_error_t *
@@ -304,7 +307,7 @@ svn_diff_mem_string_diff3(svn_diff_t **d
 
   baton.normalization_options = options;
 
-  return svn_diff_diff3(diff, &baton, &svn_diff__mem_vtable, pool);
+  return svn_diff_diff3_2(diff, &baton, &svn_diff__mem_vtable, pool);
 }
 
 
@@ -327,7 +330,7 @@ svn_diff_mem_string_diff4(svn_diff_t **d
 
   baton.normalization_options = options;
 
-  return svn_diff_diff4(diff, &baton, &svn_diff__mem_vtable, pool);
+  return svn_diff_diff4_2(diff, &baton, &svn_diff__mem_vtable, pool);
 }
 
 

Modified: subversion/branches/ignore-mergeinfo-log/subversion/libsvn_diff/lcs.c
URL: http://svn.apache.org/viewvc/subversion/branches/ignore-mergeinfo-log/subversion/libsvn_diff/lcs.c?rev=1068059&r1=1068058&r2=1068059&view=diff
==============================================================================
--- subversion/branches/ignore-mergeinfo-log/subversion/libsvn_diff/lcs.c (original)
+++ subversion/branches/ignore-mergeinfo-log/subversion/libsvn_diff/lcs.c Mon Feb  7 19:18:29 2011
@@ -160,9 +160,36 @@ svn_diff__lcs_reverse(svn_diff__lcs_t *l
 }
 
 
+/* Prepends a new lcs chunk for the amount of PREFIX_LINES to the given LCS
+ * chain, and returns it. This function assumes PREFIX_LINES > 0. */
+static svn_diff__lcs_t *
+prepend_prefix_lcs(svn_diff__lcs_t *lcs,
+                   apr_off_t prefix_lines,
+                   apr_pool_t *pool)
+{
+  svn_diff__lcs_t *prefix_lcs;
+
+  SVN_ERR_ASSERT_NO_RETURN(prefix_lines > 0);
+
+  prefix_lcs = apr_palloc(pool, sizeof(*prefix_lcs));
+  prefix_lcs->position[0] = apr_pcalloc(pool, 
+                                        sizeof(*prefix_lcs->position[0]));
+  prefix_lcs->position[0]->offset = 1;
+  prefix_lcs->position[1] = apr_pcalloc(pool,
+                                        sizeof(*prefix_lcs->position[1]));
+  prefix_lcs->position[1]->offset = 1;
+  prefix_lcs->length = prefix_lines;
+  prefix_lcs->refcount = 1;
+  prefix_lcs->next = lcs;
+
+  return prefix_lcs;
+}
+
+
 svn_diff__lcs_t *
 svn_diff__lcs(svn_diff__position_t *position_list1, /* pointer to tail (ring) */
               svn_diff__position_t *position_list2, /* pointer to tail (ring) */
+              apr_off_t prefix_lines,
               apr_pool_t *pool)
 {
   int idx;
@@ -180,15 +207,22 @@ svn_diff__lcs(svn_diff__position_t *posi
    */
   lcs = apr_palloc(pool, sizeof(*lcs));
   lcs->position[0] = apr_pcalloc(pool, sizeof(*lcs->position[0]));
-  lcs->position[0]->offset = position_list1 ? position_list1->offset + 1 : 1;
+  lcs->position[0]->offset = position_list1 ? 
+    position_list1->offset + 1 : prefix_lines + 1;
   lcs->position[1] = apr_pcalloc(pool, sizeof(*lcs->position[1]));
-  lcs->position[1]->offset = position_list2 ? position_list2->offset + 1 : 1;
+  lcs->position[1]->offset = position_list2 ?
+    position_list2->offset + 1 : prefix_lines + 1;
   lcs->length = 0;
   lcs->refcount = 1;
   lcs->next = NULL;
 
   if (position_list1 == NULL || position_list2 == NULL)
-    return lcs;
+    {
+      if (prefix_lines)
+        return prepend_prefix_lcs(lcs, prefix_lines, pool);
+      else
+        return lcs;
+    }
 
   /* Calculate length of both sequences to be compared */
   length[0] = position_list1->offset - position_list1->next->offset + 1;
@@ -249,5 +283,8 @@ svn_diff__lcs(svn_diff__position_t *posi
   position_list1->next = sentinel_position[idx].next;
   position_list2->next = sentinel_position[abs(1 - idx)].next;
 
-  return lcs;
+  if (prefix_lines)
+    return prepend_prefix_lcs(lcs, prefix_lines, pool);
+  else
+    return lcs;
 }

Modified: subversion/branches/ignore-mergeinfo-log/subversion/libsvn_diff/token.c
URL: http://svn.apache.org/viewvc/subversion/branches/ignore-mergeinfo-log/subversion/libsvn_diff/token.c?rev=1068059&r1=1068058&r2=1068059&view=diff
==============================================================================
--- subversion/branches/ignore-mergeinfo-log/subversion/libsvn_diff/token.c (original)
+++ subversion/branches/ignore-mergeinfo-log/subversion/libsvn_diff/token.c Mon Feb  7 19:18:29 2011
@@ -71,7 +71,7 @@ svn_diff__tree_create(svn_diff__tree_t *
 static svn_error_t *
 tree_insert_token(svn_diff__node_t **node, svn_diff__tree_t *tree,
                   void *diff_baton,
-                  const svn_diff_fns_t *vtable,
+                  const svn_diff_fns2_t *vtable,
                   apr_uint32_t hash, void *token)
 {
   svn_diff__node_t *new_node;
@@ -137,8 +137,9 @@ svn_error_t *
 svn_diff__get_tokens(svn_diff__position_t **position_list,
                      svn_diff__tree_t *tree,
                      void *diff_baton,
-                     const svn_diff_fns_t *vtable,
+                     const svn_diff_fns2_t *vtable,
                      svn_diff_datasource_e datasource,
+                     apr_off_t prefix_lines,
                      apr_pool_t *pool)
 {
   svn_diff__position_t *start_position;
@@ -151,11 +152,8 @@ svn_diff__get_tokens(svn_diff__position_
 
   *position_list = NULL;
 
-
-  SVN_ERR(vtable->datasource_open(diff_baton, datasource));
-
   position_ref = &start_position;
-  offset = 0;
+  offset = prefix_lines;
   hash = 0; /* The callback fn doesn't need to touch it per se */
   while (1)
     {

Modified: subversion/branches/ignore-mergeinfo-log/subversion/libsvn_fs_fs/caching.c
URL: http://svn.apache.org/viewvc/subversion/branches/ignore-mergeinfo-log/subversion/libsvn_fs_fs/caching.c?rev=1068059&r1=1068058&r2=1068059&view=diff
==============================================================================
--- subversion/branches/ignore-mergeinfo-log/subversion/libsvn_fs_fs/caching.c (original)
+++ subversion/branches/ignore-mergeinfo-log/subversion/libsvn_fs_fs/caching.c Mon Feb  7 19:18:29 2011
@@ -300,12 +300,27 @@ svn_fs_fs__initialize_caches(svn_fs_t *f
                                          apr_pstrcat(pool, prefix, "TEXT",
                                                      (char *)NULL),
                                          fs->pool));
-      if (! no_handler)
-        SVN_ERR(svn_cache__set_error_handler(ffd->fulltext_cache,
-                                             warn_on_cache_errors, fs, pool));
+    }
+  else if (svn_fs__get_global_membuffer_cache() && 
+           svn_fs_get_cache_config()->cache_fulltexts)
+    {
+      SVN_ERR(svn_cache__create_membuffer_cache(&(ffd->fulltext_cache),
+                                                svn_fs__get_global_membuffer_cache(),
+                                                /* Values are svn_string_t */
+                                                NULL, NULL,
+                                                APR_HASH_KEY_STRING,
+                                                apr_pstrcat(pool, prefix, "TEXT",
+                                                            NULL),
+                                                fs->pool));
     }
   else
-    ffd->fulltext_cache = NULL;
+    {
+      ffd->fulltext_cache = NULL;
+    }
+
+  if (ffd->fulltext_cache && ! no_handler)
+    SVN_ERR(svn_cache__set_error_handler(ffd->fulltext_cache,
+            warn_on_cache_errors, fs, pool));
 
   return SVN_NO_ERROR;
 }

Modified: subversion/branches/ignore-mergeinfo-log/subversion/libsvn_ra/compat.c
URL: http://svn.apache.org/viewvc/subversion/branches/ignore-mergeinfo-log/subversion/libsvn_ra/compat.c?rev=1068059&r1=1068058&r2=1068059&view=diff
==============================================================================
--- subversion/branches/ignore-mergeinfo-log/subversion/libsvn_ra/compat.c (original)
+++ subversion/branches/ignore-mergeinfo-log/subversion/libsvn_ra/compat.c Mon Feb  7 19:18:29 2011
@@ -161,8 +161,8 @@ prev_log_path(const char **prev_path_p,
                     *action_p = change->action;
                   if (copyfrom_rev_p)
                     *copyfrom_rev_p = change->copyfrom_rev;
-                  prev_path = svn_path_join(change->copyfrom_path,
-                                            path + len + 1, pool);
+                  prev_path = svn_fspath__join(change->copyfrom_path,
+                                               path + len + 1, pool);
                   break;
                 }
             }
@@ -188,6 +188,26 @@ prev_log_path(const char **prev_path_p,
 }
 
 
+/* Set *FS_PATH_P to the absolute filesystem path associated with the
+   URL built from SESSION's URL and REL_PATH (which is relative to
+   session's URL.  Use POOL for allocations. */
+static svn_error_t *
+get_fs_path(const char **fs_path_p,
+            svn_ra_session_t *session,
+            const char *rel_path,
+            apr_pool_t *pool)
+{
+  const char *url, *fs_path;
+
+  SVN_ERR(svn_ra_get_session_url(session, &url, pool));
+  SVN_ERR(svn_ra_get_path_relative_to_root(session, &fs_path, url, pool));
+  *fs_path_p = svn_fspath__canonicalize(svn_relpath_join(fs_path,
+                                                         rel_path, pool),
+                                        pool);
+  return SVN_NO_ERROR;
+}
+
+
 
 /*** Fallback implementation of svn_ra_get_locations(). ***/
 
@@ -293,20 +313,17 @@ svn_ra__locations_from_log(svn_ra_sessio
   apr_array_header_t *targets;
   svn_revnum_t youngest_requested, oldest_requested, youngest, oldest;
   svn_node_kind_t kind;
-  const char *root_url, *url, *rel_path;
-
-  /* Fetch the repository root URL and relative path. */
-  SVN_ERR(svn_ra_get_repos_root2(session, &root_url, pool));
-  SVN_ERR(svn_ra_get_session_url(session, &url, pool));
-  url = svn_path_join(url, path, pool);
-  rel_path = svn_path_uri_decode(url + strlen(root_url), pool);
+  const char *fs_path;
 
+  /* Fetch the absolute FS path associated with PATH. */
+  SVN_ERR(get_fs_path(&fs_path, session, path, pool));
+  
   /* Sanity check: verify that the peg-object exists in repos. */
   SVN_ERR(svn_ra_check_path(session, path, peg_revision, &kind, pool));
   if (kind == svn_node_none)
     return svn_error_createf(SVN_ERR_FS_NOT_FOUND, NULL,
                              _("Path '%s' doesn't exist in revision %ld"),
-                             rel_path, peg_revision);
+                             fs_path, peg_revision);
 
   /* Easy out: no location revisions. */
   if (! location_revisions->nelts)
@@ -333,7 +350,7 @@ svn_ra__locations_from_log(svn_ra_sessio
 
   /* Populate most of our log receiver baton structure. */
   lrb.kind = kind;
-  lrb.last_path = rel_path;
+  lrb.last_path = fs_path;
   lrb.location_revisions = apr_array_copy(pool, location_revisions);
   lrb.peg_revision = peg_revision;
   lrb.peg_path = NULL;
@@ -352,7 +369,7 @@ svn_ra__locations_from_log(svn_ra_sessio
 
   /* If the received log information did not cover any of the
      requested revisions, use the last known path.  (This normally
-     just means that ABS_PATH was not modified between the requested
+     just means that FS_PATH was not modified between the requested
      revision and OLDEST.  If the file was created at some point after
      OLDEST, then lrb.last_path should be NULL.) */
   if (! lrb.peg_path)
@@ -375,15 +392,15 @@ svn_ra__locations_from_log(svn_ra_sessio
     return svn_error_createf
       (APR_EGENERAL, NULL,
        _("Unable to find repository location for '%s' in revision %ld"),
-       rel_path, peg_revision);
+       fs_path, peg_revision);
 
   /* Sanity check: make sure that our calculated peg path is the same
      as what we expected it to be. */
-  if (strcmp(rel_path, lrb.peg_path) != 0)
+  if (strcmp(fs_path, lrb.peg_path) != 0)
     return svn_error_createf
       (SVN_ERR_CLIENT_UNRELATED_RESOURCES, NULL,
        _("'%s' in revision %ld is an unrelated object"),
-       rel_path, youngest);
+       fs_path, youngest);
 
   *locations_p = locations;
   return SVN_NO_ERROR;
@@ -517,13 +534,10 @@ svn_ra__location_segments_from_log(svn_r
   apr_array_header_t *targets;
   svn_node_kind_t kind;
   svn_revnum_t youngest_rev = SVN_INVALID_REVNUM;
-  const char *root_url, *url, *rel_path;
+  const char *fs_path;
 
-  /* Fetch the repository root URL and relative path. */
-  SVN_ERR(svn_ra_get_repos_root2(session, &root_url, pool));
-  SVN_ERR(svn_ra_get_session_url(session, &url, pool));
-  url = svn_path_join(url, path, pool);
-  rel_path = svn_path_uri_decode(url + strlen(root_url), pool);
+  /* Fetch the absolute FS path associated with PATH. */
+  SVN_ERR(get_fs_path(&fs_path, session, path, pool));
 
   /* If PEG_REVISION is invalid, it means HEAD.  If START_REV is
      invalid, it means HEAD.  If END_REV is SVN_INVALID_REVNUM, we'll
@@ -553,11 +567,11 @@ svn_ra__location_segments_from_log(svn_r
   if (kind == svn_node_none)
     return svn_error_createf(SVN_ERR_FS_NOT_FOUND, NULL,
                              _("Path '%s' doesn't exist in revision %ld"),
-                             rel_path, start_rev);
+                             fs_path, start_rev);
 
   /* Populate most of our log receiver baton structure. */
   lrb.kind = kind;
-  lrb.last_path = rel_path;
+  lrb.last_path = fs_path;
   lrb.done = FALSE;
   lrb.start_rev = start_rev;
   lrb.range_end = start_rev;
@@ -653,8 +667,7 @@ svn_ra__file_revs_from_log(svn_ra_sessio
                            apr_pool_t *pool)
 {
   svn_node_kind_t kind;
-  const char *repos_url;
-  const char *session_url;
+  const char *repos_url, *session_url, *fs_path;
   apr_array_header_t *condensed_targets;
   struct fr_log_message_baton lmb;
   struct rev *rev;
@@ -662,21 +675,19 @@ svn_ra__file_revs_from_log(svn_ra_sessio
   svn_stream_t *last_stream;
   apr_pool_t *currpool, *lastpool;
 
+  /* Fetch the absolute FS path associated with PATH. */
+  SVN_ERR(get_fs_path(&fs_path, ra_session, path, pool));
+
   /* Check to make sure we're dealing with a file. */
   SVN_ERR(svn_ra_check_path(ra_session, path, end, &kind, pool));
-
   if (kind == svn_node_dir)
     return svn_error_createf(SVN_ERR_FS_NOT_FILE, NULL,
-                             _("'%s' is not a file"), path);
-
-  SVN_ERR(svn_ra_get_repos_root2(ra_session, &repos_url, pool));
-  SVN_ERR(svn_ra_get_session_url(ra_session, &session_url, pool));
+                             _("'%s' is not a file"), fs_path);
 
   condensed_targets = apr_array_make(pool, 1, sizeof(const char *));
   APR_ARRAY_PUSH(condensed_targets, const char *) = path;
 
-  lmb.path = svn_fspath__canonicalize(svn_uri_is_child(repos_url, session_url,
-                                                       pool), pool);
+  lmb.path = fs_path;
   lmb.eldest = NULL;
   lmb.pool = pool;
 
@@ -691,6 +702,8 @@ svn_ra__file_revs_from_log(svn_ra_sessio
                           pool));
 
   /* Reparent the session while we go back through the history. */
+  SVN_ERR(svn_ra_get_session_url(ra_session, &session_url, pool));
+  SVN_ERR(svn_ra_get_repos_root2(ra_session, &repos_url, pool));
   SVN_ERR(svn_ra_reparent(ra_session, repos_url, pool));
 
   currpool = svn_pool_create(pool);
@@ -828,10 +841,11 @@ svn_ra__get_deleted_rev_from_log(svn_ra_
                                  svn_revnum_t *revision_deleted,
                                  apr_pool_t *pool)
 {
-  const char *session_url, *source_root_url, *rel_path_url, *abs_del_path;
+  const char *fs_path;
   log_path_del_rev_t log_path_deleted_baton;
 
-  SVN_ERR_ASSERT(*rel_deleted_path != '/');
+  /* Fetch the absolute FS path associated with PATH. */
+  SVN_ERR(get_fs_path(&fs_path, session, rel_deleted_path, pool));
 
   if (!SVN_IS_VALID_REVNUM(peg_revision))
     return svn_error_createf(SVN_ERR_CLIENT_BAD_REVISION, NULL,
@@ -843,12 +857,7 @@ svn_ra__get_deleted_rev_from_log(svn_ra_
     return svn_error_create(SVN_ERR_CLIENT_BAD_REVISION, NULL,
                             _("Peg revision must precede end revision"));
 
-  SVN_ERR(svn_ra_get_session_url(session, &session_url, pool));
-  SVN_ERR(svn_ra_get_repos_root2(session, &source_root_url, pool));
-  rel_path_url = svn_path_url_add_component2(session_url, rel_deleted_path,
-                                             pool);
-  abs_del_path = svn_path_uri_decode(rel_path_url + strlen(source_root_url), pool);
-  log_path_deleted_baton.path = abs_del_path;
+  log_path_deleted_baton.path = fs_path;
   log_path_deleted_baton.revision_deleted = SVN_INVALID_REVNUM;
 
   /* Examine the logs of SESSION's URL to find when DELETED_PATH was first

Modified: subversion/branches/ignore-mergeinfo-log/subversion/libsvn_ra_neon/commit.c
URL: http://svn.apache.org/viewvc/subversion/branches/ignore-mergeinfo-log/subversion/libsvn_ra_neon/commit.c?rev=1068059&r1=1068058&r2=1068059&view=diff
==============================================================================
--- subversion/branches/ignore-mergeinfo-log/subversion/libsvn_ra_neon/commit.c (original)
+++ subversion/branches/ignore-mergeinfo-log/subversion/libsvn_ra_neon/commit.c Mon Feb  7 19:18:29 2011
@@ -371,7 +371,7 @@ static svn_error_t * add_child(version_r
   rsrc->revision = revision;
   rsrc->name = name;
   rsrc->url = svn_path_url_add_component2(parent->url, name, pool);
-  rsrc->local_path = svn_path_join(parent->local_path, name, pool);
+  rsrc->local_path = svn_relpath_join(parent->local_path, name, pool);
 
   /* Case 1:  the resource is truly "new".  Either it was added as a
      completely new object, or implicitly created via a COPY.  Either
@@ -501,7 +501,7 @@ static svn_error_t * checkout_resource(c
         return svn_error_createf
           (err->apr_err, err,
            _("File or directory '%s' is out of date; try updating"),
-           svn_path_local_style(rsrc->local_path, pool));
+           svn_relpath_local_style(rsrc->local_path, pool));
       return err;
     }
 
@@ -682,7 +682,7 @@ static apr_hash_t *get_child_tokens(apr_
       svn_pool_clear(subpool);
       apr_hash_this(hi, &key, &klen, &val);
 
-      if (svn_path_is_child(dir, key, subpool))
+      if (svn_relpath_is_child(dir, key, subpool))
         apr_hash_set(tokens, key, klen, val);
     }
 

Modified: subversion/branches/ignore-mergeinfo-log/subversion/libsvn_ra_neon/fetch.c
URL: http://svn.apache.org/viewvc/subversion/branches/ignore-mergeinfo-log/subversion/libsvn_ra_neon/fetch.c?rev=1068059&r1=1068058&r2=1068059&view=diff
==============================================================================
--- subversion/branches/ignore-mergeinfo-log/subversion/libsvn_ra_neon/fetch.c (original)
+++ subversion/branches/ignore-mergeinfo-log/subversion/libsvn_ra_neon/fetch.c Mon Feb  7 19:18:29 2011
@@ -1997,8 +1997,8 @@ cdata_handler(void *userdata, int state,
             /* Short write without associated error?  "Can't happen." */
             return svn_error_createf(SVN_ERR_STREAM_UNEXPECTED_EOF, NULL,
                                      _("Error writing to '%s': unexpected EOF"),
-                                     svn_path_local_style(rb->namestr->data,
-                                                          rb->pool));
+                                     svn_relpath_local_style(rb->namestr->data,
+                                                             rb->pool));
           }
       }
       break;

Modified: subversion/branches/ignore-mergeinfo-log/subversion/libsvn_ra_neon/get_deleted_rev.c
URL: http://svn.apache.org/viewvc/subversion/branches/ignore-mergeinfo-log/subversion/libsvn_ra_neon/get_deleted_rev.c?rev=1068059&r1=1068058&r2=1068059&view=diff
==============================================================================
--- subversion/branches/ignore-mergeinfo-log/subversion/libsvn_ra_neon/get_deleted_rev.c (original)
+++ subversion/branches/ignore-mergeinfo-log/subversion/libsvn_ra_neon/get_deleted_rev.c Mon Feb  7 19:18:29 2011
@@ -137,8 +137,8 @@ svn_ra_neon__get_deleted_rev(svn_ra_sess
                                          ras, ras->url->data,
                                          peg_revision,
                                          pool));
-  final_bc_url = svn_path_url_add_component(bc_url.data, bc_relative.data,
-                                            pool);
+  final_bc_url = svn_path_url_add_component2(bc_url.data, bc_relative.data,
+                                             pool);
 
   body = apr_psprintf(pool,
                       "<?xml version=\"1.0\" encoding=\"utf-8\"?>"

Modified: subversion/branches/ignore-mergeinfo-log/subversion/libsvn_ra_neon/get_location_segments.c
URL: http://svn.apache.org/viewvc/subversion/branches/ignore-mergeinfo-log/subversion/libsvn_ra_neon/get_location_segments.c?rev=1068059&r1=1068058&r2=1068059&view=diff
==============================================================================
--- subversion/branches/ignore-mergeinfo-log/subversion/libsvn_ra_neon/get_location_segments.c (original)
+++ subversion/branches/ignore-mergeinfo-log/subversion/libsvn_ra_neon/get_location_segments.c Mon Feb  7 19:18:29 2011
@@ -194,7 +194,7 @@ svn_ra_neon__get_location_segments(svn_r
   SVN_ERR(svn_ra_neon__get_baseline_info(NULL, &bc_url, &bc_relative, NULL,
                                          ras, ras->url->data,
                                          peg_revision, subpool));
-  bc = svn_path_url_add_component(bc_url.data, bc_relative.data, subpool);
+  bc = svn_path_url_add_component2(bc_url.data, bc_relative.data, subpool);
 
   err = svn_ra_neon__parsed_request(ras, "REPORT", bc,
                                     request_body->data, NULL, NULL,

Modified: subversion/branches/ignore-mergeinfo-log/subversion/libsvn_ra_neon/merge.c
URL: http://svn.apache.org/viewvc/subversion/branches/ignore-mergeinfo-log/subversion/libsvn_ra_neon/merge.c?rev=1068059&r1=1068058&r2=1068059&view=diff
==============================================================================
--- subversion/branches/ignore-mergeinfo-log/subversion/libsvn_ra_neon/merge.c (original)
+++ subversion/branches/ignore-mergeinfo-log/subversion/libsvn_ra_neon/merge.c Mon Feb  7 19:18:29 2011
@@ -37,6 +37,8 @@
 #include "svn_xml.h"
 
 #include "private/svn_dav_protocol.h"
+#include "private/svn_fspath.h"
+
 #include "svn_private_config.h"
 
 #include "ra_neon.h"
@@ -257,7 +259,7 @@ static svn_error_t * handle_resource(mer
     }
 
   /* a collection or regular resource */
-  if (! svn_path_is_ancestor(mc->base_href, mc->href->data))
+  if (! svn_urlpath__is_ancestor(mc->base_href, mc->href->data))
     {
       /* ### need something better than APR_EGENERAL */
       return svn_error_createf(APR_EGENERAL, NULL,
@@ -267,7 +269,7 @@ static svn_error_t * handle_resource(mer
     }
 
   /* given HREF of the form: BASE "/" RELATIVE, extract the relative portion */
-  relative = svn_path_is_child(mc->base_href, mc->href->data, NULL);
+  relative = svn_urlpath__is_child(mc->base_href, mc->href->data, NULL);
   if (! relative) /* the paths are equal */
     relative = "";
 

Modified: subversion/branches/ignore-mergeinfo-log/subversion/libsvn_ra_neon/props.c
URL: http://svn.apache.org/viewvc/subversion/branches/ignore-mergeinfo-log/subversion/libsvn_ra_neon/props.c?rev=1068059&r1=1068058&r2=1068059&view=diff
==============================================================================
--- subversion/branches/ignore-mergeinfo-log/subversion/libsvn_ra_neon/props.c (original)
+++ subversion/branches/ignore-mergeinfo-log/subversion/libsvn_ra_neon/props.c Mon Feb  7 19:18:29 2011
@@ -710,26 +710,28 @@ svn_ra_neon__search_for_starting_props(s
   ne_uri_free(&parsed_url);
 
   /* Try to get the starting_props from the public url.  If the
-     resource no longer exists in HEAD, we'll get a failure.  That's
-     fine: just keep removing components and trying to get the
-     starting_props from parent directories. */
+     resource no longer exists in HEAD or is forbidden, we'll get a
+     failure.  That's fine: just keep removing components and trying
+     to get the starting_props from parent directories. */
   while (! svn_path_is_empty(path_s->data))
     {
       svn_pool_clear(iterpool);
       err = svn_ra_neon__get_starting_props(rsrc, sess, path_s->data,
                                             NULL, iterpool);
       if (! err)
-        break;   /* found an existing parent! */
+        break;   /* found an existing, readable parent! */
 
-      if (err->apr_err != SVN_ERR_FS_NOT_FOUND)
+      if ((err->apr_err != SVN_ERR_FS_NOT_FOUND) &&
+          (err->apr_err != SVN_ERR_RA_DAV_FORBIDDEN))
         return err;  /* found a _real_ error */
 
       /* else... lop off the basename and try again. */
       /* ### TODO: path_s is an absolute, schema-less URI, but
          ### technically not an FS_PATH. */
       svn_stringbuf_set(lopped_path,
-                        svn_path_join(svn_path_basename(path_s->data, iterpool),
-                                      lopped_path->data, iterpool));
+                        svn_relpath_join(svn_urlpath__basename(path_s->data,
+                                                               iterpool),
+                                         lopped_path->data, iterpool));
 
       len = path_s->len;
       svn_path_remove_component(path_s);
@@ -878,9 +880,9 @@ svn_error_t *svn_ra_neon__get_baseline_p
   /* don't forget to tack on the parts we lopped off in order to find
      the VCC...  We are expected to return a URI decoded relative
      path, so decode the lopped path first. */
-  my_bc_relative = svn_path_join(relative_path->data,
-                                 svn_path_uri_decode(lopped_path, pool),
-                                 pool);
+  my_bc_relative = svn_relpath_join(relative_path->data,
+                                    svn_path_uri_decode(lopped_path, pool),
+                                    pool);
 
   /* if they want the relative path (could be, they're just trying to find
      the baseline collection), then return it */

Modified: subversion/branches/ignore-mergeinfo-log/subversion/libsvn_ra_neon/util.c
URL: http://svn.apache.org/viewvc/subversion/branches/ignore-mergeinfo-log/subversion/libsvn_ra_neon/util.c?rev=1068059&r1=1068058&r2=1068059&view=diff
==============================================================================
--- subversion/branches/ignore-mergeinfo-log/subversion/libsvn_ra_neon/util.c (original)
+++ subversion/branches/ignore-mergeinfo-log/subversion/libsvn_ra_neon/util.c Mon Feb  7 19:18:29 2011
@@ -558,8 +558,12 @@ svn_ra_neon__copy_href(svn_stringbuf_t *
 
   apr_uri_t uri;
   apr_status_t apr_status;
+
   /* SRC can have trailing '/' */
-  src = svn_path_canonicalize(src, pool);
+  if (svn_path_is_url(src))
+    src = svn_uri_canonicalize(src, pool);
+  else
+    src = svn_urlpath__canonicalize(src, pool);
   apr_status = apr_uri_parse(pool, src, &uri);
 
   if (apr_status != APR_SUCCESS)
@@ -594,7 +598,7 @@ generate_error(svn_ra_neon__request_t *r
                                                req->url));
         case 403:
           return svn_error_create(SVN_ERR_RA_DAV_FORBIDDEN, NULL,
-                                  apr_psprintf(pool, _("access to '%s' forbidden"),
+                                  apr_psprintf(pool, _("Access to '%s' forbidden"),
                                                req->url));
 
         case 301:

Modified: subversion/branches/ignore-mergeinfo-log/subversion/libsvn_ra_serf/util.c
URL: http://svn.apache.org/viewvc/subversion/branches/ignore-mergeinfo-log/subversion/libsvn_ra_serf/util.c?rev=1068059&r1=1068058&r2=1068059&view=diff
==============================================================================
--- subversion/branches/ignore-mergeinfo-log/subversion/libsvn_ra_serf/util.c (original)
+++ subversion/branches/ignore-mergeinfo-log/subversion/libsvn_ra_serf/util.c Mon Feb  7 19:18:29 2011
@@ -1792,7 +1792,8 @@ svn_ra_serf__discover_vcc(const char **v
         }
       else
         {
-          if (err->apr_err != SVN_ERR_FS_NOT_FOUND)
+          if ((err->apr_err != SVN_ERR_FS_NOT_FOUND) &&
+              (err->apr_err != SVN_ERR_RA_DAV_FORBIDDEN))
             {
               return err;  /* found a _real_ error */
             }
@@ -1803,16 +1804,23 @@ svn_ra_serf__discover_vcc(const char **v
 
               /* Okay, strip off a component from PATH. */
               path = svn_urlpath__dirname(path, pool);
+
+#if SERF_VERSION_AT_LEAST(0, 4, 0)
+              /* An error occurred on conns. serf 0.4.0 remembers that
+                 the connection had a problem. We need to reset it, in
+                 order to use it again.  */
+              serf_connection_reset(conn->conn);
+#endif
             }
         }
     }
   while ((path[0] != '\0')
-         && (! (path[0] == '/') && (path[1] == '\0')));
+         && (! (path[0] == '/' && path[1] == '\0')));
 
   if (!*vcc_url)
     {
       return svn_error_create(SVN_ERR_RA_DAV_OPTIONS_REQ_FAILED, NULL,
-                              _("The OPTIONS response did not include the "
+                              _("The PROPFIND response did not include the "
                                 "requested version-controlled-configuration "
                                 "value"));
     }
@@ -1924,6 +1932,10 @@ svn_ra_serf__error_on_status(int status_
                                      " please relocate")
                                  : _("Repository moved temporarily to '%s';"
                                      " please relocate"), location);
+      case 403:
+        return svn_error_createf(SVN_ERR_RA_DAV_FORBIDDEN, NULL,
+                                 _("Access to '%s' forbidden"), path);
+
       case 404:
         return svn_error_createf(SVN_ERR_FS_NOT_FOUND, NULL,
                                  _("'%s' path not found"), path);

Modified: subversion/branches/ignore-mergeinfo-log/subversion/libsvn_repos/authz.c
URL: http://svn.apache.org/viewvc/subversion/branches/ignore-mergeinfo-log/subversion/libsvn_repos/authz.c?rev=1068059&r1=1068058&r2=1068059&view=diff
==============================================================================
--- subversion/branches/ignore-mergeinfo-log/subversion/libsvn_repos/authz.c (original)
+++ subversion/branches/ignore-mergeinfo-log/subversion/libsvn_repos/authz.c Mon Feb  7 19:18:29 2011
@@ -33,6 +33,7 @@
 #include "svn_repos.h"
 #include "svn_config.h"
 #include "svn_ctype.h"
+#include "private/svn_fspath.h"
 
 
 /*** Structures. ***/
@@ -56,9 +57,9 @@ struct authz_lookup_baton {
 
   /* The following are used exclusively in recursive lookups. */
 
-  /* The path in the repository to authorize. */
+  /* The path in the repository (an fspath) to authorize. */
   const char *repos_path;
-  /* repos_path prefixed by the repository name. */
+  /* repos_path prefixed by the repository name and a colon. */
   const char *qualified_repos_path;
 
   /* Whether, at the end of a recursive lookup, access is granted. */
@@ -275,6 +276,23 @@ authz_parse_line(const char *name, const
 }
 
 
+/* Return TRUE iff the access rules in SECTION_NAME apply to PATH_SPEC
+ * (which is a repository name, colon, and repository fspath, such as
+ * "myrepos:/trunk/foo").
+ */
+static svn_boolean_t
+is_applicable_section(const char *path_spec,
+                      const char *section_name)
+{
+  apr_size_t path_spec_len = strlen(path_spec);
+
+  return ((strncmp(path_spec, section_name, path_spec_len) == 0)
+          && (path_spec[path_spec_len - 1] == '/'
+              || section_name[path_spec_len] == '/'
+              || section_name[path_spec_len] == '\0'));
+}
+
+
 /* Callback to parse a section and update the authz_baton if the
  * section denies access to the subtree the baton describes.
  */
@@ -285,10 +303,10 @@ authz_parse_section(const char *section_
   svn_boolean_t conclusive;
 
   /* Does the section apply to us? */
-  if (svn_path_is_ancestor(b->qualified_repos_path,
-                           section_name) == FALSE
-      && svn_path_is_ancestor(b->repos_path,
-                              section_name) == FALSE)
+  if (is_applicable_section(b->qualified_repos_path,
+                            section_name) == FALSE
+      && is_applicable_section(b->repos_path,
+                               section_name) == FALSE)
     return TRUE;
 
   /* Work out what this section grants. */
@@ -398,8 +416,8 @@ authz_get_any_access_parser_cb(const cha
 
   /* Does the section apply to the query? */
   if (section_name[0] == '/'
-      || strncmp(section_name, b->repos_path,
-                 strlen(b->repos_path)) == 0)
+      || strncmp(section_name, b->qualified_repos_path,
+                 strlen(b->qualified_repos_path)) == 0)
     {
       b->allow = b->deny = svn_authz_none;
 
@@ -433,7 +451,9 @@ authz_get_any_access(svn_config_t *cfg, 
   baton.user = user;
   baton.required_access = required_access;
   baton.access = FALSE; /* Deny access by default. */
-  baton.repos_path = apr_pstrcat(pool, repos_name, ":/", (char *)NULL);
+  baton.repos_path = "/";
+  baton.qualified_repos_path = apr_pstrcat(pool, repos_name,
+                                           ":/", (char *)NULL);
   
   /* We could have used svn_config_enumerate2 for "repos_name:/".
    * However, this requires access for root explicitly (which the user
@@ -746,18 +766,20 @@ svn_repos_authz_check_access(svn_authz_t
                              svn_boolean_t *access_granted,
                              apr_pool_t *pool)
 {
-  const char *current_path = path;
+  const char *current_path;
 
   /* If PATH is NULL, check if the user has *any* access. */
   if (!path)
     {
       *access_granted = authz_get_any_access(authz->cfg, repos_name,
-                                             user, required_access,
-                                             pool);
+                                             user, required_access, pool);
       return SVN_NO_ERROR;
     }
 
   /* Determine the granted access for the requested path. */
+  path = svn_fspath__canonicalize(path, pool);
+  current_path = path;
+  
   while (!authz_get_path_access(authz->cfg, repos_name,
                                 current_path, user,
                                 required_access,
@@ -774,7 +796,7 @@ svn_repos_authz_check_access(svn_authz_t
         }
 
       /* Work back to the parent path. */
-      current_path = svn_dirent_dirname(current_path, pool);
+      current_path = svn_fspath__dirname(current_path, pool);
     }
 
   /* If the caller requested recursive access, we need to walk through

Modified: subversion/branches/ignore-mergeinfo-log/subversion/libsvn_repos/commit.c
URL: http://svn.apache.org/viewvc/subversion/branches/ignore-mergeinfo-log/subversion/libsvn_repos/commit.c?rev=1068059&r1=1068058&r2=1068059&view=diff
==============================================================================
--- subversion/branches/ignore-mergeinfo-log/subversion/libsvn_repos/commit.c (original)
+++ subversion/branches/ignore-mergeinfo-log/subversion/libsvn_repos/commit.c Mon Feb  7 19:18:29 2011
@@ -38,6 +38,7 @@
 #include "svn_props.h"
 #include "repos.h"
 #include "svn_private_config.h"
+#include "private/svn_fspath.h"
 #include "private/svn_repos_private.h"
 
 
@@ -165,6 +166,147 @@ check_authz(struct edit_baton *editor_ba
   return SVN_NO_ERROR;
 }
 
+
+/* Return a directory baton allocated in POOL which represents
+   FULL_PATH, which is the immediate directory child of the directory
+   represented by PARENT_BATON.  EDIT_BATON is the commit editor
+   baton.  WAS_COPIED reveals whether or not this directory is the
+   result of a copy operation.  BASE_REVISION is the base revision of
+   the directory. */
+static struct dir_baton *
+make_dir_baton(struct edit_baton *edit_baton,
+               struct dir_baton *parent_baton,
+               const char *full_path,
+               svn_boolean_t was_copied,
+               svn_revnum_t base_revision,
+               apr_pool_t *pool)
+{
+  struct dir_baton *db;
+  db = apr_pcalloc(pool, sizeof(*db));
+  db->edit_baton = edit_baton;
+  db->parent = parent_baton;
+  db->pool = pool;
+  db->path = full_path;
+  db->was_copied = was_copied;
+  db->base_rev = base_revision;
+  return db;
+}
+
+
+/* This function is the shared guts of add_file() and add_directory(),
+   which see for the meanings of the parameters.  The only extra
+   parameter here is IS_DIR, which is TRUE when adding a directory,
+   and FALSE when adding a file.  */
+static svn_error_t *
+add_file_or_directory(const char *path,
+                      void *parent_baton,
+                      const char *copy_path,
+                      svn_revnum_t copy_revision,
+                      svn_boolean_t is_dir,
+                      apr_pool_t *pool,
+                      void **return_baton)
+{
+  struct dir_baton *pb = parent_baton;
+  struct edit_baton *eb = pb->edit_baton;
+  apr_pool_t *subpool = svn_pool_create(pool);
+  svn_boolean_t was_copied = FALSE;
+  const char *full_path;
+
+  full_path = svn_fspath__join(eb->base_path,
+                               svn_relpath_canonicalize(path, pool), pool);
+
+  /* Sanity check. */
+  if (copy_path && (! SVN_IS_VALID_REVNUM(copy_revision)))
+    return svn_error_createf
+      (SVN_ERR_FS_GENERAL, NULL,
+       _("Got source path but no source revision for '%s'"), full_path);
+
+  if (copy_path)
+    {
+      const char *fs_path;
+      svn_fs_root_t *copy_root;
+      svn_node_kind_t kind;
+      size_t repos_url_len;
+      svn_repos_authz_access_t required;
+
+      /* Copy requires recursive write access to the destination path
+         and write access to the parent path. */
+      required = svn_authz_write | (is_dir ? svn_authz_recursive : 0);
+      SVN_ERR(check_authz(eb, full_path, eb->txn_root,
+                          required, subpool));
+      SVN_ERR(check_authz(eb, pb->path, eb->txn_root,
+                          svn_authz_write, subpool));
+
+      /* Check PATH in our transaction.  Make sure it does not exist
+         unless its parent directory was copied (in which case, the
+         thing might have been copied in as well), else return an
+         out-of-dateness error. */
+      SVN_ERR(svn_fs_check_path(&kind, eb->txn_root, full_path, subpool));
+      if ((kind != svn_node_none) && (! pb->was_copied))
+        return out_of_date(full_path, kind);
+
+      /* For now, require that the url come from the same repository
+         that this commit is operating on. */
+      copy_path = svn_path_uri_decode(copy_path, subpool);
+      repos_url_len = strlen(eb->repos_url);
+      if (strncmp(copy_path, eb->repos_url, repos_url_len) != 0)
+        return svn_error_createf
+          (SVN_ERR_FS_GENERAL, NULL,
+           _("Source url '%s' is from different repository"), copy_path);
+
+      fs_path = apr_pstrdup(subpool, copy_path + repos_url_len);
+
+      /* Now use the "fs_path" as an absolute path within the
+         repository to make the copy from. */
+      SVN_ERR(svn_fs_revision_root(&copy_root, eb->fs,
+                                   copy_revision, subpool));
+
+      /* Copy also requires (recursive) read access to the source */
+      required = svn_authz_read | (is_dir ? svn_authz_recursive : 0);
+      SVN_ERR(check_authz(eb, fs_path, copy_root, required, subpool));
+
+      SVN_ERR(svn_fs_copy(copy_root, fs_path,
+                          eb->txn_root, full_path, subpool));
+      was_copied = TRUE;
+    }
+  else
+    {
+      /* No ancestry given, just make a new directory or empty file.
+         Note that we don't perform an existence check here like the
+         copy-from case does -- that's because svn_fs_make_*()
+         already errors out if the file already exists.  Verify write
+         access to the full path and to the parent. */
+      SVN_ERR(check_authz(eb, full_path, eb->txn_root,
+                          svn_authz_write, subpool));
+      SVN_ERR(check_authz(eb, pb->path, eb->txn_root,
+                          svn_authz_write, subpool));
+      if (is_dir)
+        SVN_ERR(svn_fs_make_dir(eb->txn_root, full_path, subpool));
+      else
+        SVN_ERR(svn_fs_make_file(eb->txn_root, full_path, subpool));
+    }
+
+  /* Cleanup our temporary subpool. */
+  svn_pool_destroy(subpool);
+
+  /* Build a new child baton. */
+  if (is_dir)
+    {
+      *return_baton = make_dir_baton(eb, pb, full_path, was_copied,
+                                     SVN_INVALID_REVNUM, pool);
+    }
+  else
+    {
+      struct file_baton *new_fb = apr_pcalloc(pool, sizeof(*new_fb));
+      new_fb->edit_baton = eb;
+      new_fb->path = full_path;
+      *return_baton = new_fb;
+    }
+
+  return SVN_NO_ERROR;
+}
+
+
 
 /*** Editor functions ***/
 
@@ -231,7 +373,10 @@ delete_entry(const char *path,
   svn_node_kind_t kind;
   svn_revnum_t cr_rev;
   svn_repos_authz_access_t required = svn_authz_write;
-  const char *full_path = svn_path_join(eb->base_path, path, pool);
+  const char *full_path;
+
+  full_path = svn_fspath__join(eb->base_path,
+                               svn_relpath_canonicalize(path, pool), pool);
 
   /* Check PATH in our transaction.  */
   SVN_ERR(svn_fs_check_path(&kind, eb->txn_root, full_path, pool));
@@ -262,26 +407,6 @@ delete_entry(const char *path,
 }
 
 
-static struct dir_baton *
-make_dir_baton(struct edit_baton *edit_baton,
-               struct dir_baton *parent_baton,
-               const char *full_path,
-               svn_boolean_t was_copied,
-               svn_revnum_t base_revision,
-               apr_pool_t *pool)
-{
-  struct dir_baton *db;
-  db = apr_pcalloc(pool, sizeof(*db));
-  db->edit_baton = edit_baton;
-  db->parent = parent_baton;
-  db->pool = pool;
-  db->path = full_path;
-  db->was_copied = was_copied;
-  db->base_rev = base_revision;
-  return db;
-}
-
-
 static svn_error_t *
 add_directory(const char *path,
               void *parent_baton,
@@ -290,88 +415,8 @@ add_directory(const char *path,
               apr_pool_t *pool,
               void **child_baton)
 {
-  struct dir_baton *pb = parent_baton;
-  struct edit_baton *eb = pb->edit_baton;
-  const char *full_path = svn_path_join(eb->base_path, path, pool);
-  apr_pool_t *subpool = svn_pool_create(pool);
-  svn_boolean_t was_copied = FALSE;
-
-  /* Sanity check. */
-  if (copy_path && (! SVN_IS_VALID_REVNUM(copy_revision)))
-    return svn_error_createf
-      (SVN_ERR_FS_GENERAL, NULL,
-       _("Got source path but no source revision for '%s'"), full_path);
-
-  if (copy_path)
-    {
-      const char *fs_path;
-      svn_fs_root_t *copy_root;
-      svn_node_kind_t kind;
-      size_t repos_url_len;
-
-      /* Copy requires recursive write access to the destination path
-         and write access to the parent path. */
-      SVN_ERR(check_authz(eb, full_path, eb->txn_root,
-                          svn_authz_write | svn_authz_recursive,
-                          subpool));
-      SVN_ERR(check_authz(eb, pb->path, eb->txn_root,
-                          svn_authz_write, subpool));
-
-      /* Check PATH in our transaction.  Make sure it does not exist
-         unless its parent directory was copied (in which case, the
-         thing might have been copied in as well), else return an
-         out-of-dateness error. */
-      SVN_ERR(svn_fs_check_path(&kind, eb->txn_root, full_path, subpool));
-      if ((kind != svn_node_none) && (! pb->was_copied))
-        return out_of_date(full_path, kind);
-
-      /* For now, require that the url come from the same repository
-         that this commit is operating on. */
-      copy_path = svn_path_uri_decode(copy_path, subpool);
-      repos_url_len = strlen(eb->repos_url);
-      if (strncmp(copy_path, eb->repos_url, repos_url_len) != 0)
-        return svn_error_createf
-          (SVN_ERR_FS_GENERAL, NULL,
-           _("Source url '%s' is from different repository"), copy_path);
-
-      fs_path = apr_pstrdup(subpool, copy_path + repos_url_len);
-
-      /* Now use the "fs_path" as an absolute path within the
-         repository to make the copy from. */
-      SVN_ERR(svn_fs_revision_root(&copy_root, eb->fs,
-                                   copy_revision, subpool));
-
-      /* Copy also requires recursive read access to the source
-         path. */
-      SVN_ERR(check_authz(eb, fs_path, copy_root,
-                          svn_authz_read | svn_authz_recursive,
-                          subpool));
-
-      SVN_ERR(svn_fs_copy(copy_root, fs_path,
-                          eb->txn_root, full_path, subpool));
-      was_copied = TRUE;
-    }
-  else
-    {
-      /* No ancestry given, just make a new directory.  We don't
-         bother with an out-of-dateness check here because
-         svn_fs_make_dir will error out if PATH already exists.
-         Verify write access to the full path and the parent
-         directory. */
-      SVN_ERR(check_authz(eb, full_path, eb->txn_root,
-                          svn_authz_write, subpool));
-      SVN_ERR(check_authz(eb, pb->path, eb->txn_root,
-                          svn_authz_write, subpool));
-      SVN_ERR(svn_fs_make_dir(eb->txn_root, full_path, subpool));
-    }
-
-  /* Cleanup our temporary subpool. */
-  svn_pool_destroy(subpool);
-
-  /* Build a new dir baton for this directory. */
-  *child_baton = make_dir_baton(eb, pb, full_path, was_copied,
-                                SVN_INVALID_REVNUM, pool);
-  return SVN_NO_ERROR;
+  return add_file_or_directory(path, parent_baton, copy_path, copy_revision,
+                               TRUE /* is_dir */, pool, child_baton);
 }
 
 
@@ -385,7 +430,10 @@ open_directory(const char *path,
   struct dir_baton *pb = parent_baton;
   struct edit_baton *eb = pb->edit_baton;
   svn_node_kind_t kind;
-  const char *full_path = svn_path_join(eb->base_path, path, pool);
+  const char *full_path;
+
+  full_path = svn_fspath__join(eb->base_path,
+                               svn_relpath_canonicalize(path, pool), pool);
 
   /* Check PATH in our transaction.  If it does not exist,
      return a 'Path not present' error. */
@@ -425,8 +473,6 @@ apply_textdelta(void *file_baton,
 }
 
 
-
-
 static svn_error_t *
 add_file(const char *path,
          void *parent_baton,
@@ -435,92 +481,11 @@ add_file(const char *path,
          apr_pool_t *pool,
          void **file_baton)
 {
-  struct file_baton *new_fb;
-  struct dir_baton *pb = parent_baton;
-  struct edit_baton *eb = pb->edit_baton;
-  const char *full_path = svn_path_join(eb->base_path, path, pool);
-  apr_pool_t *subpool = svn_pool_create(pool);
-
-  /* Sanity check. */
-  if (copy_path && (! SVN_IS_VALID_REVNUM(copy_revision)))
-    return svn_error_createf
-      (SVN_ERR_FS_GENERAL, NULL,
-       _("Got source path but no source revision for '%s'"), full_path);
-
-  if (copy_path)
-    {
-      const char *fs_path;
-      svn_fs_root_t *copy_root;
-      svn_node_kind_t kind;
-      size_t repos_url_len;
-
-      /* Copy requires recursive write to the destination path and
-         parent path. */
-      SVN_ERR(check_authz(eb, full_path, eb->txn_root,
-                          svn_authz_write, subpool));
-      SVN_ERR(check_authz(eb, pb->path, eb->txn_root,
-                          svn_authz_write, subpool));
-
-      /* Check PATH in our transaction.  Make sure it does not exist
-         unless its parent directory was copied (in which case, the
-         thing might have been copied in as well), else return an
-         out-of-dateness error. */
-      SVN_ERR(svn_fs_check_path(&kind, eb->txn_root, full_path, subpool));
-      if ((kind != svn_node_none) && (! pb->was_copied))
-        return out_of_date(full_path, kind);
-
-      /* For now, require that the url come from the same repository
-         that this commit is operating on. */
-      copy_path = svn_path_uri_decode(copy_path, subpool);
-      repos_url_len = strlen(eb->repos_url);
-      if (strncmp(copy_path, eb->repos_url, repos_url_len) != 0)
-            return svn_error_createf
-              (SVN_ERR_FS_GENERAL, NULL,
-               _("Source url '%s' is from different repository"), copy_path);
-
-      fs_path = apr_pstrdup(subpool, copy_path + repos_url_len);
-
-      /* Now use the "fs_path" as an absolute path within the
-         repository to make the copy from. */
-      SVN_ERR(svn_fs_revision_root(&copy_root, eb->fs,
-                                   copy_revision, subpool));
-
-      /* Copy also requires read access to the source */
-      SVN_ERR(check_authz(eb, fs_path, copy_root,
-                          svn_authz_read, subpool));
-
-      SVN_ERR(svn_fs_copy(copy_root, fs_path,
-                          eb->txn_root, full_path, subpool));
-    }
-  else
-    {
-      /* No ancestry given, just make a new, empty file.  Note that we
-         don't perform an existence check here like the copy-from case
-         does -- that's because svn_fs_make_file() already errors out
-         if the file already exists.  Verify write access to the full
-         path and to the parent. */
-      SVN_ERR(check_authz(eb, full_path, eb->txn_root, svn_authz_write,
-                          subpool));
-      SVN_ERR(check_authz(eb, pb->path, eb->txn_root, svn_authz_write,
-                          subpool));
-      SVN_ERR(svn_fs_make_file(eb->txn_root, full_path, subpool));
-    }
-
-  /* Cleanup our temporary subpool. */
-  svn_pool_destroy(subpool);
-
-  /* Build a new file baton */
-  new_fb = apr_pcalloc(pool, sizeof(*new_fb));
-  new_fb->edit_baton = eb;
-  new_fb->path = full_path;
-
-  *file_baton = new_fb;
-  return SVN_NO_ERROR;
+  return add_file_or_directory(path, parent_baton, copy_path, copy_revision,
+                               FALSE /* is_dir */, pool, file_baton);
 }
 
 
-
-
 static svn_error_t *
 open_file(const char *path,
           void *parent_baton,
@@ -533,7 +498,10 @@ open_file(const char *path,
   struct edit_baton *eb = pb->edit_baton;
   svn_revnum_t cr_rev;
   apr_pool_t *subpool = svn_pool_create(pool);
-  const char *full_path = svn_path_join(eb->base_path, path, pool);
+  const char *full_path;
+
+  full_path = svn_fspath__join(eb->base_path,
+                               svn_relpath_canonicalize(path, pool), pool);
 
   /* Check for read authorization. */
   SVN_ERR(check_authz(eb, full_path, eb->txn_root,
@@ -873,7 +841,7 @@ svn_repos_get_commit_editor5(const svn_d
   eb->commit_callback_baton = callback_baton;
   eb->authz_callback = authz_callback;
   eb->authz_baton = authz_baton;
-  eb->base_path = apr_pstrdup(subpool, base_path);
+  eb->base_path = svn_fspath__canonicalize(base_path, subpool);
   eb->repos = repos;
   eb->repos_url = repos_url;
   eb->repos_name = svn_dirent_basename(svn_repos_path(repos, subpool),

Modified: subversion/branches/ignore-mergeinfo-log/subversion/libsvn_repos/delta.c
URL: http://svn.apache.org/viewvc/subversion/branches/ignore-mergeinfo-log/subversion/libsvn_repos/delta.c?rev=1068059&r1=1068058&r2=1068059&view=diff
==============================================================================
--- subversion/branches/ignore-mergeinfo-log/subversion/libsvn_repos/delta.c (original)
+++ subversion/branches/ignore-mergeinfo-log/subversion/libsvn_repos/delta.c Mon Feb  7 19:18:29 2011
@@ -233,11 +233,15 @@ svn_repos_dir_delta2(svn_fs_root_t *src_
   const char *authz_root_path;
 
   /* SRC_PARENT_DIR must be valid. */
-  if (! src_parent_dir)
+  if (src_parent_dir)
+    src_parent_dir = svn_relpath_canonicalize(src_parent_dir, pool);
+  else
     return not_a_dir_error("source parent", src_parent_dir);
 
   /* TGT_FULLPATH must be valid. */
-  if (! tgt_fullpath)
+  if (tgt_fullpath)
+    tgt_fullpath = svn_relpath_canonicalize(tgt_fullpath, pool);
+  else
     return svn_error_create(SVN_ERR_FS_PATH_SYNTAX, 0,
                             _("Invalid target path"));
 
@@ -248,12 +252,12 @@ svn_repos_dir_delta2(svn_fs_root_t *src_
   /* Calculate the fs path implicitly used for editor->open_root, so
      we can do an authz check on that path first. */
   if (*src_entry)
-    authz_root_path = svn_dirent_dirname(tgt_fullpath, pool);
+    authz_root_path = svn_relpath_dirname(tgt_fullpath, pool);
   else
     authz_root_path = tgt_fullpath;
 
   /* Construct the full path of the source item. */
-  src_fullpath = svn_path_join(src_parent_dir, src_entry, pool);
+  src_fullpath = svn_relpath_join(src_parent_dir, src_entry, pool);
 
   /* Get the node kinds for the source and target paths.  */
   SVN_ERR(svn_fs_check_path(&tgt_kind, tgt_root, tgt_fullpath, pool));
@@ -958,8 +962,8 @@ delta_dirs(struct context *c,
       apr_hash_this(hi, &key, &klen, &val);
       t_entry = val;
       tgt_kind = t_entry->kind;
-      t_fullpath = svn_path_join(target_path, t_entry->name, subpool);
-      e_fullpath = svn_path_join(edit_path, t_entry->name, subpool);
+      t_fullpath = svn_relpath_join(target_path, t_entry->name, subpool);
+      e_fullpath = svn_relpath_join(edit_path, t_entry->name, subpool);
 
       /* Can we find something with the same name in the source
          entries hash? */
@@ -967,7 +971,7 @@ delta_dirs(struct context *c,
         {
           svn_node_kind_t src_kind;
 
-          s_fullpath = svn_path_join(source_path, t_entry->name, subpool);
+          s_fullpath = svn_relpath_join(source_path, t_entry->name, subpool);
           src_kind = s_entry->kind;
 
           if (depth == svn_depth_infinity
@@ -1043,7 +1047,7 @@ delta_dirs(struct context *c,
           apr_hash_this(hi, NULL, NULL, &val);
           s_entry = val;
           src_kind = s_entry->kind;
-          e_fullpath = svn_path_join(edit_path, s_entry->name, subpool);
+          e_fullpath = svn_relpath_join(edit_path, s_entry->name, subpool);
 
           /* Do we actually want to delete the dir if we're non-recursive? */
           if (depth == svn_depth_infinity

Modified: subversion/branches/ignore-mergeinfo-log/subversion/libsvn_repos/dump.c
URL: http://svn.apache.org/viewvc/subversion/branches/ignore-mergeinfo-log/subversion/libsvn_repos/dump.c?rev=1068059&r1=1068058&r2=1068059&view=diff
==============================================================================
--- subversion/branches/ignore-mergeinfo-log/subversion/libsvn_repos/dump.c (original)
+++ subversion/branches/ignore-mergeinfo-log/subversion/libsvn_repos/dump.c Mon Feb  7 19:18:29 2011
@@ -89,8 +89,8 @@ store_delta(apr_file_t **tempfile, svn_f
 
 struct edit_baton
 {
-  /* The path which implicitly prepends all full paths coming into
-     this editor.  This will almost always be "" or "/".  */
+  /* The relpath which implicitly prepends all full paths coming into
+     this editor.  This will almost always be "".  */
   const char *path;
 
   /* The stream to dump to. */
@@ -137,13 +137,13 @@ struct dir_baton
   /* has this directory been written to the output stream? */
   svn_boolean_t written_out;
 
-  /* the absolute path to this directory */
+  /* the repository relpath associated with this directory */
   const char *path;
 
-  /* the comparison path and revision of this directory.  if both of
-     these are valid, use them as a source against which to compare
-     the directory instead of the default comparison source of PATH in
-     the previous revision. */
+  /* The comparison repository relpath and revision of this directory.
+     If both of these are valid, use them as a source against which to
+     compare the directory instead of the default comparison source of
+     PATH in the previous revision. */
   const char *cmp_path;
   svn_revnum_t cmp_rev;
 
@@ -189,18 +189,18 @@ make_dir_baton(const char *path,
 
   /* Construct the full path of this node. */
   if (pb)
-    full_path = svn_path_join(eb->path, path, pool);
+    full_path = svn_relpath_join(eb->path, path, pool);
   else
     full_path = apr_pstrdup(pool, eb->path);
 
   /* Remove leading slashes from copyfrom paths. */
   if (cmp_path)
-    cmp_path = ((*cmp_path == '/') ? cmp_path + 1 : cmp_path);
+    cmp_path = svn_relpath_canonicalize(cmp_path, pool);
 
   new_db->edit_baton = eb;
   new_db->parent_dir_baton = pb;
   new_db->path = full_path;
-  new_db->cmp_path = cmp_path ? apr_pstrdup(pool, cmp_path) : NULL;
+  new_db->cmp_path = cmp_path;
   new_db->cmp_rev = cmp_rev;
   new_db->added = added;
   new_db->written_out = FALSE;
@@ -225,7 +225,7 @@ make_dir_baton(const char *path,
   */
 static svn_error_t *
 dump_node(struct edit_baton *eb,
-          const char *path,    /* an absolute path. */
+          const char *path,
           svn_node_kind_t kind,
           enum svn_node_action action,
           svn_boolean_t is_copy,
@@ -245,7 +245,7 @@ dump_node(struct edit_baton *eb,
   /* Write out metadata headers for this file node. */
   SVN_ERR(svn_stream_printf(eb->stream, pool,
                             SVN_REPOS_DUMPFILE_NODE_PATH ": %s\n",
-                            (*path == '/') ? path + 1 : path));
+                            path));
   if (kind == svn_node_file)
     SVN_ERR(svn_stream_printf(eb->stream, pool,
                               SVN_REPOS_DUMPFILE_NODE_KIND ": file\n"));
@@ -255,7 +255,7 @@ dump_node(struct edit_baton *eb,
 
   /* Remove leading slashes from copyfrom paths. */
   if (cmp_path)
-    cmp_path = ((*cmp_path == '/') ? cmp_path + 1 : cmp_path);
+    cmp_path = svn_relpath_canonicalize(cmp_path, pool);
 
   /* Validate the comparison path/rev. */
   if (ARE_VALID_COPY_ARGS(cmp_path, cmp_rev))
@@ -682,8 +682,8 @@ open_directory(const char *path,
      record the same for this one. */
   if (pb && ARE_VALID_COPY_ARGS(pb->cmp_path, pb->cmp_rev))
     {
-      cmp_path = svn_path_join(pb->cmp_path,
-                               svn_dirent_basename(path, pool), pool);
+      cmp_path = svn_relpath_join(pb->cmp_path,
+                                  svn_relpath_basename(path, pool), pool);
       cmp_rev = pb->cmp_rev;
     }
 
@@ -779,8 +779,8 @@ open_file(const char *path,
      record the same for this one. */
   if (pb && ARE_VALID_COPY_ARGS(pb->cmp_path, pb->cmp_rev))
     {
-      cmp_path = svn_path_join(pb->cmp_path,
-                               svn_dirent_basename(path, pool), pool);
+      cmp_path = svn_relpath_join(pb->cmp_path,
+                                  svn_relpath_basename(path, pool), pool);
       cmp_rev = pb->cmp_rev;
     }
 
@@ -1059,7 +1059,7 @@ svn_repos_dump_fs3(svn_repos_t *repos,
          non-incremental dump. */
       use_deltas_for_rev = use_deltas && (incremental || i != start_rev);
       SVN_ERR(get_dump_editor(&dump_editor, &dump_edit_baton, fs, to_rev,
-                              "/", stream, notify_func, notify_baton,
+                              "", stream, notify_func, notify_baton,
                               start_rev, use_deltas_for_rev, FALSE, subpool));
 
       /* Drive the editor in one way or another. */
@@ -1072,8 +1072,8 @@ svn_repos_dump_fs3(svn_repos_t *repos,
         {
           svn_fs_root_t *from_root;
           SVN_ERR(svn_fs_revision_root(&from_root, fs, from_rev, subpool));
-          SVN_ERR(svn_repos_dir_delta2(from_root, "/", "",
-                                       to_root, "/",
+          SVN_ERR(svn_repos_dir_delta2(from_root, "", "",
+                                       to_root, "",
                                        dump_editor, dump_edit_baton,
                                        NULL,
                                        NULL,
@@ -1166,7 +1166,7 @@ verify_directory_entry(void *baton, cons
                        void *val, apr_pool_t *pool)
 {
   struct dir_baton *db = baton;
-  char *path = svn_path_join(db->path, (const char *)key, pool);
+  char *path = svn_relpath_join(db->path, (const char *)key, pool);
   svn_node_kind_t kind;
   apr_hash_t *dirents;
   svn_filesize_t len;