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 2010/12/10 22:23:13 UTC

svn commit: r1044516 [10/22] - in /subversion/branches/ignore-mergeinfo: ./ build/ac-macros/ build/generator/ contrib/server-side/ notes/ notes/wc-ng/ subversion/bindings/javahl/native/ subversion/bindings/javahl/src/org/apache/subversion/javahl/ subve...

Modified: subversion/branches/ignore-mergeinfo/subversion/libsvn_subr/constructors.c
URL: http://svn.apache.org/viewvc/subversion/branches/ignore-mergeinfo/subversion/libsvn_subr/constructors.c?rev=1044516&r1=1044515&r2=1044516&view=diff
==============================================================================
--- subversion/branches/ignore-mergeinfo/subversion/libsvn_subr/constructors.c (original)
+++ subversion/branches/ignore-mergeinfo/subversion/libsvn_subr/constructors.c Fri Dec 10 21:23:03 2010
@@ -54,6 +54,8 @@ svn_commit_info_dup(const svn_commit_inf
   dst_commit_info->revision = src_commit_info->revision;
   dst_commit_info->post_commit_err = src_commit_info->post_commit_err
     ? apr_pstrdup(pool, src_commit_info->post_commit_err) : NULL;
+  dst_commit_info->repos_root = src_commit_info->repos_root
+    ? apr_pstrdup(pool, src_commit_info->repos_root) : NULL;
 
   return dst_commit_info;
 }

Modified: subversion/branches/ignore-mergeinfo/subversion/libsvn_subr/dirent_uri.c
URL: http://svn.apache.org/viewvc/subversion/branches/ignore-mergeinfo/subversion/libsvn_subr/dirent_uri.c?rev=1044516&r1=1044515&r2=1044516&view=diff
==============================================================================
--- subversion/branches/ignore-mergeinfo/subversion/libsvn_subr/dirent_uri.c (original)
+++ subversion/branches/ignore-mergeinfo/subversion/libsvn_subr/dirent_uri.c Fri Dec 10 21:23:03 2010
@@ -34,6 +34,7 @@
 #include "svn_string.h"
 #include "svn_dirent_uri.h"
 #include "svn_path.h"
+#include "svn_ctype.h"
 
 #include "dirent_uri.h"
 
@@ -549,7 +550,8 @@ canonicalize(path_type_t type, const cha
               case '/':
                 break;
               case '%':
-                if (!apr_isxdigit(*(src+1)) || !apr_isxdigit(*(src+2)))
+                if (!svn_ctype_isxdigit(*(src+1)) ||
+                    !svn_ctype_isxdigit(*(src+2)))
                   need_extra += 2;
                 else
                   src += 2;
@@ -585,7 +587,8 @@ canonicalize(path_type_t type, const cha
                 *(dst++) = '/';
                 break;
               case '%':
-                if (!apr_isxdigit(*(src+1)) || !apr_isxdigit(*(src+2)))
+                if (!svn_ctype_isxdigit(*(src+1)) ||
+                    !svn_ctype_isxdigit(*(src+2)))
                   {
                     *(dst++) = '%';
                     *(dst++) = '2';
@@ -1899,13 +1902,13 @@ svn_uri_is_canonical(const char *uri, ap
               char digitz[3];
               int val;
 
-              /* Can't use apr_isxdigit() because lower case letters are
+              /* Can't usesvn_ctype_isxdigit() because lower case letters are
                  not in our canonical format */
-              if (((*(ptr+1) < '0' || (*ptr+1) > '9')) 
-                  && (*(ptr+1) < 'A' || (*ptr+1) > 'F'))
+              if (((*(ptr+1) < '0' || *(ptr+1) > '9')) 
+                  && (*(ptr+1) < 'A' || *(ptr+1) > 'F'))
                 return FALSE;
-              else if (((*(ptr+2) < '0' || (*ptr+2) > '9')) 
-                  && (*(ptr+2) < 'A' || (*ptr+2) > 'F'))
+              else if (((*(ptr+2) < '0' || *(ptr+2) > '9')) 
+                  && (*(ptr+2) < 'A' || *(ptr+2) > 'F'))
                 return FALSE;
 
               digitz[0] = *(++ptr);

Modified: subversion/branches/ignore-mergeinfo/subversion/libsvn_subr/hash.c
URL: http://svn.apache.org/viewvc/subversion/branches/ignore-mergeinfo/subversion/libsvn_subr/hash.c?rev=1044516&r1=1044515&r2=1044516&view=diff
==============================================================================
--- subversion/branches/ignore-mergeinfo/subversion/libsvn_subr/hash.c (original)
+++ subversion/branches/ignore-mergeinfo/subversion/libsvn_subr/hash.c Fri Dec 10 21:23:03 2010
@@ -344,11 +344,16 @@ svn_hash_read(apr_hash_t *hash,
         }
       else if ((buf[0] == 'K') && (buf[1] == ' '))
         {
+          size_t keylen;
+          int parsed_len;
+          void *keybuf;
+          
           /* Get the length of the key */
-          size_t keylen = (size_t) atoi(buf + 2);
+          SVN_ERR(svn_cstring_atoi(&parsed_len, buf + 2));
+          keylen = parsed_len;
 
           /* Now read that much into a buffer, + 1 byte for null terminator */
-          void *keybuf = apr_palloc(pool, keylen + 1);
+          keybuf = apr_palloc(pool, keylen + 1);
           SVN_ERR(svn_io_file_read_full(srcfile,
                                         keybuf, keylen, &num_read, pool));
           ((char *) keybuf)[keylen] = '\0';
@@ -365,12 +370,15 @@ svn_hash_read(apr_hash_t *hash,
           if ((buf[0] == 'V') && (buf[1] == ' '))
             {
               svn_string_t *value = apr_palloc(pool, sizeof(*value));
+              apr_size_t vallen;
+              void *valbuf;
 
               /* Get the length of the value */
-              apr_size_t vallen = atoi(buf + 2);
+              SVN_ERR(svn_cstring_atoi(&parsed_len, buf + 2));
+              vallen = parsed_len;
 
               /* Again, 1 extra byte for the null termination. */
-              void *valbuf = apr_palloc(pool, vallen + 1);
+              valbuf = apr_palloc(pool, vallen + 1);
               SVN_ERR(svn_io_file_read_full(srcfile,
                                             valbuf, vallen,
                                             &num_read, pool));
@@ -458,13 +466,7 @@ svn_hash_keys(apr_array_header_t **array
 
   for (hi = apr_hash_first(pool, hash); hi; hi = apr_hash_next(hi))
     {
-      const void *key;
-      const char *path;
-
-      apr_hash_this(hi, &key, NULL, NULL);
-      path = key;
-
-      APR_ARRAY_PUSH(*array, const char *) = path;
+      APR_ARRAY_PUSH(*array, const char *) = svn__apr_hash_index_key(hi);
     }
 
   return SVN_NO_ERROR;

Modified: subversion/branches/ignore-mergeinfo/subversion/libsvn_subr/io.c
URL: http://svn.apache.org/viewvc/subversion/branches/ignore-mergeinfo/subversion/libsvn_subr/io.c?rev=1044516&r1=1044515&r2=1044516&view=diff
==============================================================================
--- subversion/branches/ignore-mergeinfo/subversion/libsvn_subr/io.c (original)
+++ subversion/branches/ignore-mergeinfo/subversion/libsvn_subr/io.c Fri Dec 10 21:23:03 2010
@@ -57,6 +57,7 @@
 #include "svn_utf.h"
 #include "svn_config.h"
 #include "svn_private_config.h"
+#include "svn_ctype.h"
 
 #include "private/svn_atomic.h"
 
@@ -1025,14 +1026,19 @@ svn_error_t *svn_io_file_create(const ch
 {
   apr_file_t *f;
   apr_size_t written;
+  svn_error_t *err;
 
   SVN_ERR(svn_io_file_open(&f, file,
                            (APR_WRITE | APR_CREATE | APR_EXCL),
                            APR_OS_DEFAULT,
                            pool));
-  SVN_ERR(svn_io_file_write_full(f, contents, strlen(contents),
-                                 &written, pool));
-  return svn_io_file_close(f, pool);
+  err= svn_io_file_write_full(f, contents, strlen(contents),
+                              &written, pool);
+
+
+  return svn_error_return(
+                        svn_error_compose_create(err,
+                                                 svn_io_file_close(f, pool)));
 }
 
 svn_error_t *svn_io_dir_file_copy(const char *src_path,
@@ -2868,12 +2874,19 @@ svn_io_write_unique(const char **tmp_pat
                     apr_pool_t *pool)
 {
   apr_file_t *new_file;
+  svn_error_t *err;
 
   SVN_ERR(svn_io_open_unique_file3(&new_file, tmp_path, dirpath,
                                    delete_when, pool, pool));
-  SVN_ERR(svn_io_file_write_full(new_file, buf, nbytes, NULL, pool));
-  SVN_ERR(svn_io_file_flush_to_disk(new_file, pool));
-  return svn_io_file_close(new_file, pool);
+
+  err = svn_io_file_write_full(new_file, buf, nbytes, NULL, pool);
+
+  if (!err)
+    err = svn_io_file_flush_to_disk(new_file, pool);
+
+  return svn_error_return(
+                  svn_error_compose_create(err,
+                                           svn_io_file_close(new_file, pool)));
 }
 
 
@@ -3437,15 +3450,17 @@ svn_io_read_version_file(int *version,
   apr_file_t *format_file;
   char buf[80];
   apr_size_t len;
+  svn_error_t *err;
 
   /* Read a chunk of data from PATH */
   SVN_ERR(svn_io_file_open(&format_file, path, APR_READ,
                            APR_OS_DEFAULT, pool));
   len = sizeof(buf);
-  SVN_ERR(svn_io_file_read(format_file, buf, &len, pool));
+  err = svn_io_file_read(format_file, buf, &len, pool);
 
   /* Close the file. */
-  SVN_ERR(svn_io_file_close(format_file, pool));
+  SVN_ERR(svn_error_compose_create(err,
+                                   svn_io_file_close(format_file, pool)));
 
   /* If there was no data in PATH, return an error. */
   if (len == 0)
@@ -3462,8 +3477,11 @@ svn_io_read_version_file(int *version,
         char c = buf[i];
 
         if (i > 0 && (c == '\r' || c == '\n'))
-          break;
-        if (! apr_isdigit(c))
+          {
+            buf[i] = '\0';
+            break;
+          }
+        if (! svn_ctype_isdigit(c))
           return svn_error_createf
             (SVN_ERR_BAD_VERSION_FILE_FORMAT, NULL,
              _("First line of '%s' contains non-digit"),
@@ -3472,7 +3490,7 @@ svn_io_read_version_file(int *version,
   }
 
   /* Convert to integer. */
-  *version = atoi(buf);
+  SVN_ERR(svn_cstring_atoi(version, buf));
 
   return SVN_NO_ERROR;
 }
@@ -3486,48 +3504,65 @@ contents_identical_p(svn_boolean_t *iden
                      const char *file2,
                      apr_pool_t *pool)
 {
-  svn_error_t *err1;
-  svn_error_t *err2;
+  svn_error_t *err;
   apr_size_t bytes_read1, bytes_read2;
   char *buf1 = apr_palloc(pool, SVN__STREAM_CHUNK_SIZE);
   char *buf2 = apr_palloc(pool, SVN__STREAM_CHUNK_SIZE);
   apr_file_t *file1_h = NULL;
   apr_file_t *file2_h = NULL;
+  svn_boolean_t done1 = FALSE;
+  svn_boolean_t done2 = FALSE;
 
   SVN_ERR(svn_io_file_open(&file1_h, file1, APR_READ, APR_OS_DEFAULT,
                            pool));
-  SVN_ERR(svn_io_file_open(&file2_h, file2, APR_READ, APR_OS_DEFAULT,
-                           pool));
+
+  err = svn_io_file_open(&file2_h, file2, APR_READ, APR_OS_DEFAULT,
+                         pool);
+
+  if (err)
+    return svn_error_return(
+               svn_error_compose_create(err,
+                                        svn_io_file_close(file1_h, pool)));
 
   *identical_p = TRUE;  /* assume TRUE, until disproved below */
-  do
+  while (! (done1 || done2))
     {
-      err1 = svn_io_file_read_full(file1_h, buf1,
-                                   SVN__STREAM_CHUNK_SIZE, &bytes_read1, pool);
-      if (err1 && !APR_STATUS_IS_EOF(err1->apr_err))
-        return err1;
-
-      err2 = svn_io_file_read_full(file2_h, buf2,
-                                   SVN__STREAM_CHUNK_SIZE, &bytes_read2, pool);
-      if (err2 && !APR_STATUS_IS_EOF(err2->apr_err))
+      err = svn_io_file_read_full(file1_h, buf1,
+                                  SVN__STREAM_CHUNK_SIZE, &bytes_read1, pool);
+      if (err && APR_STATUS_IS_EOF(err->apr_err))
         {
-          svn_error_clear(err1);
-          return err2;
+          svn_error_clear(err);
+          err = NULL;
+          done1 = TRUE;
         }
+      else if (err)
+        break;
+
+      err = svn_io_file_read_full(file2_h, buf2,
+                                  SVN__STREAM_CHUNK_SIZE, &bytes_read2, pool);
+      if (err && APR_STATUS_IS_EOF(err->apr_err))
+        {
+          svn_error_clear(err);
+          err = NULL;
+          done2 = TRUE;
+        }
+      else if (err)
+        break;
 
       if ((bytes_read1 != bytes_read2)
+          || (done1 != done2)
           || (memcmp(buf1, buf2, bytes_read1)))
         {
           *identical_p = FALSE;
           break;
         }
-    } while (! err1 && ! err2);
-
-  svn_error_clear(err1);
-  svn_error_clear(err2);
+    }
 
-  SVN_ERR(svn_io_file_close(file1_h, pool));
-  return svn_io_file_close(file2_h, pool);
+  return svn_error_return(
+           svn_error_compose_create(
+                err,
+                svn_error_compose_create(svn_io_file_close(file1_h, pool),
+                                         svn_io_file_close(file2_h, pool))));
 }
 
 

Modified: subversion/branches/ignore-mergeinfo/subversion/libsvn_subr/opt.c
URL: http://svn.apache.org/viewvc/subversion/branches/ignore-mergeinfo/subversion/libsvn_subr/opt.c?rev=1044516&r1=1044515&r2=1044516&view=diff
==============================================================================
--- subversion/branches/ignore-mergeinfo/subversion/libsvn_subr/opt.c (original)
+++ subversion/branches/ignore-mergeinfo/subversion/libsvn_subr/opt.c Fri Dec 10 21:23:03 2010
@@ -43,6 +43,7 @@
 #include "svn_utf.h"
 #include "svn_time.h"
 #include "svn_props.h"
+#include "svn_ctype.h"
 
 #include "private/svn_opt_private.h"
 
@@ -456,11 +457,11 @@ static char *parse_one_rev(svn_opt_revis
       revision->value.date = tm;
       return end + 1;
     }
-  else if (apr_isdigit(*str))
+  else if (svn_ctype_isdigit(*str))
     {
       /* It's a number. */
       end = str + 1;
-      while (apr_isdigit(*end))
+      while (svn_ctype_isdigit(*end))
         end++;
       save = *end;
       *end = '\0';
@@ -469,10 +470,10 @@ static char *parse_one_rev(svn_opt_revis
       *end = save;
       return end;
     }
-  else if (apr_isalpha(*str))
+  else if (svn_ctype_isalpha(*str))
     {
       end = str + 1;
-      while (apr_isalpha(*end))
+      while (svn_ctype_isalpha(*end))
         end++;
       save = *end;
       *end = '\0';

Modified: subversion/branches/ignore-mergeinfo/subversion/libsvn_subr/path.c
URL: http://svn.apache.org/viewvc/subversion/branches/ignore-mergeinfo/subversion/libsvn_subr/path.c?rev=1044516&r1=1044515&r2=1044516&view=diff
==============================================================================
--- subversion/branches/ignore-mergeinfo/subversion/libsvn_subr/path.c (original)
+++ subversion/branches/ignore-mergeinfo/subversion/libsvn_subr/path.c Fri Dec 10 21:23:03 2010
@@ -727,7 +727,8 @@ svn_path_is_uri_safe(const char *path)
       /* Allow '%XX' (where each X is a hex digit) */
       if (path[i] == '%')
         {
-          if (apr_isxdigit(path[i + 1]) && apr_isxdigit(path[i + 2]))
+          if (svn_ctype_isxdigit(path[i + 1]) &&
+              svn_ctype_isxdigit(path[i + 2]))
             {
               i += 2;
               continue;
@@ -897,8 +898,8 @@ svn_path_uri_decode(const char *path, ap
            * RFC 2396, section 3.3  */
           c = ' ';
         }
-      else if (c == '%' && apr_isxdigit(path[i + 1])
-               && apr_isxdigit(path[i+2]))
+      else if (c == '%' && svn_ctype_isxdigit(path[i + 1])
+               && svn_ctype_isxdigit(path[i+2]))
         {
           char digitz[3];
           digitz[0] = path[++i];

Modified: subversion/branches/ignore-mergeinfo/subversion/libsvn_subr/prompt.c
URL: http://svn.apache.org/viewvc/subversion/branches/ignore-mergeinfo/subversion/libsvn_subr/prompt.c?rev=1044516&r1=1044515&r2=1044516&view=diff
==============================================================================
--- subversion/branches/ignore-mergeinfo/subversion/libsvn_subr/prompt.c (original)
+++ subversion/branches/ignore-mergeinfo/subversion/libsvn_subr/prompt.c Fri Dec 10 21:23:03 2010
@@ -147,7 +147,7 @@ prompt(const char **result,
                 SVN_ERR_MALFUNCTION();
             }
 
-          svn_stringbuf_appendbytes(strbuf, &c, 1);
+          svn_stringbuf_appendbyte(strbuf, c);
         }
     }
   else

Modified: subversion/branches/ignore-mergeinfo/subversion/libsvn_subr/quoprint.c
URL: http://svn.apache.org/viewvc/subversion/branches/ignore-mergeinfo/subversion/libsvn_subr/quoprint.c?rev=1044516&r1=1044515&r2=1044516&view=diff
==============================================================================
--- subversion/branches/ignore-mergeinfo/subversion/libsvn_subr/quoprint.c (original)
+++ subversion/branches/ignore-mergeinfo/subversion/libsvn_subr/quoprint.c Fri Dec 10 21:23:03 2010
@@ -92,7 +92,7 @@ encode_bytes(svn_stringbuf_t *str, const
       /* Encode this character.  */
       if (ENCODE_AS_LITERAL(*p))
         {
-          svn_stringbuf_appendbytes(str, p, 1);
+          svn_stringbuf_appendbyte(str, *p);
           (*linelen)++;
         }
       else
@@ -218,7 +218,7 @@ decode_bytes(svn_stringbuf_t *str, const
         {
           /* Literal character; append it if it's valid as such.  */
           if (VALID_LITERAL(*inbuf))
-            svn_stringbuf_appendbytes(str, inbuf, 1);
+            svn_stringbuf_appendbyte(str, *inbuf);
           *inbuflen = 0;
         }
       else if (*inbuf == '=' && *inbuflen == 2 && inbuf[1] == '\n')
@@ -234,7 +234,7 @@ decode_bytes(svn_stringbuf_t *str, const
           if (find1 != NULL && find2 != NULL)
             {
               c = ((find1 - hextab) << 4) | (find2 - hextab);
-              svn_stringbuf_appendbytes(str, &c, 1);
+              svn_stringbuf_appendbyte(str, c);
             }
           *inbuflen = 0;
         }

Modified: subversion/branches/ignore-mergeinfo/subversion/libsvn_subr/skel.c
URL: http://svn.apache.org/viewvc/subversion/branches/ignore-mergeinfo/subversion/libsvn_subr/skel.c?rev=1044516&r1=1044515&r2=1044516&view=diff
==============================================================================
--- subversion/branches/ignore-mergeinfo/subversion/libsvn_subr/skel.c (original)
+++ subversion/branches/ignore-mergeinfo/subversion/libsvn_subr/skel.c Fri Dec 10 21:23:03 2010
@@ -535,7 +535,7 @@ unparse(const svn_skel_t *skel, svn_stri
         }
 
       /* Emit a closing parenthesis.  */
-      svn_stringbuf_appendbytes(str, ")", 1);
+      svn_stringbuf_appendbyte(str, ')');
     }
 
   return str;
@@ -666,12 +666,16 @@ svn_skel__list_length(const svn_skel_t *
 
 /* Parsing and unparsing into high-level types. */
 
-apr_int64_t svn_skel__parse_int(const svn_skel_t *skel,
-                                apr_pool_t *scratch_pool)
+svn_error_t *
+svn_skel__parse_int(apr_int64_t *n, const svn_skel_t *skel,
+                    apr_pool_t *scratch_pool)
 {
+  const char *str;
+
   /* We need to duplicate the SKEL contents in order to get a NUL-terminated
      version of it. The SKEL may not have valid memory at DATA[LEN].  */
-  return apr_atoi64(apr_pstrmemdup(scratch_pool, skel->data, skel->len));
+  str = apr_pstrmemdup(scratch_pool, skel->data, skel->len);
+  return svn_error_return(svn_cstring_atoi64(n, str));
 }
 
 

Modified: subversion/branches/ignore-mergeinfo/subversion/libsvn_subr/sqlite.c
URL: http://svn.apache.org/viewvc/subversion/branches/ignore-mergeinfo/subversion/libsvn_subr/sqlite.c?rev=1044516&r1=1044515&r2=1044516&view=diff
==============================================================================
--- subversion/branches/ignore-mergeinfo/subversion/libsvn_subr/sqlite.c (original)
+++ subversion/branches/ignore-mergeinfo/subversion/libsvn_subr/sqlite.c Fri Dec 10 21:23:03 2010
@@ -71,6 +71,7 @@ struct svn_sqlite__db_t
   int nbr_statements;
   svn_sqlite__stmt_t **prepared_stmts;
   apr_pool_t *state_pool;
+  unsigned savepoint_nr;
 };
 
 struct svn_sqlite__stmt_t
@@ -273,11 +274,20 @@ vbindf(svn_sqlite__stmt_t *stmt, const c
             SVN_ERR(svn_sqlite__bind_blob(stmt, count, blob, blob_size));
             break;
 
+          case 'r':
+            SVN_ERR(svn_sqlite__bind_revnum(stmt, count,
+                                            va_arg(ap, svn_revnum_t)));
+            break;
+
           case 't':
             map = va_arg(ap, const svn_token_map_t *);
             SVN_ERR(svn_sqlite__bind_token(stmt, count, map, va_arg(ap, int)));
             break;
 
+          case 'n':
+            /* Skip this column: no binding */
+            break;
+
           default:
             SVN_ERR_MALFUNCTION();
         }
@@ -352,6 +362,20 @@ svn_sqlite__bind_token(svn_sqlite__stmt_
 }
 
 svn_error_t *
+svn_sqlite__bind_revnum(svn_sqlite__stmt_t *stmt,
+                        int slot,
+                        svn_revnum_t value)
+{
+  if (SVN_IS_VALID_REVNUM(value))
+    SQLITE_ERR(sqlite3_bind_int64(stmt->s3stmt, slot,
+                                  (sqlite_int64)value), stmt->db);
+  else
+    SQLITE_ERR(sqlite3_bind_null(stmt->s3stmt, slot), stmt->db);
+
+  return SVN_NO_ERROR;
+}
+
+svn_error_t *
 svn_sqlite__bind_properties(svn_sqlite__stmt_t *stmt,
                             int slot,
                             const apr_hash_t *props,
@@ -1018,6 +1042,60 @@ svn_sqlite__with_transaction(svn_sqlite_
 }
 
 svn_error_t *
+svn_sqlite__with_lock(svn_sqlite__db_t *db,
+                      svn_sqlite__transaction_callback_t cb_func,
+                      void *cb_baton,
+                      apr_pool_t *scratch_pool)
+{
+  svn_error_t *err;
+
+#if SQLITE_VERSION_AT_LEAST(3,6,8)
+  svn_error_t *err2;
+  int savepoint = db->savepoint_nr++;
+  const char *release_stmt;
+
+  SVN_ERR(exec_sql(db,
+                   apr_psprintf(scratch_pool, "SAVEPOINT s%u;", savepoint)));
+#endif
+
+  err = cb_func(cb_baton, db, scratch_pool);
+
+#if SQLITE_VERSION_AT_LEAST(3,6,8)
+  release_stmt = apr_psprintf(scratch_pool, "RELEASE s%u;", savepoint);
+  err2 = exec_sql(db, release_stmt);
+
+  if (err2 && err2->apr_err == SVN_ERR_SQLITE_BUSY)
+    {
+      /* Ok, we have a major problem. Some statement is still open, which
+         makes it impossible to release this savepoint.
+
+         ### See huge comment in svn_sqlite__with_transaction for
+             further details */
+
+      int i;
+
+      err2 = svn_error_compose_create(err2,
+                   svn_error_create(SVN_ERR_SQLITE_RESETTING_FOR_ROLLBACK,
+                                    NULL, NULL));
+
+      for (i = 0; i < db->nbr_statements; i++)
+        if (db->prepared_stmts[i] && db->prepared_stmts[i]->needs_reset)
+          err2 = svn_error_compose_create(
+                     err2,
+                     svn_sqlite__reset(db->prepared_stmts[i]));
+
+          err2 = svn_error_compose_create(
+                      exec_sql(db, release_stmt),
+                      err2);
+    }
+
+  err = svn_error_compose_create(err, err2);
+#endif
+
+  return svn_error_return(err);
+}
+
+svn_error_t *
 svn_sqlite__hotcopy(const char *src_path,
                     const char *dst_path,
                     apr_pool_t *scratch_pool)

Modified: subversion/branches/ignore-mergeinfo/subversion/libsvn_subr/stream.c
URL: http://svn.apache.org/viewvc/subversion/branches/ignore-mergeinfo/subversion/libsvn_subr/stream.c?rev=1044516&r1=1044515&r2=1044516&view=diff
==============================================================================
--- subversion/branches/ignore-mergeinfo/subversion/libsvn_subr/stream.c (original)
+++ subversion/branches/ignore-mergeinfo/subversion/libsvn_subr/stream.c Fri Dec 10 21:23:03 2010
@@ -296,7 +296,7 @@ stream_readline(svn_stringbuf_t **string
       else
         match = eol_str;
 
-      svn_stringbuf_appendbytes(str, &c, 1);
+      svn_stringbuf_appendbyte(str, c);
     }
 
   *eof = FALSE;

Modified: subversion/branches/ignore-mergeinfo/subversion/libsvn_subr/subst.c
URL: http://svn.apache.org/viewvc/subversion/branches/ignore-mergeinfo/subversion/libsvn_subr/subst.c?rev=1044516&r1=1044515&r2=1044516&view=diff
==============================================================================
--- subversion/branches/ignore-mergeinfo/subversion/libsvn_subr/subst.c (original)
+++ subversion/branches/ignore-mergeinfo/subversion/libsvn_subr/subst.c Fri Dec 10 21:23:03 2010
@@ -211,10 +211,10 @@ keyword_printf(const char *fmt,
             svn_stringbuf_appendcstr(value, url);
           break;
         case '%': /* '%%' => a literal % */
-          svn_stringbuf_appendbytes(value, cur, 1);
+          svn_stringbuf_appendbyte(value, *cur);
           break;
         case '\0': /* '%' as the last character of the string. */
-          svn_stringbuf_appendbytes(value, cur, 1);
+          svn_stringbuf_appendbyte(value, *cur);
           /* Now go back one character, since this was just a one character
            * sequence, whereas all others are two characters, and we do not
            * want to skip the null terminator entirely and carry on

Modified: subversion/branches/ignore-mergeinfo/subversion/libsvn_subr/svn_string.c
URL: http://svn.apache.org/viewvc/subversion/branches/ignore-mergeinfo/subversion/libsvn_subr/svn_string.c?rev=1044516&r1=1044515&r2=1044516&view=diff
==============================================================================
--- subversion/branches/ignore-mergeinfo/subversion/libsvn_subr/svn_string.c (original)
+++ subversion/branches/ignore-mergeinfo/subversion/libsvn_subr/svn_string.c Fri Dec 10 21:23:03 2010
@@ -1,5 +1,5 @@
 /*
- * svn_string.h:  routines to manipulate counted-length strings
+ * svn_string.c:  routines to manipulate counted-length strings
  *                (svn_stringbuf_t and svn_string_t) and C strings.
  *
  *
@@ -25,12 +25,16 @@
 
 
 
+#include <apr.h>
+
 #include <string.h>      /* for memcpy(), memcmp(), strlen() */
 #include <apr_lib.h>     /* for apr_isspace() */
 #include <apr_fnmatch.h>
 #include "svn_string.h"  /* loads "svn_types.h" and <apr_pools.h> */
 #include "svn_ctype.h"
+#include "private/svn_dep_compat.h"
 
+#include "svn_private_config.h"
 
 
 /* Our own realloc, since APR doesn't have one.  Note: this is a
@@ -84,7 +88,7 @@ string_first_non_whitespace(const char *
 
   for (i = 0; i < len; i++)
     {
-      if (! apr_isspace(str[i]))
+      if (! svn_ctype_isspace(str[i]))
         return i;
     }
 
@@ -385,6 +389,34 @@ svn_stringbuf_ensure(svn_stringbuf_t *st
 
 
 void
+svn_stringbuf_appendbyte(svn_stringbuf_t *str, char byte)
+{
+  /* In most cases, there will be pre-allocated memory left
+   * to just write the new byte at the end of the used section
+   * and terminate the string properly.
+   */
+  apr_size_t old_len = str->len;
+  if (str->blocksize > old_len + 1)
+    {
+      char *dest = str->data;
+
+      dest[old_len] = byte;
+      dest[old_len+1] = '\0';
+
+      str->len = old_len+1;
+    }
+  else
+    {
+      /* we need to re-allocate the string buffer
+       * -> let the more generic implementation take care of that part
+       */
+      char b = byte;
+      svn_stringbuf_appendbytes(str, &b, 1);
+    }
+}
+
+
+void
 svn_stringbuf_appendbytes(svn_stringbuf_t *str, const char *bytes,
                           apr_size_t count)
 {
@@ -460,7 +492,7 @@ svn_stringbuf_strip_whitespace(svn_strin
   str->blocksize -= offset;
 
   /* Now that we've trimmed the front, trim the end, wasting more RAM. */
-  while ((str->len > 0) && apr_isspace(str->data[str->len - 1]))
+  while ((str->len > 0) && svn_ctype_isspace(str->data[str->len - 1]))
     str->len--;
   str->data[str->len] = '\0';
 }
@@ -502,12 +534,12 @@ svn_cstring_split_append(apr_array_heade
     {
       if (chop_whitespace)
         {
-          while (apr_isspace(*p))
+          while (svn_ctype_isspace(*p))
             p++;
 
           {
             char *e = p + (strlen(p) - 1);
-            while ((e >= p) && (apr_isspace(*e)))
+            while ((e >= p) && (svn_ctype_isspace(*e)))
               e--;
             *(++e) = '\0';
           }
@@ -605,3 +637,93 @@ svn_cstring_casecmp(const char *str1, co
         return cmp;
     }
 }
+
+svn_error_t *
+svn_cstring_strtoui64(apr_uint64_t *n, const char *str,
+                      apr_uint64_t minval, apr_uint64_t maxval,
+                      int base)
+{
+  apr_int64_t val;
+  char *endptr;
+
+  /* We assume errno is thread-safe. */
+  errno = 0; /* APR-0.9 doesn't always set errno */
+
+  /* ### We're throwing away half the number range here.
+   * ### APR needs a apr_strtoui64() function. */
+  val = apr_strtoi64(str, &endptr, base);
+  if (errno == EINVAL || endptr == str || str[0] == '\0' || *endptr != '\0')
+    return svn_error_return(
+             svn_error_createf(SVN_ERR_INCORRECT_PARAMS, NULL,
+                               _("Could not convert '%s' into a number"),
+                               str));
+  if ((errno == ERANGE && (val == APR_INT64_MIN || val == APR_INT64_MAX)) ||
+      val < 0 || (apr_uint64_t)val < minval || (apr_uint64_t)val > maxval)
+    return svn_error_return(
+             svn_error_createf(SVN_ERR_INCORRECT_PARAMS, NULL,
+                               _("Number '%s' is out of range '[%llu, %llu]'"),
+                               str, minval, maxval));
+  *n = val;
+  return SVN_NO_ERROR;
+}
+
+svn_error_t *
+svn_cstring_atoui64(apr_uint64_t *n, const char *str)
+{
+  return svn_error_return(svn_cstring_strtoui64(n, str, 0,
+                                                APR_UINT64_MAX, 10));
+}
+
+svn_error_t *
+svn_cstring_atoui(unsigned int *n, const char *str)
+{
+  apr_uint64_t val;
+
+  SVN_ERR(svn_cstring_strtoui64(&val, str, 0, APR_UINT32_MAX, 10));
+  *n = (unsigned int)val;
+  return SVN_NO_ERROR;
+}
+
+svn_error_t *
+svn_cstring_strtoi64(apr_int64_t *n, const char *str,
+                     apr_int64_t minval, apr_int64_t maxval,
+                     int base)
+{
+  apr_int64_t val;
+  char *endptr;
+
+  /* We assume errno is thread-safe. */
+  errno = 0; /* APR-0.9 doesn't always set errno */
+
+  val = apr_strtoi64(str, &endptr, base);
+  if (errno == EINVAL || endptr == str || str[0] == '\0' || *endptr != '\0')
+    return svn_error_return(
+             svn_error_createf(SVN_ERR_INCORRECT_PARAMS, NULL,
+                               _("Could not convert '%s' into a number"),
+                               str));
+  if ((errno == ERANGE && (val == APR_INT64_MIN || val == APR_INT64_MAX)) ||
+      val < minval || val > maxval)
+    return svn_error_return(
+             svn_error_createf(SVN_ERR_INCORRECT_PARAMS, NULL,
+                               _("Number '%s' is out of range '[%lld, %lld]'"),
+                               str, minval, maxval));
+  *n = val;
+  return SVN_NO_ERROR;
+}
+
+svn_error_t *
+svn_cstring_atoi64(apr_int64_t *n, const char *str)
+{
+  return svn_error_return(svn_cstring_strtoi64(n, str, APR_INT64_MIN,
+                                               APR_INT64_MAX, 10));
+}
+
+svn_error_t *
+svn_cstring_atoi(int *n, const char *str)
+{
+  apr_int64_t val;
+
+  SVN_ERR(svn_cstring_strtoi64(&val, str, APR_INT32_MIN, APR_INT32_MAX, 10));
+  *n = (int)val;
+  return SVN_NO_ERROR;
+}

Modified: subversion/branches/ignore-mergeinfo/subversion/libsvn_subr/utf.c
URL: http://svn.apache.org/viewvc/subversion/branches/ignore-mergeinfo/subversion/libsvn_subr/utf.c?rev=1044516&r1=1044515&r2=1044516&view=diff
==============================================================================
--- subversion/branches/ignore-mergeinfo/subversion/libsvn_subr/utf.c (original)
+++ subversion/branches/ignore-mergeinfo/subversion/libsvn_subr/utf.c Fri Dec 10 21:23:03 2010
@@ -530,9 +530,9 @@ check_non_ascii(const char *data, apr_si
 
   for (; len > 0; --len, data++)
     {
-      if ((! apr_isascii(*data))
-          || ((! apr_isspace(*data))
-              && apr_iscntrl(*data)))
+      if ((! svn_ctype_isascii(*data))
+          || ((! svn_ctype_isspace(*data))
+              && svn_ctype_iscntrl(*data)))
         {
           /* Show the printable part of the data, followed by the
              decimal code of the questionable character.  Because if a

Modified: subversion/branches/ignore-mergeinfo/subversion/libsvn_subr/validate.c
URL: http://svn.apache.org/viewvc/subversion/branches/ignore-mergeinfo/subversion/libsvn_subr/validate.c?rev=1044516&r1=1044515&r2=1044516&view=diff
==============================================================================
--- subversion/branches/ignore-mergeinfo/subversion/libsvn_subr/validate.c (original)
+++ subversion/branches/ignore-mergeinfo/subversion/libsvn_subr/validate.c Fri Dec 10 21:23:03 2010
@@ -27,11 +27,11 @@
 
 /*** Includes. ***/
 
-#include <apr_lib.h>
 #define APR_WANT_STRFUNC
 #include <apr_want.h>
 
 #include "svn_error.h"
+#include "svn_ctype.h"
 #include "svn_private_config.h"
 
 
@@ -63,9 +63,9 @@ svn_mime_type_validate(const char *mime_
   for (i = 0; i < len; i++)
     {
       if (&mime_type[i] != slash_pos
-        && (! apr_isascii(mime_type[i])
-            || apr_iscntrl(mime_type[i])
-            || apr_isspace(mime_type[i])
+         && (! svn_ctype_isascii(mime_type[i])
+            || svn_ctype_iscntrl(mime_type[i])
+            || svn_ctype_isspace(mime_type[i])
             || (strchr(tspecials, mime_type[i]) != NULL)))
         return svn_error_createf
           (SVN_ERR_BAD_MIME_TYPE, NULL,

Modified: subversion/branches/ignore-mergeinfo/subversion/libsvn_wc/adm_crawler.c
URL: http://svn.apache.org/viewvc/subversion/branches/ignore-mergeinfo/subversion/libsvn_wc/adm_crawler.c?rev=1044516&r1=1044515&r2=1044516&view=diff
==============================================================================
--- subversion/branches/ignore-mergeinfo/subversion/libsvn_wc/adm_crawler.c (original)
+++ subversion/branches/ignore-mergeinfo/subversion/libsvn_wc/adm_crawler.c Fri Dec 10 21:23:03 2010
@@ -137,11 +137,6 @@ svn_wc_restore(svn_wc_context_t *wc_ctx,
       case svn_wc__db_status_not_present:
       case svn_wc__db_status_absent:
       case svn_wc__db_status_excluded:
-#ifndef SVN_WC__SINGLE_DB
-      case svn_wc__db_status_obstructed:
-      case svn_wc__db_status_obstructed_add:
-      case svn_wc__db_status_obstructed_delete:
-#endif
         return svn_error_createf(SVN_ERR_WC_PATH_NOT_FOUND, NULL,
                                  _("The node '%s' can not be restored."),
                                  svn_dirent_local_style(local_abspath,
@@ -154,14 +149,7 @@ svn_wc_restore(svn_wc_context_t *wc_ctx,
     SVN_ERR(restore_file(wc_ctx->db, local_abspath, use_commit_times, FALSE,
                          scratch_pool));
   else
-#ifdef SVN_WC__SINGLE_DB
     SVN_ERR(svn_io_dir_make(local_abspath, APR_OS_DEFAULT, scratch_pool));
-#else
-     return svn_error_createf(SVN_ERR_WC_PATH_NOT_FOUND, NULL,
-                                 _("The node '%s' can not be restored."),
-                                 svn_dirent_local_style(local_abspath,
-                                                        scratch_pool));
-#endif
 
   return SVN_NO_ERROR;
 }
@@ -171,14 +159,10 @@ svn_wc_restore(svn_wc_context_t *wc_ctx,
    If USE_COMMIT_TIMES is set, then set working file's timestamp to
    last-commit-time.
 
-   Set RESTORED to TRUE if the node is successfull restored. RESTORED will
-   be FALSE if restoring this node is not supported.
-
    This function does all temporary allocations in SCRATCH_POOL
  */
 static svn_error_t *
-restore_node(svn_boolean_t *restored,
-             svn_wc__db_t *db,
+restore_node(svn_wc__db_t *db,
              const char *local_abspath,
              svn_wc__db_kind_t kind,
              svn_boolean_t use_commit_times,
@@ -186,37 +170,26 @@ restore_node(svn_boolean_t *restored,
              void *notify_baton,
              apr_pool_t *scratch_pool)
 {
-  *restored = FALSE;
-
   if (kind == svn_wc__db_kind_file || kind == svn_wc__db_kind_symlink)
     {
       /* Recreate file from text-base */
       SVN_ERR(restore_file(db, local_abspath, use_commit_times, TRUE,
                            scratch_pool));
-
-      *restored = TRUE;
     }
-#ifdef SVN_WC__SINGLE_DB
   else if (kind == svn_wc__db_kind_dir)
     {
       /* Recreating a directory is just a mkdir */
       SVN_ERR(svn_io_dir_make(local_abspath, APR_OS_DEFAULT, scratch_pool));
-      *restored = TRUE;
     }
-#endif
 
-  if (*restored)
+  /* ... report the restoration to the caller.  */
+  if (notify_func != NULL)
     {
-      /* ... report the restoration to the caller.  */
-      if (notify_func != NULL)
-        {
-          svn_wc_notify_t *notify = svn_wc_create_notify(
-                                            local_abspath,
-                                            svn_wc_notify_restore,
-                                            scratch_pool);
-          notify->kind = svn_node_file;
-          (*notify_func)(notify_baton, notify, scratch_pool);
-        }
+      svn_wc_notify_t *notify = svn_wc_create_notify(local_abspath,
+                                                     svn_wc_notify_restore,
+                                                     scratch_pool);
+      notify->kind = svn_node_file;
+      (*notify_func)(notify_baton, notify, scratch_pool);
     }
 
   return SVN_NO_ERROR;
@@ -384,45 +357,13 @@ report_revisions_and_depths(svn_wc__db_t
       this_path = svn_dirent_join(dir_path, child, iterpool);
       this_abspath = svn_dirent_join(dir_abspath, child, iterpool);
 
-      err = svn_wc__db_base_get_info(&this_status, &this_kind, &this_rev,
-                                     &this_repos_relpath, &this_repos_root_url,
-                                     NULL, NULL, NULL, NULL, NULL, &this_depth,
-                                     NULL, NULL, NULL, &this_lock,
-                                     db, this_abspath, iterpool, iterpool);
-      if (err)
-        {
-          if (err->apr_err != SVN_ERR_WC_PATH_NOT_FOUND)
-            return svn_error_return(err);
-
-          /* THIS_ABSPATH was listed as a BASE child of DIR_ABSPATH. Yet,
-             we just got an error trying to read it. What gives? :-P
-
-             This happens when THIS_ABSPATH is a subdirectory that is
-             marked in the parent stub as "not-present". The subdir is
-             then removed. Later, an addition is scheduled, putting the
-             subdirectory back, but ONLY containing WORKING nodes.
-
-             Thus, the BASE fetch comes out of the subdir, and fails.
-
-             For this case, we go ahead and treat this as a simple
-             not-present, and ignore whatever is in the subdirectory.  */
-          svn_error_clear(err);
-
-          this_status = svn_wc__db_status_not_present;
-
-          /* Note: the other THIS_* local variables pass to base_get_info
-             are NOT set at this point. But we don't need them...  */
-        }
-
-      /* Note: some older code would attempt to check the parent stub
-         of subdirectories for the not-present state. That check was
-         redundant since a not-present directory has no BASE nodes
-         within it which may report another status.
-
-         There might be NO BASE node (per the condition above), but the
-         typical case is that base_get_info() reads the parent stub
-         because there is no subdir (with administrative data). Thus, we
-         already have all the information we need. No further testing.  */
+      SVN_ERR(svn_wc__db_base_get_info(&this_status, &this_kind, &this_rev,
+                                       &this_repos_relpath,
+                                       &this_repos_root_url,
+                                       NULL, NULL, NULL, NULL, NULL,
+                                       &this_depth,
+                                       NULL, NULL, NULL, &this_lock,
+                                       db, this_abspath, iterpool, iterpool));
 
       /* First check for exclusion */
       if (this_status == svn_wc__db_status_excluded)
@@ -477,7 +418,6 @@ report_revisions_and_depths(svn_wc__db_t
       /* Is the entry NOT on the disk? We may be able to restore it.  */
       if (apr_hash_get(dirents, child, APR_HASH_KEY_STRING) == NULL)
         {
-          svn_boolean_t missing = FALSE;
           svn_wc__db_status_t wrk_status;
           svn_wc__db_kind_t wrk_kind;
 
@@ -494,13 +434,6 @@ report_revisions_and_depths(svn_wc__db_t
                                              db, this_abspath,
                                              iterpool, iterpool));
 
-#ifndef SVN_WC__SINGLE_DB
-          if (wrk_status == svn_wc__db_status_obstructed
-              || wrk_status == svn_wc__db_status_obstructed_add
-              || wrk_status == svn_wc__db_status_obstructed_delete)
-            missing = TRUE;
-          else
-#endif
           if (restore_files
               && wrk_status != svn_wc__db_status_added
               && wrk_status != svn_wc__db_status_deleted
@@ -518,33 +451,11 @@ report_revisions_and_depths(svn_wc__db_t
 
               if (dirent_kind == svn_node_none)
                 {
-                  svn_boolean_t restored;
-
-                  SVN_ERR(restore_node(&restored, db, this_abspath, wrk_kind,
+                  SVN_ERR(restore_node(db, this_abspath, wrk_kind,
                                        use_commit_times, notify_func,
                                        notify_baton, iterpool));
-                  if (!restored)
-                    missing = TRUE;
                 }
             }
-#ifndef SVN_WC__SINGLE_DB
-          /* If a node is still missing from disk here, we have no way to
-             recreate it locally, so report as missing and move along.
-             Again, don't bother if we're reporting everything, because the
-             dir is already missing on the server. */
-          if (missing && wrk_kind == svn_wc__db_kind_dir
-               && (depth > svn_depth_files || depth == svn_depth_unknown))
-            {
-              if (! report_everything)
-                SVN_ERR(reporter->delete_path(report_baton, this_path,
-                                              iterpool));
-              continue;
-            }
-#else
-          /* With single-db, we always know about all children, so
-             never tell the server that we don't know, but want to know
-             about the missing child. */
-#endif
         }
 
       /* And finally prepare for reporting */
@@ -640,21 +551,6 @@ report_revisions_and_depths(svn_wc__db_t
           svn_boolean_t is_incomplete;
           svn_boolean_t start_empty;
 
-          /* If the subdir and its administrative area are not present,
-             then do NOT bother to report this node, much less recurse
-             into the thing.
-
-             Note: if the there is nothing on the disk, then we may have
-             reported it missing further above.
-
-             ### hmm. but what if we have a *file* obstructing the dir?
-             ### the code above will not report it, and we'll simply
-             ### skip it right here. I guess with an obstruction, we
-             ### can't really do anything with info the server might
-             ### send, so maybe this is just fine.  */
-          if (this_status == svn_wc__db_status_obstructed)
-            continue;
-
           is_incomplete = (this_status == svn_wc__db_status_incomplete);
           start_empty = is_incomplete;
 
@@ -831,7 +727,6 @@ svn_wc_crawl_revisions5(svn_wc_context_t
   svn_wc__db_t *db = wc_ctx->db;
   svn_error_t *fserr, *err;
   svn_revnum_t target_rev = SVN_INVALID_REVNUM;
-  svn_boolean_t missing = FALSE;
   svn_boolean_t start_empty;
   svn_wc__db_status_t status;
   svn_wc__db_kind_t target_kind = svn_wc__db_kind_unknown;
@@ -853,52 +748,21 @@ svn_wc_crawl_revisions5(svn_wc_context_t
                                  db, local_abspath, scratch_pool,
                                  scratch_pool);
 
-  {
-    svn_boolean_t has_base = TRUE;
+  if (err)
+    {
+      if (err->apr_err != SVN_ERR_WC_PATH_NOT_FOUND)
+        return svn_error_return(err);
 
-    if (err)
-      {
-        if (err->apr_err != SVN_ERR_WC_PATH_NOT_FOUND)
-          return svn_error_return(err);
+      svn_error_clear(err);
+      SVN_ERR(svn_wc__db_read_kind(&target_kind, db, local_abspath, TRUE,
+                                   scratch_pool));
 
-        svn_error_clear(err);
-        has_base = FALSE;
-        SVN_ERR(svn_wc__db_read_kind(&target_kind, db, local_abspath, TRUE,
-                                     scratch_pool));
-
-        if (target_kind == svn_wc__db_kind_file
-            || target_kind == svn_wc__db_kind_symlink)
-          status = svn_wc__db_status_absent; /* Crawl via parent dir */
-        else
-          status = svn_wc__db_status_not_present; /* As checkout */
-      }
-
-    /* ### Check the parentstub if we don't find a BASE. But don't
-           do this if we already have the info we want or we break
-           some copy scenarios. */
-    if (!has_base && target_kind == svn_wc__db_kind_dir)
-      {
-        svn_boolean_t not_present;
-        svn_revnum_t rev = SVN_INVALID_REVNUM;
-        err = svn_wc__db_temp_is_dir_deleted(&not_present, &rev,
-                                             db, local_abspath, scratch_pool);
-
-        if (err && (err->apr_err == SVN_ERR_WC_PATH_NOT_FOUND
-                    || err->apr_err == SVN_ERR_WC_NOT_WORKING_COPY))
-          {
-            svn_error_clear(err);
-            not_present = FALSE;
-          }
-        else
-          SVN_ERR(err);
-
-        if (not_present)
-          status = svn_wc__db_status_not_present;
-
-        if (!SVN_IS_VALID_REVNUM(target_rev))
-          target_rev = rev;
-      }
-  }
+      if (target_kind == svn_wc__db_kind_file
+          || target_kind == svn_wc__db_kind_symlink)
+        status = svn_wc__db_status_absent; /* Crawl via parent dir */
+      else
+        status = svn_wc__db_status_not_present; /* As checkout */
+    }
 
   if ((status == svn_wc__db_status_not_present)
       || (target_kind == svn_wc__db_kind_dir
@@ -994,13 +858,6 @@ svn_wc_crawl_revisions5(svn_wc_context_t
                                          db, local_abspath,
                                          scratch_pool, scratch_pool));
 
-#ifndef SVN_WC__SINGLE_DB
-      if (wrk_status == svn_wc__db_status_obstructed
-          || wrk_status == svn_wc__db_status_obstructed_add
-          || wrk_status == svn_wc__db_status_obstructed_delete)
-        missing = TRUE;
-      else
-#endif
       if (restore_files
           && wrk_status != svn_wc__db_status_added
           && wrk_status != svn_wc__db_status_deleted
@@ -1008,15 +865,10 @@ svn_wc_crawl_revisions5(svn_wc_context_t
           && wrk_status != svn_wc__db_status_not_present
           && wrk_status != svn_wc__db_status_absent)
         {
-          svn_boolean_t restored;
-
-          SVN_ERR(restore_node(&restored, wc_ctx->db, local_abspath,
+          SVN_ERR(restore_node(wc_ctx->db, local_abspath,
                                target_kind, use_commit_times,
                                notify_func, notify_baton,
                                scratch_pool));
-
-          if (!restored)
-            missing = TRUE;
         }
     }
 
@@ -1028,17 +880,6 @@ svn_wc_crawl_revisions5(svn_wc_context_t
 
   if (target_kind == svn_wc__db_kind_dir)
     {
-#ifndef SVN_WC__SINGLE_DB
-      if (missing)
-        {
-          /* Report missing directories as deleted to retrieve them
-             from the repository. */
-          err = reporter->delete_path(report_baton, "", scratch_pool);
-          if (err)
-            goto abort_report;
-        }
-      else
-#endif
       if (depth != svn_depth_empty)
         {
           /* Recursively crawl ROOT_DIRECTORY and report differing

Modified: subversion/branches/ignore-mergeinfo/subversion/libsvn_wc/adm_files.c
URL: http://svn.apache.org/viewvc/subversion/branches/ignore-mergeinfo/subversion/libsvn_wc/adm_files.c?rev=1044516&r1=1044515&r2=1044516&view=diff
==============================================================================
--- subversion/branches/ignore-mergeinfo/subversion/libsvn_wc/adm_files.c (original)
+++ subversion/branches/ignore-mergeinfo/subversion/libsvn_wc/adm_files.c Fri Dec 10 21:23:03 2010
@@ -357,14 +357,6 @@ svn_wc__get_pristine_contents(svn_stream
                                "because it has an unexpected status"),
                              svn_dirent_local_style(local_abspath,
                                                     scratch_pool));
-  else
-    /* We know that it is a file, so we can't hit the _obstructed stati.
-       Also, we should never see _base_deleted here. */
-    SVN_ERR_ASSERT(status != svn_wc__db_status_obstructed
-                   && status != svn_wc__db_status_obstructed_add
-                   && status != svn_wc__db_status_obstructed_delete
-                   && status != svn_wc__db_status_base_deleted);
-
   if (sha1_checksum)
     SVN_ERR(svn_wc__db_pristine_read(contents, db, local_abspath,
                                      sha1_checksum,
@@ -638,7 +630,6 @@ svn_wc__internal_ensure_adm(svn_wc__db_t
    * arbitrary revision and the URL may differ if the add is
    * being driven from a merge which will have a different URL. */
   if (status != svn_wc__db_status_deleted
-      && status != svn_wc__db_status_obstructed_delete
       && status != svn_wc__db_status_not_present)
     {
       /* ### Should we match copyfrom_revision? */
@@ -731,29 +722,21 @@ svn_wc__adm_destroy(svn_wc__db_t *db,
 
   SVN_ERR(svn_wc__write_check(db, dir_abspath, scratch_pool));
 
-#ifdef SVN_WC__SINGLE_DB
   SVN_ERR(svn_wc__db_get_wcroot(&adm_abspath, db, dir_abspath,
                                 scratch_pool, scratch_pool));
-#endif
-
 
   /* Well, the coast is clear for blowing away the administrative
      directory, which also removes the lock */
   SVN_ERR(svn_wc__db_temp_forget_directory(db, dir_abspath, scratch_pool));
 
-#ifndef SVN_WC__SINGLE_DB
-  adm_abspath = svn_wc__adm_child(dir_abspath, NULL, scratch_pool);
-  SVN_ERR(svn_io_remove_dir2(adm_abspath, FALSE, NULL, NULL, scratch_pool));
-#else
-  /* ### We should check if we are the only user of this DB!!! */
-
+  /* ### We should check if we are the only user of this DB, or
+         perhaps call svn_wc__db_drop_root? */
   if (strcmp(adm_abspath, dir_abspath) == 0)
     SVN_ERR(svn_io_remove_dir2(svn_wc__adm_child(adm_abspath, NULL,
                                                  scratch_pool),
                                FALSE,
                                cancel_func, cancel_baton,
                                scratch_pool));
-#endif
 
   return SVN_NO_ERROR;
 }

Modified: subversion/branches/ignore-mergeinfo/subversion/libsvn_wc/adm_ops.c
URL: http://svn.apache.org/viewvc/subversion/branches/ignore-mergeinfo/subversion/libsvn_wc/adm_ops.c?rev=1044516&r1=1044515&r2=1044516&view=diff
==============================================================================
--- subversion/branches/ignore-mergeinfo/subversion/libsvn_wc/adm_ops.c (original)
+++ subversion/branches/ignore-mergeinfo/subversion/libsvn_wc/adm_ops.c Fri Dec 10 21:23:03 2010
@@ -150,8 +150,7 @@ process_committed_leaf(svn_wc__db_t *db,
     adm_abspath = svn_dirent_dirname(local_abspath, scratch_pool);
   SVN_ERR(svn_wc__write_check(db, adm_abspath, scratch_pool));
 
-  if (status == svn_wc__db_status_deleted
-      || status == svn_wc__db_status_obstructed_delete)
+  if (status == svn_wc__db_status_deleted)
     {
       return svn_error_return(svn_wc__wq_add_deletion_postcommit(
                                 db, local_abspath, new_revnum, no_unlock,
@@ -308,8 +307,7 @@ svn_wc__process_committed_internal(svn_w
                  those entries will already have been removed (as a result
                  of running the log for the replaced directory that was
                  created at the start of this function). */
-              if (status == svn_wc__db_status_deleted
-                  || status == svn_wc__db_status_obstructed_delete)
+              if (status == svn_wc__db_status_deleted)
                 {
                   svn_boolean_t replaced;
 
@@ -580,139 +578,6 @@ erase_unversioned_from_wc(const char *pa
   return SVN_NO_ERROR;
 }
 
-#ifndef SVN_WC__SINGLE_DB
-/* Remove/erase LOCAL_ABSPATH from the working copy. For files this involves
- * deletion from the physical filesystem.  For directories it involves the
- * deletion from the filesystem of all unversioned children, and all
- * versioned children that are files. By the time we get here, added but
- * not committed items will have been scheduled for deletion which means
- * they have become unversioned.
- *
- * The result is that all that remains are versioned directories, each with
- * its .svn directory and .svn contents.
- *
- * If CANCEL_FUNC is non-null, invoke it with CANCEL_BATON at various
- * points, return any error immediately.
- *
- * KIND is the node kind appropriate for PATH
- */
-static svn_error_t *
-erase_from_wc(svn_wc__db_t *db,
-              const char *local_abspath,
-              svn_wc__db_kind_t kind,
-              svn_cancel_func_t cancel_func,
-              void *cancel_baton,
-              apr_pool_t *scratch_pool)
-{
-  if (cancel_func)
-    SVN_ERR(cancel_func(cancel_baton));
-
-  if (kind == svn_wc__db_kind_file || kind == svn_wc__db_kind_symlink)
-    {
-      SVN_ERR(svn_io_remove_file2(local_abspath, TRUE, scratch_pool));
-    }
-  else if (kind == svn_wc__db_kind_dir)
-    /* This must be a directory or absent */
-    {
-      const apr_array_header_t *children;
-      svn_wc__db_kind_t db_kind;
-      apr_pool_t *iterpool;
-      apr_hash_t *versioned_dirs = apr_hash_make(scratch_pool);
-      apr_hash_t *unversioned;
-      apr_hash_index_t *hi;
-      svn_error_t *err;
-      int i;
-
-      SVN_ERR(svn_wc__db_read_kind(&db_kind, db, local_abspath, TRUE,
-                                   scratch_pool));
-      if (db_kind != svn_wc__db_kind_dir)
-        return SVN_NO_ERROR;
-
-      iterpool = svn_pool_create(scratch_pool);
-
-      SVN_ERR(svn_wc__db_read_children(&children, db, local_abspath,
-                                       scratch_pool, iterpool));
-      for (i = 0; i < children->nelts; i++)
-        {
-          const char *name = APR_ARRAY_IDX(children, i, const char *);
-          svn_wc__db_status_t status;
-          const char *node_abspath;
-
-          svn_pool_clear(iterpool);
-
-          node_abspath = svn_dirent_join(local_abspath, name, iterpool);
-
-          SVN_ERR(svn_wc__db_read_info(&status, &db_kind, NULL, NULL, NULL,
-                                       NULL, NULL, NULL, NULL, NULL, NULL,
-                                       NULL, NULL, NULL, NULL, NULL, NULL,
-                                       NULL, NULL, NULL, NULL, NULL, NULL,
-                                       NULL,
-                                       db, node_abspath, iterpool, iterpool));
-
-          if (status == svn_wc__db_status_absent ||
-              status == svn_wc__db_status_not_present ||
-              status == svn_wc__db_status_obstructed ||
-              status == svn_wc__db_status_obstructed_add ||
-              status == svn_wc__db_status_obstructed_delete ||
-              status == svn_wc__db_status_excluded)
-            continue; /* Not here */
-
-          /* ### We don't have to record dirs once we have a single database */
-          if (db_kind == svn_wc__db_kind_dir)
-            apr_hash_set(versioned_dirs, name, APR_HASH_KEY_STRING, name);
-
-          SVN_ERR(erase_from_wc(db, node_abspath, db_kind,
-                                cancel_func, cancel_baton,
-                                iterpool));
-        }
-
-      /* Now handle any remaining unversioned items */
-      err = svn_io_get_dirents3(&unversioned, local_abspath, TRUE,
-                                scratch_pool, scratch_pool);
-      if (err)
-        {
-          svn_pool_destroy(iterpool);
-
-          if (APR_STATUS_IS_ENOENT(err->apr_err) ||
-              SVN__APR_STATUS_IS_ENOTDIR(err->apr_err))
-            {
-              svn_error_clear(err);
-              return SVN_NO_ERROR;
-            }
-
-          return svn_error_return(err);
-        }
-
-      for (hi = apr_hash_first(scratch_pool, unversioned);
-           hi;
-           hi = apr_hash_next(hi))
-        {
-          const char *name = svn__apr_hash_index_key(hi);
-
-          svn_pool_clear(iterpool);
-
-          /* The admin directory will show up, we don't want to delete it */
-          if (svn_wc_is_adm_dir(name, iterpool))
-            continue;
-
-          /* Versioned directories will show up, don't delete those either */
-          if (apr_hash_get(versioned_dirs, name, APR_HASH_KEY_STRING))
-            continue;
-
-          SVN_ERR(erase_unversioned_from_wc(svn_dirent_join(local_abspath,
-                                                            name, iterpool),
-                                            FALSE,
-                                            cancel_func, cancel_baton,
-                                            iterpool));
-        }
-
-      svn_pool_destroy(iterpool);
-    }
-
-  return SVN_NO_ERROR;
-}
-#endif
-
 svn_error_t *
 svn_wc_delete4(svn_wc_context_t *wc_ctx,
                const char *local_abspath,
@@ -789,14 +654,20 @@ svn_wc_delete4(svn_wc_context_t *wc_ctx,
 
   if (kind == svn_wc__db_kind_dir)
     {
-      
+      /* ### NODE_DATA We recurse into the subtree here, which is fine,
+         except that we also need to record the op_depth to pass to
+         svn_wc__db_temp_op_delete(), which is determined by the original
+         path for which svn_wc_delete4() was called. We need a helper
+         function which receives the op_depth as an argument to apply to
+         the entire subtree.
+       */
       apr_pool_t *iterpool = svn_pool_create(pool);
       const apr_array_header_t *children;
       int i;
 
       SVN_ERR(svn_wc__db_read_children(&children, db, local_abspath,
                                        pool, pool));
-      
+
       for (i = 0; i < children->nelts; i++)
         {
           const char *child_basename = APR_ARRAY_IDX(children, i, const char *);
@@ -830,10 +701,6 @@ svn_wc_delete4(svn_wc_context_t *wc_ctx,
              Luckily most of this is for free once properties and pristine
              are handled in the WC-NG way. */
       SVN_ERR(svn_wc__db_temp_op_delete(wc_ctx->db, local_abspath, pool));
-#ifndef SVN_WC__SINGLE_DB
-      if (keep_local)
-        SVN_ERR(svn_wc__db_temp_set_keep_local(db, local_abspath, TRUE, pool));
-#endif
     }
 
   /* Report the deletion to the caller. */
@@ -860,12 +727,6 @@ svn_wc_delete4(svn_wc_context_t *wc_ctx,
      become unversioned */
   if (!keep_local)
     {
-#ifndef SVN_WC__SINGLE_DB
-      if (!was_add)
-        SVN_ERR(erase_from_wc(wc_ctx->db, local_abspath, kind,
-                              cancel_func, cancel_baton, pool));
-      else
-#endif
         SVN_ERR(erase_unversioned_from_wc(local_abspath, TRUE,
                                           cancel_func, cancel_baton,
                                           pool));
@@ -890,10 +751,8 @@ svn_wc_add4(svn_wc_context_t *wc_ctx,
   const char *base_name;
   const char *parent_repos_relpath;
   const char *repos_root_url, *repos_uuid;
-  svn_boolean_t is_replace = FALSE;
   svn_boolean_t is_wc_root = FALSE;
   svn_node_kind_t kind;
-  svn_boolean_t node_exists;
   svn_wc__db_t *db = wc_ctx->db;
   svn_error_t *err;
   svn_wc__db_status_t status;
@@ -944,24 +803,18 @@ svn_wc_add4(svn_wc_context_t *wc_ctx,
       svn_error_clear(err);
       exists = FALSE;
       is_wc_root = FALSE;
-      node_exists = FALSE;
     }
   else
     {
       is_wc_root = FALSE;
       exists = TRUE;
-      node_exists = TRUE;
       switch (status)
         {
           case svn_wc__db_status_not_present:
-            node_exists = FALSE;
             break;
           case svn_wc__db_status_deleted:
-          case svn_wc__db_status_obstructed_delete:
             /* A working copy root should never have a WORKING_NODE */
             SVN_ERR_ASSERT(!is_wc_root);
-            node_exists = FALSE;
-            is_replace = TRUE;
             break;
           case svn_wc__db_status_normal:
             if (copyfrom_url)
@@ -984,19 +837,6 @@ svn_wc_add4(svn_wc_context_t *wc_ctx,
         }
     } /* err */
 
-#ifndef SINGLE_DB
-    if (exists 
-        && ((kind == svn_node_dir && db_kind != svn_wc__db_kind_dir)
-            || (kind == svn_node_file && db_kind != svn_wc__db_kind_file)))
-      return svn_error_createf(
-                 SVN_ERR_WC_NODE_KIND_CHANGE, NULL,
-                 _("Can't replace '%s' with a node of a differing type; "
-                   "the deletion must be committed and the parent updated "
-                   "before adding '%s'"),
-                 svn_dirent_local_style(local_abspath, scratch_pool),
-                 svn_dirent_local_style(local_abspath, scratch_pool));
-#endif
-
   SVN_ERR(svn_wc__write_check(db, parent_abspath, scratch_pool));
 
   {
@@ -1013,9 +853,7 @@ svn_wc_add4(svn_wc_context_t *wc_ctx,
     if (err
         || parent_status == svn_wc__db_status_not_present
         || parent_status == svn_wc__db_status_excluded
-        || parent_status == svn_wc__db_status_absent
-        || parent_status == svn_wc__db_status_obstructed
-        || parent_status == svn_wc__db_status_obstructed_add)
+        || parent_status == svn_wc__db_status_absent)
       {
         return
           svn_error_createf(SVN_ERR_ENTRY_NOT_FOUND, err,
@@ -1024,8 +862,7 @@ svn_wc_add4(svn_wc_context_t *wc_ctx,
                             svn_dirent_local_style(local_abspath,
                                                    scratch_pool));
       }
-    else if (parent_status == svn_wc__db_status_deleted
-             || parent_status == svn_wc__db_status_obstructed_delete)
+    else if (parent_status == svn_wc__db_status_deleted)
       {
         return
           svn_error_createf(SVN_ERR_WC_SCHEDULE_CONFLICT, NULL,
@@ -1105,70 +942,6 @@ svn_wc_add4(svn_wc_context_t *wc_ctx,
                                                         scratch_pool),
                                  copyfrom_url, inner_url);
     }
-#ifndef SINGLE_DB
-  else if (kind == svn_node_dir && !node_exists && !is_replace)
-    {
-      svn_wc__db_status_t absent_status;
-      svn_wc__db_kind_t absent_kind;
-      const char *absent_repos_relpath, *absent_repos_root_url;
-      const char *absent_repos_uuid;
-      svn_revnum_t absent_revision;
-
-      /* Read the not present status from the parent working copy,
-         to reinsert it after hooking up the child working copy */
-
-      err = svn_wc__db_base_get_info(&absent_status,
-                                     &absent_kind,
-                                     &absent_revision,
-                                     &absent_repos_relpath,
-                                     &absent_repos_root_url,
-                                     &absent_repos_uuid,
-                                     NULL, NULL, NULL, NULL, NULL,
-                                     NULL, NULL, NULL, NULL,
-                                     db, local_abspath,
-                                     scratch_pool, scratch_pool);
-
-      if (err && err->apr_err != SVN_ERR_WC_PATH_NOT_FOUND)
-        return svn_error_return(err);
-      else
-        svn_error_clear(err);
-
-      /* Make sure this new directory has an admistrative subdirectory
-         created inside of it.
-
-         This creates a BASE_NODE for an added directory, really
-         it should create a WORKING_NODE.  We just remove the
-         node directly (without touching a possible not-present
-         node in the parent stub) */
-      SVN_ERR(svn_wc__internal_ensure_adm(db, local_abspath,
-                                          repos_root_url, repos_root_url,
-                                          repos_uuid, 0,
-                                          depth, scratch_pool));
-
-      if (!err && absent_status == svn_wc__db_status_not_present)
-        SVN_ERR(svn_wc__db_base_add_absent_node(db, local_abspath,
-                                                absent_repos_relpath,
-                                                absent_repos_root_url,
-                                                absent_repos_uuid,
-                                                absent_revision,
-                                                absent_kind,
-                                                absent_status,
-                                                NULL,
-                                                NULL,
-                                                scratch_pool));
-      else
-        SVN_ERR(svn_wc__db_base_remove(db, local_abspath, scratch_pool));
-    }
-#endif
-
-#ifndef SVN_WC__SINGLE_DB
-  if (kind == svn_node_dir && !exists)
-    {
-      /* Lock on parent needs to be propogated into the child db. */
-      SVN_ERR(svn_wc__db_wclock_obtain(db, local_abspath, 0, FALSE,
-                                       scratch_pool));
-    }
-#endif
 
   if (kind == svn_node_file)
     {
@@ -1196,7 +969,6 @@ svn_wc_add4(svn_wc_context_t *wc_ctx,
     {
       SVN_ERR(svn_wc__db_op_add_directory(db, local_abspath, NULL,
                                           scratch_pool));
-#ifdef SVN_WC__SINGLE_DB
       if (!exists)
         {
           /* If using the legacy 1.6 interface the parent lock may not
@@ -1211,7 +983,6 @@ svn_wc_add4(svn_wc_context_t *wc_ctx,
             SVN_ERR(svn_wc__db_wclock_obtain(db, local_abspath, 0, FALSE,
                                              scratch_pool));
         }
-#endif
     }
   else if (!is_wc_root)
     SVN_ERR(svn_wc__db_op_copy_dir(db,
@@ -1235,56 +1006,6 @@ svn_wc_add4(svn_wc_context_t *wc_ctx,
   else
     {
       svn_boolean_t owns_lock;
-#ifndef SVN_WC__SINGLE_DB
-      svn_wc__db_status_t absent_status;
-      svn_wc__db_kind_t absent_kind;
-      const char *absent_repos_relpath, *absent_repos_root_url;
-      const char *absent_repos_uuid;
-      svn_revnum_t absent_revision;
-
-      /* Read the not present status from the parent working copy,
-         to reinsert it after hooking up the child working copy */
-
-      err = svn_wc__db_base_get_info_from_parent(&absent_status,
-                                                 &absent_kind,
-                                                 &absent_revision,
-                                                 &absent_repos_relpath,
-                                                 &absent_repos_root_url,
-                                                 &absent_repos_uuid,
-                                                 db, local_abspath,
-                                                 scratch_pool, scratch_pool);
-
-      if (err && err->apr_err != SVN_ERR_WC_PATH_NOT_FOUND)
-        return svn_error_return(err);
-      else
-        svn_error_clear(err);
-
-      /* ### Temporary hack: Hook the inner working copy to the parent
-             working copy to work around that temp_op_make_copy() doesn't
-             add a working_node stub for its root if there is no base_node
-             stub. */
-      SVN_ERR(svn_wc__db_temp_set_parent_stub_to_normal(db, local_abspath,
-                                                        FALSE, scratch_pool));
-
-      /* Transfer all nodes below LOCAL_ABSPATH from BASE_NODE to
-         WORKING_NODE */
-      SVN_ERR(svn_wc__db_temp_op_make_copy(db, local_abspath, TRUE,
-                                           scratch_pool));
-
-      if (!err && absent_status == svn_wc__db_status_not_present)
-        SVN_ERR(svn_wc__db_base_add_absent_node(db, local_abspath,
-                                                absent_repos_relpath,
-                                                absent_repos_root_url,
-                                                absent_repos_uuid,
-                                                absent_revision,
-                                                absent_kind,
-                                                absent_status,
-                                                NULL,
-                                                NULL,
-                                                scratch_pool));
-      else
-        SVN_ERR(svn_wc__db_base_remove(db, local_abspath, scratch_pool));
-#else
       const char *tmpdir_abspath, *moved_abspath, *moved_adm_abspath;
       const char *adm_abspath = svn_wc__adm_child(local_abspath, "",
                                                   scratch_pool);
@@ -1312,7 +1033,6 @@ svn_wc_add4(svn_wc_context_t *wc_ctx,
       SVN_ERR(svn_wc__db_drop_root(db, moved_abspath, scratch_pool));
       SVN_ERR(svn_io_remove_dir2(moved_abspath, FALSE, NULL, NULL,
                                  scratch_pool));
-#endif
 
       /* The subdir is now part of our parent working copy. Our caller assumes
          that we return the new node locked, so obtain a lock if we didn't
@@ -1452,10 +1172,12 @@ revert_entry(svn_depth_t *depth,
              svn_boolean_t *did_revert,
              apr_pool_t *pool)
 {
-  svn_wc__db_status_t status;
-  svn_wc__db_kind_t kind;
+  svn_wc__db_status_t status, base_status;
+  svn_wc__db_kind_t kind, base_kind;
   svn_boolean_t replaced;
   svn_boolean_t have_base;
+  svn_revnum_t base_revision;
+  svn_boolean_t is_add_root;
 
   /* Initialize this even though revert_admin_things() is guaranteed
      to set it, because we don't know that revert_admin_things() will
@@ -1469,14 +1191,32 @@ revert_entry(svn_depth_t *depth,
                                NULL, NULL,
                                db, local_abspath, pool, pool));
 
-  SVN_ERR(svn_wc__internal_is_replaced(&replaced, db, local_abspath, pool));
+  if (have_base)
+    SVN_ERR(svn_wc__db_base_get_info(&base_status, &base_kind, &base_revision,
+                                     NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+                                     NULL, NULL, NULL, NULL, NULL,
+                                     db, local_abspath, pool, pool));
+
+  replaced = (status == svn_wc__db_status_added
+              && have_base
+              && base_status != svn_wc__db_status_not_present);
+
+  if (status == svn_wc__db_status_added)
+    {
+      const char *op_root_abspath;
+      SVN_ERR(svn_wc__db_scan_addition(NULL, &op_root_abspath, NULL, NULL,
+                                       NULL, NULL, NULL, NULL, NULL,
+                                       db, local_abspath, pool, pool));
+
+      is_add_root = (strcmp(op_root_abspath, local_abspath) == 0);
+    }
+  else
+    is_add_root = FALSE;
 
   /* Additions. */
-  if ((status == svn_wc__db_status_added
-       || status == svn_wc__db_status_obstructed_add)
-      && !replaced)
+  if (!replaced
+      && is_add_root)
     {
-      svn_revnum_t base_revision;
       const char *repos_relpath;
       const char *repos_root_url;
       const char *repos_uuid;
@@ -1488,31 +1228,19 @@ revert_entry(svn_depth_t *depth,
          The code below will then figure out the repository information, so
          that we can later insert a node for the same repository. */
 
-      if (have_base)
+      if (have_base
+          && base_status == svn_wc__db_status_not_present)
         {
-            svn_wc__db_status_t base_status;
-            SVN_ERR(svn_wc__db_base_get_info(&base_status, NULL,
-                                             &base_revision, &repos_relpath,
-                                             &repos_root_url, &repos_uuid,
-                                             NULL, NULL, NULL, NULL, NULL,
-                                             NULL, NULL, NULL, NULL,
-                                             db, local_abspath,
-                                             pool, pool));
-
-            if (base_status == svn_wc__db_status_not_present)
-            {
-                /* Remember the BASE revision.  */
-                /* Remember the repository this node is associated with.  */
+          /* Remember the BASE revision. (already handled)  */
+          /* Remember the repository this node is associated with.  */
 
-                was_not_present = TRUE;
+          was_not_present = TRUE;
 
-                if (!repos_root_url)
-                  SVN_ERR(svn_wc__db_scan_base_repos(&repos_relpath,
-                                                     &repos_root_url,
-                                                     &repos_uuid,
-                                                     db, local_abspath,
-                                                     pool, pool));
-            }
+          SVN_ERR(svn_wc__db_scan_base_repos(&repos_relpath,
+                                             &repos_root_url,
+                                             &repos_uuid,
+                                             db, local_abspath,
+                                             pool, pool));
         }
 
       /* ### much of this is probably bullshit. we should be able to just
@@ -1532,31 +1260,14 @@ revert_entry(svn_depth_t *depth,
         }
       else if (kind == svn_wc__db_kind_dir)
         {
-#ifndef SVN_WC__SINGLE_DB
           /* Before single-db we didn't have to perform a recursive delete
              here. With single-db we really must delete missing nodes */
-          if (disk_kind == svn_node_none
-              || status == svn_wc__db_status_obstructed_add)
-            {
-              /* Schedule add but missing, just remove the entry
-                 or it's missing an adm area in which case
-                 svn_wc_adm_probe_retrieve() returned the parent's
-                 adm_access, for which we definitely can't use the 'else'
-                 code path (as it will remove the parent from version
-                 control... (See issue 2425) */
-              SVN_ERR(svn_wc__db_temp_op_remove_entry(db, local_abspath,
-                                                      pool));
-            }
-          else
-#endif
-            {
-              SVN_ERR(svn_wc__internal_remove_from_revision_control(
-                                           db,
-                                           local_abspath,
-                                           FALSE, FALSE,
-                                           cancel_func, cancel_baton,
-                                           pool));
-            }
+          SVN_ERR(svn_wc__internal_remove_from_revision_control(db,
+                                                                local_abspath,
+                                                                FALSE, FALSE,
+                                                                cancel_func,
+                                                                cancel_baton,
+                                                                pool));
         }
       else  /* Else it's `none', or something exotic like a symlink... */
         {
@@ -1577,12 +1288,11 @@ revert_entry(svn_depth_t *depth,
          sure we leave a not-present node behind */
       if (was_not_present)
         {
-          SVN_ERR(svn_wc__db_base_add_absent_node(
+          SVN_ERR(svn_wc__db_base_add_not_present_node(
                     db, local_abspath,
                     repos_relpath, repos_root_url, repos_uuid,
                     base_revision,
-                    kind,
-                    svn_wc__db_status_not_present,
+                    base_kind,
                     NULL, NULL,
                     pool));
         }
@@ -1591,7 +1301,8 @@ revert_entry(svn_depth_t *depth,
   /* Deletions and replacements. */
   else if (status == svn_wc__db_status_normal
            || status == svn_wc__db_status_deleted
-           || replaced)
+           || replaced
+           || (status == svn_wc__db_status_added && !is_add_root))
     {
       /* Revert the prop and text mods (if any). */
       SVN_ERR(revert_admin_things(&reverted, db, local_abspath,
@@ -1609,6 +1320,72 @@ revert_entry(svn_depth_t *depth,
   return SVN_NO_ERROR;
 }
 
+/* Verifies if an add (or copy) to LOCAL_ABSPATH can be reverted with depth
+ * DEPTH, without touching nodes that are filtered by DEPTH.
+ *
+ * Use ROOT_ABSPATH for generating error messages.
+ */
+static svn_error_t *
+verify_revert_depth(svn_wc__db_t *db,
+                    const char *local_abspath,
+                    svn_depth_t depth,
+                    const char *root_abspath,
+                    apr_pool_t *scratch_pool)
+{
+  const apr_array_header_t *children;
+  apr_pool_t *iterpool = svn_pool_create(scratch_pool);
+  int i;
+
+  SVN_ERR_ASSERT(depth >= svn_depth_empty && depth < svn_depth_infinity);
+
+  SVN_ERR(svn_wc__db_read_children(&children, db, local_abspath,
+                                   scratch_pool, iterpool));
+
+  for (i = 0; i < children->nelts; i++)
+    {
+      const char *name = APR_ARRAY_IDX(children, i, const char *);
+      const char *child_abspath;
+      svn_wc__db_status_t status;
+      svn_wc__db_kind_t kind;
+
+      svn_pool_clear(iterpool);
+
+      child_abspath = svn_dirent_join(local_abspath, name, iterpool);
+
+      SVN_ERR(svn_wc__db_read_info(&status, &kind, NULL, NULL, NULL, NULL,
+                                   NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+                                   NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+                                   NULL, NULL, NULL, NULL,
+                                   db, child_abspath, iterpool, iterpool));
+
+      /* Not-here and deleted nodes won't be reverted by reverting an operation
+         on a parent, so we can just skip them for the depth check. */
+      if (status == svn_wc__db_status_not_present
+          || status == svn_wc__db_status_absent
+          || status == svn_wc__db_status_excluded
+          || status == svn_wc__db_status_deleted)
+        continue;
+
+      if (depth == svn_depth_empty
+          || (depth == svn_depth_files && kind == svn_wc__db_kind_dir))
+        {
+          return svn_error_createf(
+                        SVN_ERR_WC_INVALID_OPERATION_DEPTH, NULL,
+                        _("Can't revert '%s' with this depth, as that requires"
+                          " reverting '%s'."),
+                        svn_dirent_local_style(root_abspath, iterpool),
+                        svn_dirent_local_style(child_abspath, iterpool));
+        }
+
+      if (kind == svn_wc__db_kind_dir)
+        SVN_ERR(verify_revert_depth(db, child_abspath, svn_depth_empty,
+                                    root_abspath, iterpool));
+    }
+
+  svn_pool_destroy(iterpool);
+
+  return SVN_NO_ERROR;
+}
 
 /* This is just the guts of svn_wc_revert4() save that it accepts a
    hash CHANGELIST_HASH whose keys are changelist names instead of an
@@ -1678,13 +1455,7 @@ revert_internal(svn_wc__db_t *db,
   SVN_ERR(svn_io_check_path(local_abspath, &disk_kind, pool));
   if (!unversioned && (db_kind == svn_wc__db_kind_dir))
     {
-#ifndef SVN_WC__SINGLE_DB
-      if ((disk_kind != svn_node_dir)
-          && (status != svn_wc__db_status_added)
-          && (status != svn_wc__db_status_obstructed_add))
-#else
       if (disk_kind == svn_node_file)
-#endif
         {
           /* When the directory itself is missing, we can't revert without
              hitting the network.  Someday a '--force' option will
@@ -1721,6 +1492,24 @@ revert_internal(svn_wc__db_t *db,
        _("Cannot revert '%s': unsupported node kind in working copy"),
        svn_dirent_local_style(local_abspath, pool));
 
+  /* Safeguard 4:  Make sure we don't revert deeper then asked */
+  if (status == svn_wc__db_status_added
+      && db_kind == svn_wc__db_kind_dir
+      && depth >= svn_depth_empty
+      && depth < svn_depth_infinity)
+    {
+      const char *op_root_abspath;
+      SVN_ERR(svn_wc__db_scan_addition(NULL, &op_root_abspath, NULL, NULL,
+                                       NULL, NULL, NULL, NULL, NULL,
+                                       db, local_abspath, pool, pool));
+
+      /* If this node is an operation root for a copy/add, then reverting
+         it will change its descendants, if it has any. */
+      if (strcmp(local_abspath, op_root_abspath) == 0)
+        SVN_ERR(verify_revert_depth(db, local_abspath, depth,
+                                    local_abspath, pool));
+    }
+
   /* If the entry passes changelist filtering, revert it!  */
   if (svn_wc__internal_changelist_match(db, local_abspath, changelist_hash,
                                         pool))
@@ -2052,18 +1841,6 @@ svn_wc__internal_remove_from_revision_co
         }
 
     }  /* done with file case */
-#ifndef SVN_WC__SINGLE_DB
-  else if (status == svn_wc__db_status_obstructed
-           || status == svn_wc__db_status_obstructed_add
-           || status == svn_wc__db_status_obstructed_delete)
-    {
-      /* The directory is missing  so don't try to recurse, in
-         not existing administrative data, just delete the
-         entry in the parent directory. */
-      SVN_ERR(svn_wc__db_temp_op_remove_entry(db, local_abspath,
-                                              scratch_pool));
-    }
-#endif
   else /* looking at THIS_DIR */
     {
       apr_pool_t *iterpool = svn_pool_create(scratch_pool);

Modified: subversion/branches/ignore-mergeinfo/subversion/libsvn_wc/cleanup.c
URL: http://svn.apache.org/viewvc/subversion/branches/ignore-mergeinfo/subversion/libsvn_wc/cleanup.c?rev=1044516&r1=1044515&r2=1044516&view=diff
==============================================================================
--- subversion/branches/ignore-mergeinfo/subversion/libsvn_wc/cleanup.c (original)
+++ subversion/branches/ignore-mergeinfo/subversion/libsvn_wc/cleanup.c Fri Dec 10 21:23:03 2010
@@ -77,12 +77,7 @@ cleanup_internal(svn_wc__db_t *db,
                  apr_pool_t *scratch_pool)
 {
   int wc_format;
-#ifdef SVN_WC__SINGLE_DB
   const char *cleanup_abspath;
-#else
-  const apr_array_header_t *children;
-  int i;
-#endif
   apr_pool_t *iterpool = svn_pool_create(scratch_pool);
 
   /* Check cancellation; note that this catches recursive calls too. */
@@ -92,14 +87,9 @@ cleanup_internal(svn_wc__db_t *db,
   /* Can we even work with this directory?  */
   SVN_ERR(can_be_cleaned(&wc_format, db, adm_abspath, iterpool));
 
-#ifdef SVN_WC__SINGLE_DB
   /* ### This fails if ADM_ABSPATH is locked indirectly via a
      ### recursive lock on an ancestor. */
   SVN_ERR(svn_wc__db_wclock_obtain(db, adm_abspath, -1, TRUE, iterpool));
-#else
-  /* Lock this working copy directory, or steal an existing lock */
-  SVN_ERR(svn_wc__db_wclock_obtain(db, adm_abspath, 0, TRUE, iterpool));
-#endif
 
   /* Run our changes before the subdirectories. We may not have to recurse
      if we blow away a subdir.  */
@@ -107,39 +97,6 @@ cleanup_internal(svn_wc__db_t *db,
     SVN_ERR(svn_wc__wq_run(db, adm_abspath, cancel_func, cancel_baton,
                            iterpool));
 
-#ifndef SVN_WC__SINGLE_DB
-  /* Recurse on versioned, existing subdirectories.  */
-  SVN_ERR(svn_wc__db_read_children(&children, db, adm_abspath,
-                                   scratch_pool, iterpool));
-  for (i = 0; i < children->nelts; i++)
-    {
-      const char *name = APR_ARRAY_IDX(children, i, const char *);
-      const char *entry_abspath;
-      svn_wc__db_kind_t kind;
-
-      svn_pool_clear(iterpool);
-      entry_abspath = svn_dirent_join(adm_abspath, name, iterpool);
-
-      SVN_ERR(svn_wc__db_read_kind(&kind, db, entry_abspath, FALSE, iterpool));
-
-      if (kind == svn_wc__db_kind_dir)
-        {
-          svn_node_kind_t disk_kind;
-
-          SVN_ERR(svn_io_check_path(entry_abspath, &disk_kind, iterpool));
-          if (disk_kind == svn_node_dir)
-            SVN_ERR(cleanup_internal(db, entry_abspath,
-                                     cancel_func, cancel_baton,
-                                     iterpool));
-        }
-    }
-#endif
-
-#ifndef SVN_WC__SINGLE_DB
-  /* Purge the DAV props at and under ADM_ABSPATH. */
-  /* ### in single-db mode, we need do this purge at the top-level only. */
-  SVN_ERR(svn_wc__db_base_clear_dav_cache_recursive(db, adm_abspath, iterpool));
-#else
   SVN_ERR(svn_wc__db_get_wcroot(&cleanup_abspath, db, adm_abspath,
                                 iterpool, iterpool));
 
@@ -150,8 +107,6 @@ cleanup_internal(svn_wc__db_t *db,
    */
   if (strcmp(cleanup_abspath, adm_abspath) == 0)
     {
-#endif
-
     /* Cleanup the tmp area of the admin subdir, if running the log has not
        removed it!  The logs have been run, so anything left here has no hope
        of being useful. */
@@ -159,9 +114,7 @@ cleanup_internal(svn_wc__db_t *db,
 
       /* Remove unreferenced pristine texts */
       SVN_ERR(svn_wc__db_pristine_cleanup(db, adm_abspath, iterpool));
-#ifdef SVN_WC__SINGLE_DB
     }
-#endif
 
   /* All done, toss the lock */
   SVN_ERR(svn_wc__db_wclock_release(db, adm_abspath, iterpool));
@@ -195,12 +148,10 @@ svn_wc_cleanup3(svn_wc_context_t *wc_ctx
   SVN_ERR(cleanup_internal(db, local_abspath, cancel_func, cancel_baton,
                            scratch_pool));
 
-#ifdef SINGLE_DB
-  /* Purge the DAV props at and under LOCAL_ABSPATH. */
-  /* ### in single-db mode, we need do this purge at the top-level only. */
+  /* The DAV cache suffers from flakiness from time to time, and the
+     pre-1.7 prescribed workarounds aren't as user-friendly in WC-NG. */
   SVN_ERR(svn_wc__db_base_clear_dav_cache_recursive(db, local_abspath,
                                                     scratch_pool));
-#endif
 
   /* We're done with this DB, so proactively close it.  */
   SVN_ERR(svn_wc__db_close(db));