More merging from the explore-wc branch to trunk.

Revisions merged, and primary (desired) change:
  35677: remove a bunch of unused functions from entries.c

Post-merge, I needed to make a minor modification to find the new
svn_wc__write_entry_old() function over in old-and-busted.c.

* subversion/libsvn_wc/entries.c:
  (...): plain old merge
  (svn_wc__entries_init): call svn_wc__write_entry_old instead of write_entry


git-svn-id: https://svn.apache.org/repos/asf/subversion/trunk@875993 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/subversion/libsvn_wc/entries.c b/subversion/libsvn_wc/entries.c
index aaf072e..1660b20 100644
--- a/subversion/libsvn_wc/entries.c
+++ b/subversion/libsvn_wc/entries.c
@@ -103,226 +103,6 @@
 
 #ifdef UNUSED_NOW
 
-/* Read an escaped byte on the form 'xHH' from [*BUF, END), placing
-   the byte in *RESULT.  Advance *BUF to point after the escape
-   sequence. */
-static svn_error_t *
-read_escaped(char *result, char **buf, const char *end)
-{
-  apr_uint64_t val;
-  char digits[3];
-
-  if (end - *buf < 3 || **buf != 'x' || ! svn_ctype_isxdigit((*buf)[1])
-      || ! svn_ctype_isxdigit((*buf)[2]))
-    return svn_error_create(SVN_ERR_WC_CORRUPT, NULL,
-                            _("Invalid escape sequence"));
-  (*buf)++;
-  digits[0] = *((*buf)++);
-  digits[1] = *((*buf)++);
-  digits[2] = 0;
-  if ((val = apr_strtoi64(digits, NULL, 16)) == 0)
-    return svn_error_create(SVN_ERR_WC_CORRUPT, NULL,
-                            _("Invalid escaped character"));
-  *result = (char) val;
-  return SVN_NO_ERROR;
-}
-
-/* Read a field, possibly with escaped bytes, from [*BUF, END),
-   stopping at the terminator.  Place the read string in *RESULT, or set
-   *RESULT to NULL if it is the empty string.  Allocate the returned string
-   in POOL.  Advance *BUF to point after the terminator. */
-static svn_error_t *
-read_str(const char **result,
-         char **buf, const char *end,
-         apr_pool_t *pool)
-{
-  svn_stringbuf_t *s = NULL;
-  const char *start;
-  if (*buf == end)
-    return svn_error_create(SVN_ERR_WC_CORRUPT, NULL,
-                            _("Unexpected end of entry"));
-  if (**buf == '\n')
-    {
-      *result = NULL;
-      (*buf)++;
-      return SVN_NO_ERROR;
-    }
-
-  start = *buf;
-  while (*buf != end && **buf != '\n')
-    {
-      if (**buf == '\\')
-        {
-          char c;
-          if (! s)
-            s = svn_stringbuf_ncreate(start, *buf - start, pool);
-          else
-            svn_stringbuf_appendbytes(s, start, *buf - start);
-          (*buf)++;
-          SVN_ERR(read_escaped(&c, buf, end));
-          svn_stringbuf_appendbytes(s, &c, 1);
-          start = *buf;
-        }
-      else
-        (*buf)++;
-    }
-
-  if (*buf == end)
-    return svn_error_create(SVN_ERR_WC_CORRUPT, NULL,
-                            _("Unexpected end of entry"));
-
-  if (s)
-    {
-      svn_stringbuf_appendbytes(s, start, *buf - start);
-      *result = s->data;
-    }
-  else
-    *result = apr_pstrndup(pool, start, *buf - start);
-  (*buf)++;
-  return SVN_NO_ERROR;
-}
-
-/* This is wrapper around read_str() (which see for details); it
-   simply asks svn_path_is_canonical() of the string it reads,
-   returning an error if the test fails. */
-static svn_error_t *
-read_path(const char **result,
-          char **buf, const char *end,
-          apr_pool_t *pool)
-{
-  SVN_ERR(read_str(result, buf, end, pool));
-  if (*result && **result && (! svn_path_is_canonical(*result, pool)))
-    return svn_error_createf(SVN_ERR_WC_CORRUPT, NULL,
-                             _("Entry contains non-canonical path '%s'"),
-                             *result);
-  return SVN_NO_ERROR;
-}
-
-/* This is read_path() for urls. This function does not do the is_canonical
-   test for entries from working copies older than version 10, as since that
-   version the canonicalization of urls has been changed. See issue #2475.
-   If the test is done and fails, read_url returs an error. */
-static svn_error_t *
-read_url(const char **result,
-         char **buf, const char *end,
-         int wc_format,
-         apr_pool_t *pool)
-{
-  SVN_ERR(read_str(result, buf, end, pool));
-
-  /* If the wc format is <10 canonicalize the url, */
-  if (*result && **result)
-    {
-      if (wc_format < SVN_WC__CHANGED_CANONICAL_URLS)
-        *result = svn_path_canonicalize(*result, pool);
-      else
-        if (! svn_path_is_canonical(*result, pool))
-          return svn_error_createf(SVN_ERR_WC_CORRUPT, NULL,
-                                   _("Entry contains non-canonical path '%s'"),
-                                   *result);
-    }
-  return SVN_NO_ERROR;
-}
-
-/* Read a field from [*BUF, END), terminated by a newline character.
-   The field may not contain escape sequences.  The field is not
-   copied and the buffer is modified in place, by replacing the
-   terminator with a NUL byte.  Make *BUF point after the original
-   terminator. */
-static svn_error_t *
-read_val(const char **result,
-          char **buf, const char *end)
-{
-  const char *start = *buf;
-
-  if (*buf == end)
-    return svn_error_create(SVN_ERR_WC_CORRUPT, NULL,
-                            _("Unexpected end of entry"));
-  if (**buf == '\n')
-    {
-      (*buf)++;
-      *result = NULL;
-      return SVN_NO_ERROR;
-    }
-
-  while (*buf != end && **buf != '\n')
-    (*buf)++;
-  if (*buf == end)
-    return svn_error_create(SVN_ERR_WC_CORRUPT, NULL,
-                            _("Unexpected end of entry"));
-  **buf = '\0';
-  *result = start;
-  (*buf)++;
-  return SVN_NO_ERROR;
-}
-
-/* Read a boolean field from [*BUF, END), placing the result in
-   *RESULT.  If there is no boolean value (just a terminator), it
-   defaults to false.  Else, the value must match FIELD_NAME, in which
-   case *RESULT will be set to true.  Advance *BUF to point after the
-   terminator. */
-static svn_error_t *
-read_bool(svn_boolean_t *result, const char *field_name,
-          char **buf, const char *end)
-{
-  const char *val;
-  SVN_ERR(read_val(&val, buf, end));
-  if (val)
-    {
-      if (strcmp(val, field_name) != 0)
-        return svn_error_createf(SVN_ERR_WC_CORRUPT, NULL,
-                                 _("Invalid value for field '%s'"),
-                                 field_name);
-      *result = TRUE;
-    }
-  else
-    *result = FALSE;
-  return SVN_NO_ERROR;
-}
-
-/* Read a revision number from [*BUF, END) stopping at the
-   terminator.  Set *RESULT to the revision number, or
-   SVN_INVALID_REVNUM if there is none.  Use POOL for temporary
-   allocations.  Make *BUF point after the terminator.  */
-static svn_error_t *
-read_revnum(svn_revnum_t *result,
-            char **buf,
-            const char *end,
-            apr_pool_t *pool)
-{
-  const char *val;
-
-  SVN_ERR(read_val(&val, buf, end));
-
-  if (val)
-    *result = SVN_STR_TO_REV(val);
-  else
-    *result = SVN_INVALID_REVNUM;
-
-  return SVN_NO_ERROR;
-}
-
-/* Read a timestamp from [*BUF, END) stopping at the terminator.
-   Set *RESULT to the resulting timestamp, or 0 if there is none.  Use
-   POOL for temporary allocations.  Make *BUF point after the
-   terminator. */
-static svn_error_t *
-read_time(apr_time_t *result,
-          char **buf, const char *end,
-          apr_pool_t *pool)
-{
-  const char *val;
-
-  SVN_ERR(read_val(&val, buf, end));
-  if (val)
-    SVN_ERR(svn_time_from_cstring(result, val, pool));
-  else
-    *result = 0;
-
-  return SVN_NO_ERROR;
-}
-
-
 /**
  * Parse the string at *STR as an revision and save the result in
  * *OPT_REV.  After returning successfully, *STR points at next
@@ -366,8 +146,6 @@
   return SVN_NO_ERROR;
 }
 
-#endif /* UNUSED_NOW */
-
 /**
  * Given a revision, return a string for the revision, either "HEAD"
  * or a string representation of the revision value.  All other
@@ -398,8 +176,6 @@
   return SVN_NO_ERROR;
 }
 
-#ifdef UNUSED_NOW
-
 /* Parse a file external specification in the NULL terminated STR and
    place the path in PATH_RESULT, the peg revision in PEG_REV_RESULT
    and revision number in REV_RESULT.  STR may be NULL, in which case
@@ -438,8 +214,6 @@
   return SVN_NO_ERROR;
 }
 
-#endif /* UNUSED_NOW */
-
 /* Serialize into STR the file external path, peg revision number and
    the operative revision number into a format that
    unserialize_file_external() can parse.  The format is
@@ -475,268 +249,7 @@
   return SVN_NO_ERROR;
 }
 
-
-#ifdef UNUSED_NOW
-
-/* Allocate an entry from POOL and read it from [*BUF, END).  The
-   buffer may be modified in place while parsing.  Return the new
-   entry in *NEW_ENTRY.  Advance *BUF to point at the end of the entry
-   record.
-   The entries file format should be provided in ENTRIES_FORMAT. */
-static svn_error_t *
-read_entry(svn_wc_entry_t **new_entry,
-           char **buf, const char *end,
-           int entries_format,
-           apr_pool_t *pool)
-{
-  svn_wc_entry_t *entry = alloc_entry(pool);
-  const char *name;
-
-#define MAYBE_DONE if (**buf == '\f') goto done
-
-  /* Find the name and set up the entry under that name. */
-  SVN_ERR(read_path(&name, buf, end, pool));
-  entry->name = name ? name : SVN_WC_ENTRY_THIS_DIR;
-
-  /* Set up kind. */
-  {
-    const char *kindstr;
-    SVN_ERR(read_val(&kindstr, buf, end));
-    if (kindstr)
-      {
-        if (strcmp(kindstr, SVN_WC__ENTRIES_ATTR_FILE_STR) == 0)
-          entry->kind = svn_node_file;
-        else if (strcmp(kindstr, SVN_WC__ENTRIES_ATTR_DIR_STR) == 0)
-          entry->kind = svn_node_dir;
-        else
-          return svn_error_createf
-            (SVN_ERR_NODE_UNKNOWN_KIND, NULL,
-             _("Entry '%s' has invalid node kind"),
-             (name ? name : SVN_WC_ENTRY_THIS_DIR));
-      }
-    else
-      entry->kind = svn_node_none;
-  }
-  MAYBE_DONE;
-
-  /* Attempt to set revision (resolve_to_defaults may do it later, too) */
-  SVN_ERR(read_revnum(&entry->revision, buf, end, pool));
-  MAYBE_DONE;
-
-  /* Attempt to set up url path (again, see resolve_to_defaults). */
-  SVN_ERR(read_url(&entry->url, buf, end, entries_format, pool));
-  MAYBE_DONE;
-
-  /* Set up repository root.  Make sure it is a prefix of url. */
-  SVN_ERR(read_url(&entry->repos, buf, end, entries_format, pool));
-  if (entry->repos && entry->url
-      && ! svn_path_is_ancestor(entry->repos, entry->url))
-    return svn_error_createf(SVN_ERR_WC_CORRUPT, NULL,
-                             _("Entry for '%s' has invalid repository "
-                               "root"),
-                             name ? name : SVN_WC_ENTRY_THIS_DIR);
-  MAYBE_DONE;
-
-  /* Look for a schedule attribute on this entry. */
-  {
-    const char *schedulestr;
-    SVN_ERR(read_val(&schedulestr, buf, end));
-    entry->schedule = svn_wc_schedule_normal;
-    if (schedulestr)
-      {
-        if (strcmp(schedulestr, SVN_WC__ENTRY_VALUE_ADD) == 0)
-          entry->schedule = svn_wc_schedule_add;
-        else if (strcmp(schedulestr, SVN_WC__ENTRY_VALUE_DELETE) == 0)
-          entry->schedule = svn_wc_schedule_delete;
-        else if (strcmp(schedulestr, SVN_WC__ENTRY_VALUE_REPLACE) == 0)
-          entry->schedule = svn_wc_schedule_replace;
-        else
-          return svn_error_createf
-            (SVN_ERR_ENTRY_ATTRIBUTE_INVALID, NULL,
-             _("Entry '%s' has invalid '%s' value"),
-             (name ? name : SVN_WC_ENTRY_THIS_DIR),
-             SVN_WC__ENTRY_ATTR_SCHEDULE);
-      }
-  }
-  MAYBE_DONE;
-
-  /* Attempt to set up text timestamp. */
-  SVN_ERR(read_time(&entry->text_time, buf, end, pool));
-  MAYBE_DONE;
-
-  /* Checksum. */
-  SVN_ERR(read_str(&entry->checksum, buf, end, pool));
-  MAYBE_DONE;
-
-  /* Setup last-committed values. */
-  SVN_ERR(read_time(&entry->cmt_date, buf, end, pool));
-  MAYBE_DONE;
-
-  SVN_ERR(read_revnum(&entry->cmt_rev, buf, end, pool));
-  MAYBE_DONE;
-
-  SVN_ERR(read_str(&entry->cmt_author, buf, end, pool));
-  MAYBE_DONE;
-
-  /* has-props, has-prop-mods, cachable-props, present-props are all
-     deprecated. Read any values that may be in the 'entries' file, but
-     discard them, and just put default values into the entry. */
-  {
-    const char *unused_value;
-
-    /* has-props flag. */
-    SVN_ERR(read_val(&unused_value, buf, end));
-    entry->has_props = FALSE;
-    MAYBE_DONE;
-
-    /* has-prop-mods flag. */
-    SVN_ERR(read_val(&unused_value, buf, end));
-    entry->has_prop_mods = FALSE;
-    MAYBE_DONE;
-
-    /* Use the empty string for cachable_props, indicating that we no
-       longer attempt to cache any properties. An empty string for
-       present_props means that no cachable props are present. */
-
-    /* cachable-props string. */
-    SVN_ERR(read_val(&unused_value, buf, end));
-    entry->cachable_props = "";
-    MAYBE_DONE;
-
-    /* present-props string. */
-    SVN_ERR(read_val(&unused_value, buf, end));
-    entry->present_props = "";
-    MAYBE_DONE;
-  }
-
-  /* Is this entry in a state of mental torment (conflict)? */
-  {
-    SVN_ERR(read_path(&entry->prejfile, buf, end, pool));
-    MAYBE_DONE;
-    SVN_ERR(read_path(&entry->conflict_old, buf, end, pool));
-    MAYBE_DONE;
-    SVN_ERR(read_path(&entry->conflict_new, buf, end, pool));
-    MAYBE_DONE;
-    SVN_ERR(read_path(&entry->conflict_wrk, buf, end, pool));
-    MAYBE_DONE;
-  }
-
-  /* Is this entry copied? */
-  SVN_ERR(read_bool(&entry->copied, SVN_WC__ENTRY_ATTR_COPIED, buf, end));
-  MAYBE_DONE;
-
-  SVN_ERR(read_url(&entry->copyfrom_url, buf, end, entries_format, pool));
-  MAYBE_DONE;
-  SVN_ERR(read_revnum(&entry->copyfrom_rev, buf, end, pool));
-  MAYBE_DONE;
-
-  /* Is this entry deleted? */
-  SVN_ERR(read_bool(&entry->deleted, SVN_WC__ENTRY_ATTR_DELETED, buf, end));
-  MAYBE_DONE;
-
-  /* Is this entry absent? */
-  SVN_ERR(read_bool(&entry->absent, SVN_WC__ENTRY_ATTR_ABSENT, buf, end));
-  MAYBE_DONE;
-
-  /* Is this entry incomplete? */
-  SVN_ERR(read_bool(&entry->incomplete, SVN_WC__ENTRY_ATTR_INCOMPLETE,
-                    buf, end));
-  MAYBE_DONE;
-
-  /* UUID. */
-  SVN_ERR(read_str(&entry->uuid, buf, end, pool));
-  MAYBE_DONE;
-
-  /* Lock token. */
-  SVN_ERR(read_str(&entry->lock_token, buf, end, pool));
-  MAYBE_DONE;
-
-  /* Lock owner. */
-  SVN_ERR(read_str(&entry->lock_owner, buf, end, pool));
-  MAYBE_DONE;
-
-  /* Lock comment. */
-  SVN_ERR(read_str(&entry->lock_comment, buf, end, pool));
-  MAYBE_DONE;
-
-  /* Lock creation date. */
-  SVN_ERR(read_time(&entry->lock_creation_date, buf, end, pool));
-  MAYBE_DONE;
-
-  /* Changelist. */
-  SVN_ERR(read_str(&entry->changelist, buf, end, pool));
-  MAYBE_DONE;
-
-  /* Keep entry in working copy after deletion? */
-  SVN_ERR(read_bool(&entry->keep_local, SVN_WC__ENTRY_ATTR_KEEP_LOCAL,
-                    buf, end));
-  MAYBE_DONE;
-
-  /* Translated size */
-  {
-    const char *val;
-
-    /* read_val() returns NULL on an empty (e.g. default) entry line,
-       and entry has already been initialized accordingly already */
-    SVN_ERR(read_val(&val, buf, end));
-    if (val)
-      entry->working_size = (apr_off_t)apr_strtoi64(val, NULL, 0);
-  }
-  MAYBE_DONE;
-
-  /* Depth. */
-  {
-    const char *result;
-    SVN_ERR(read_val(&result, buf, end));
-    if (result)
-      {
-        svn_boolean_t invalid;
-        svn_boolean_t is_this_dir;
-
-        entry->depth = svn_depth_from_word(result);
-
-        /* Verify the depth value:
-           THIS_DIR should not have an excluded value and SUB_DIR should only
-           have excluded value. Remember that infinity value is not stored and
-           should not show up here. Otherwise, something bad may have
-           happened. However, infinity value itself will always be okay. */
-        is_this_dir = !name;
-        /* '!=': XOR */
-        invalid = is_this_dir != (entry->depth != svn_depth_exclude);
-        if (entry->depth != svn_depth_infinity && invalid)
-          return svn_error_createf
-            (SVN_ERR_ENTRY_ATTRIBUTE_INVALID, NULL,
-             _("Entry '%s' has invalid depth"),
-             (name ? name : SVN_WC_ENTRY_THIS_DIR));
-      }
-    else
-      entry->depth = svn_depth_infinity;
-
-  }
-  MAYBE_DONE;
-
-  /* Tree conflict data. */
-  SVN_ERR(read_str(&entry->tree_conflict_data, buf, end, pool));
-  MAYBE_DONE;
-
-  /* File external URL and revision. */
-  {
-    const char *str;
-    SVN_ERR(read_str(&str, buf, end, pool));
-    SVN_ERR(unserialize_file_external(&entry->file_external_path,
-                                      &entry->file_external_peg_rev,
-                                      &entry->file_external_rev,
-                                      str,
-                                      pool));
-  }
-  MAYBE_DONE;
-
- done:
-  *new_entry = entry;
-  return SVN_NO_ERROR;
-}
-
-#endif
+#endif /* UNUSED_NOW */
 
 
 svn_error_t *
@@ -1309,273 +822,6 @@
   return SVN_NO_ERROR;
 }
 
-/* If STR is non-null, append STR to BUF, terminating it with a
-   newline, escaping bytes that needs escaping, using POOL for
-   temporary allocations.  Else if STR is null, just append the
-   terminating newline. */
-static void
-write_str(svn_stringbuf_t *buf, const char *str, apr_pool_t *pool)
-{
-  const char *start = str;
-  if (str)
-    {
-      while (*str)
-        {
-          /* Escape control characters and | and \. */
-          if (svn_ctype_iscntrl(*str) || *str == '\\')
-            {
-              svn_stringbuf_appendbytes(buf, start, str - start);
-              svn_stringbuf_appendcstr(buf,
-                                       apr_psprintf(pool, "\\x%02x", *str));
-              start = str + 1;
-            }
-          ++str;
-        }
-      svn_stringbuf_appendbytes(buf, start, str - start);
-    }
-  svn_stringbuf_appendbytes(buf, "\n", 1);
-}
-
-/* Append the string VAL of length LEN to BUF, without escaping any
-   bytes, followed by a terminator.  If VAL is NULL, ignore LEN and
-   append just the terminator. */
-static void
-write_val(svn_stringbuf_t *buf, const char *val, apr_size_t len)
-{
-  if (val)
-    svn_stringbuf_appendbytes(buf, val, len);
-  svn_stringbuf_appendbytes(buf, "\n", 1);
-}
-
-/* If VAL is true, append FIELD_NAME followed by a terminator to BUF.
-   Else, just append the terminator. */
-static void
-write_bool(svn_stringbuf_t *buf, const char *field_name, svn_boolean_t val)
-{
-  write_val(buf, val ? field_name : NULL, val ? strlen(field_name) : 0);
-}
-
-/* If REVNUM is valid, append the representation of REVNUM to BUF
-   followed by a terminator, using POOL for temporary allocations.
-   Otherwise, just append the terminator. */
-static void
-write_revnum(svn_stringbuf_t *buf, svn_revnum_t revnum, apr_pool_t *pool)
-{
-  if (SVN_IS_VALID_REVNUM(revnum))
-    svn_stringbuf_appendcstr(buf, apr_ltoa(pool, revnum));
-  svn_stringbuf_appendbytes(buf, "\n", 1);
-}
-
-/* Append the timestamp VAL to BUF (or the empty string if VAL is 0),
-   followed by a terminator.  Use POOL for temporary allocations. */
-static void
-write_time(svn_stringbuf_t *buf, apr_time_t val, apr_pool_t *pool)
-{
-  if (val)
-    svn_stringbuf_appendcstr(buf, svn_time_to_cstring(val, pool));
-  svn_stringbuf_appendbytes(buf, "\n", 1);
-}
-
-/* Append a single entry ENTRY to the string OUTPUT, using the
-   entry for "this dir" THIS_DIR for comparison/optimization.
-   Allocations are done in POOL.  */
-static svn_error_t *
-write_entry(svn_stringbuf_t *buf,
-            const svn_wc_entry_t *entry,
-            const char *name,
-            const svn_wc_entry_t *this_dir,
-            apr_pool_t *pool)
-{
-  const char *valuestr;
-  svn_revnum_t valuerev;
-  svn_boolean_t is_this_dir = strcmp(name, SVN_WC_ENTRY_THIS_DIR) == 0;
-  svn_boolean_t is_subdir = ! is_this_dir && (entry->kind == svn_node_dir);
-
-  SVN_ERR_ASSERT(name);
-
-  /* Name. */
-  write_str(buf, name, pool);
-
-  /* Kind. */
-  switch (entry->kind)
-    {
-    case svn_node_dir:
-      write_val(buf, SVN_WC__ENTRIES_ATTR_DIR_STR,
-                 sizeof(SVN_WC__ENTRIES_ATTR_DIR_STR) - 1);
-      break;
-
-    case svn_node_none:
-      write_val(buf, NULL, 0);
-      break;
-
-    case svn_node_file:
-    case svn_node_unknown:
-    default:
-      write_val(buf, SVN_WC__ENTRIES_ATTR_FILE_STR,
-                 sizeof(SVN_WC__ENTRIES_ATTR_FILE_STR) - 1);
-      break;
-    }
-
-  /* Revision. */
-  if (is_this_dir || (! is_subdir && entry->revision != this_dir->revision))
-    valuerev = entry->revision;
-  else
-    valuerev = SVN_INVALID_REVNUM;
-  write_revnum(buf, valuerev, pool);
-
-  /* URL. */
-  if (is_this_dir ||
-      (! is_subdir && strcmp(svn_path_url_add_component2(this_dir->url, name,
-                                                         pool),
-                             entry->url) != 0))
-    valuestr = entry->url;
-  else
-    valuestr = NULL;
-  write_str(buf, valuestr, pool);
-
-  /* Repository root. */
-  if (! is_subdir
-      && (is_this_dir
-          || (this_dir->repos == NULL
-              || (entry->repos
-                  && strcmp(this_dir->repos, entry->repos) != 0))))
-    valuestr = entry->repos;
-  else
-    valuestr = NULL;
-  write_str(buf, valuestr, pool);
-
-  /* Schedule. */
-  switch (entry->schedule)
-    {
-    case svn_wc_schedule_add:
-      write_val(buf, SVN_WC__ENTRY_VALUE_ADD,
-                 sizeof(SVN_WC__ENTRY_VALUE_ADD) - 1);
-      break;
-
-    case svn_wc_schedule_delete:
-      write_val(buf, SVN_WC__ENTRY_VALUE_DELETE,
-                 sizeof(SVN_WC__ENTRY_VALUE_DELETE) - 1);
-      break;
-
-    case svn_wc_schedule_replace:
-      write_val(buf, SVN_WC__ENTRY_VALUE_REPLACE,
-                 sizeof(SVN_WC__ENTRY_VALUE_REPLACE) - 1);
-      break;
-
-    case svn_wc_schedule_normal:
-    default:
-      write_val(buf, NULL, 0);
-      break;
-    }
-
-  /* Text time. */
-  write_time(buf, entry->text_time, pool);
-
-  /* Checksum. */
-  write_val(buf, entry->checksum,
-             entry->checksum ? strlen(entry->checksum) : 0);
-
-  /* Last-commit stuff */
-  write_time(buf, entry->cmt_date, pool);
-  write_revnum(buf, entry->cmt_rev, pool);
-  write_str(buf, entry->cmt_author, pool);
-
-  /* has-props, has-prop-mods, cachable-props, present-props are all
-     deprecated, so write nothing for them. */
-  write_val(buf, NULL, 0);
-  write_val(buf, NULL, 0);
-  write_val(buf, NULL, 0);
-  write_val(buf, NULL, 0);
-
-  /* Conflict. */
-  write_str(buf, entry->prejfile, pool);
-  write_str(buf, entry->conflict_old, pool);
-  write_str(buf, entry->conflict_new, pool);
-  write_str(buf, entry->conflict_wrk, pool);
-
-  write_bool(buf, SVN_WC__ENTRY_ATTR_COPIED, entry->copied);
-
-  /* Copy-related Stuff */
-  write_str(buf, entry->copyfrom_url, pool);
-  write_revnum(buf, entry->copyfrom_rev, pool);
-
-  /* Deleted state */
-  write_bool(buf, SVN_WC__ENTRY_ATTR_DELETED, entry->deleted);
-
-  /* Absent state */
-  write_bool(buf, SVN_WC__ENTRY_ATTR_ABSENT, entry->absent);
-
-  /* Incomplete state */
-  write_bool(buf, SVN_WC__ENTRY_ATTR_INCOMPLETE, entry->incomplete);
-
-  /* UUID. */
-  if (is_this_dir || ! this_dir->uuid || ! entry->uuid
-      || strcmp(this_dir->uuid, entry->uuid) != 0)
-    valuestr = entry->uuid;
-  else
-    valuestr = NULL;
-  write_val(buf, valuestr, valuestr ? strlen(valuestr) : 0);
-
-  /* Lock token. */
-  write_str(buf, entry->lock_token, pool);
-
-  /* Lock owner. */
-  write_str(buf, entry->lock_owner, pool);
-
-  /* Lock comment. */
-  write_str(buf, entry->lock_comment, pool);
-
-  /* Lock creation date. */
-  write_time(buf, entry->lock_creation_date, pool);
-
-  /* Changelist. */
-  write_str(buf, entry->changelist, pool);
-
-  /* Keep in working copy flag. */
-  write_bool(buf, SVN_WC__ENTRY_ATTR_KEEP_LOCAL, entry->keep_local);
-
-  /* Translated size */
-  {
-    const char *val
-      = (entry->working_size != SVN_WC_ENTRY_WORKING_SIZE_UNKNOWN)
-      ? apr_off_t_toa(pool, entry->working_size) : "";
-    write_val(buf, val, strlen(val));
-  }
-
-  /* Depth. */
-  /* Accept `exclude' for subdir entry. */
-  if ((is_subdir && entry->depth != svn_depth_exclude)
-      || entry->depth == svn_depth_infinity)
-    {
-      write_val(buf, NULL, 0);
-    }
-  else
-    {
-      const char *val = svn_depth_to_word(entry->depth);
-      write_val(buf, val, strlen(val));
-    }
-
-  /* Tree conflict data. */
-  write_str(buf, entry->tree_conflict_data, pool);
-
-  /* File externals. */
-  {
-    const char *s;
-    SVN_ERR(serialize_file_external(&s, entry->file_external_path,
-                                    &entry->file_external_peg_rev,
-                                    &entry->file_external_rev, pool));
-    write_str(buf, s, pool);
-  }
-
-  /* Remove redundant separators at the end of the entry. */
-  while (buf->len > 1 && buf->data[buf->len - 2] == '\n')
-    buf->len--;
-
-  svn_stringbuf_appendbytes(buf, "\f\n", 2);
-
-  return SVN_NO_ERROR;
-}
-
 svn_error_t *
 svn_wc__entries_write(apr_hash_t *entries,
                       svn_wc_adm_access_t *adm_access,
@@ -2323,7 +1569,8 @@
   if (initial_rev > 0)
     entry->incomplete = TRUE;
 
-  SVN_ERR(write_entry(accum, entry, SVN_WC_ENTRY_THIS_DIR, entry, pool));
+  SVN_ERR(svn_wc__write_entry_old(accum, entry, SVN_WC_ENTRY_THIS_DIR, entry,
+                                  pool));
 
   len = accum->len;
   SVN_ERR_W(svn_stream_write(stream, accum->data, &len),