Author: stefan2
Date: Fri Jan  2 12:43:42 2015
New Revision: 1649012

URL: http://svn.apache.org/r1649012
Log:
Merge branches/fsx-id in /trunk, remove the BRANCH-README and
resolve trivial conflicts.

Added:
    subversion/trunk/subversion/libsvn_fs_x/fs_id.c
      - copied unchanged from r1649011, 
subversion/branches/fsx-id/subversion/libsvn_fs_x/fs_id.c
    subversion/trunk/subversion/libsvn_fs_x/fs_id.h
      - copied unchanged from r1649011, 
subversion/branches/fsx-id/subversion/libsvn_fs_x/fs_id.h
Modified:
    subversion/trunk/   (props changed)
    subversion/trunk/subversion/libsvn_fs_x/   (props changed)
    subversion/trunk/subversion/libsvn_fs_x/cached_data.c
    subversion/trunk/subversion/libsvn_fs_x/cached_data.h
    subversion/trunk/subversion/libsvn_fs_x/caching.c
    subversion/trunk/subversion/libsvn_fs_x/changes.c
    subversion/trunk/subversion/libsvn_fs_x/dag.c
    subversion/trunk/subversion/libsvn_fs_x/dag.h
    subversion/trunk/subversion/libsvn_fs_x/fs.h
    subversion/trunk/subversion/libsvn_fs_x/fs_x.c
    subversion/trunk/subversion/libsvn_fs_x/id.c
    subversion/trunk/subversion/libsvn_fs_x/id.h
    subversion/trunk/subversion/libsvn_fs_x/index.c
    subversion/trunk/subversion/libsvn_fs_x/index.h
    subversion/trunk/subversion/libsvn_fs_x/low_level.c
    subversion/trunk/subversion/libsvn_fs_x/noderevs.c
    subversion/trunk/subversion/libsvn_fs_x/pack.c
    subversion/trunk/subversion/libsvn_fs_x/temp_serializer.c
    subversion/trunk/subversion/libsvn_fs_x/temp_serializer.h
    subversion/trunk/subversion/libsvn_fs_x/transaction.c
    subversion/trunk/subversion/libsvn_fs_x/transaction.h
    subversion/trunk/subversion/libsvn_fs_x/tree.c
    subversion/trunk/subversion/libsvn_fs_x/tree.h
    subversion/trunk/subversion/libsvn_fs_x/util.c
    subversion/trunk/subversion/libsvn_fs_x/util.h
    subversion/trunk/subversion/libsvn_fs_x/verify.c

Propchange: subversion/trunk/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Fri Jan  2 12:43:42 2015
@@ -20,6 +20,7 @@
 /subversion/branches/fsfs-lock-many:1571740-1577217
 /subversion/branches/fsfs-pack:873717-874575
 /subversion/branches/fsx:1507845-1509914
+/subversion/branches/fsx-id:1645603-1649011
 /subversion/branches/gnome-keyring:870558-871410
 /subversion/branches/gpg-agent-password-store:1005036-1150766
 /subversion/branches/gtest_addition:1452117-1502138

Propchange: subversion/trunk/subversion/libsvn_fs_x/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Fri Jan  2 12:43:42 2015
@@ -20,6 +20,7 @@
 /subversion/branches/fsfs-lock-many/subversion/libsvn_fs_x:1571740-1577217
 /subversion/branches/fsfs-pack/subversion/libsvn_fs_x:873717-874575
 /subversion/branches/fsx/subversion/libsvn_fs_x:1507845-1508040
+/subversion/branches/fsx-id/subversion/libsvn_fs_x:1645603-1649011
 /subversion/branches/gnome-keyring/subversion/libsvn_fs_x:870558-871410
 
/subversion/branches/gpg-agent-password-store/subversion/libsvn_fs_x:1005036-1150766
 /subversion/branches/gtest_addition/subversion/libsvn_fs_x:1452117-1502138

Modified: subversion/trunk/subversion/libsvn_fs_x/cached_data.c
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_fs_x/cached_data.c?rev=1649012&r1=1649011&r2=1649012&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_fs_x/cached_data.c (original)
+++ subversion/trunk/subversion/libsvn_fs_x/cached_data.c Fri Jan  2 12:43:42 
2015
@@ -52,7 +52,7 @@
 static svn_error_t *
 block_read(void **result,
            svn_fs_t *fs,
-           const svn_fs_x__id_part_t *id,
+           const svn_fs_x__id_t *id,
            svn_fs_x__revision_file_t *revision_file,
            apr_pool_t *result_pool,
            apr_pool_t *scratch_pool);
@@ -68,7 +68,7 @@ block_read(void **result,
  */
 static svn_error_t *
 dgb__log_access(svn_fs_t *fs,
-                const svn_fs_x__id_part_t *id,
+                const svn_fs_x__id_t *id,
                 void *item,
                 apr_uint32_t item_type,
                 apr_pool_t *scratch_pool)
@@ -194,7 +194,7 @@ aligned_seek(svn_fs_t *fs,
 static svn_error_t *
 open_and_seek_revision(svn_fs_x__revision_file_t **file,
                        svn_fs_t *fs,
-                       const svn_fs_x__id_part_t *id,
+                       const svn_fs_x__id_t *id,
                        apr_pool_t *pool)
 {
   svn_fs_x__revision_file_t *rev_file;
@@ -253,7 +253,8 @@ open_and_seek_representation(svn_fs_x__r
 
 
 static svn_error_t *
-err_dangling_id(svn_fs_t *fs, const svn_fs_id_t *id)
+err_dangling_id(svn_fs_t *fs,
+                const svn_fs_x__id_t *id)
 {
   svn_string_t *id_str = svn_fs_x__id_unparse(id, fs->pool);
   return svn_error_createf
@@ -269,7 +270,7 @@ err_dangling_id(svn_fs_t *fs, const svn_
 static svn_error_t *
 get_node_revision_body(node_revision_t **noderev_p,
                        svn_fs_t *fs,
-                       const svn_fs_id_t *id,
+                       const svn_fs_x__id_t *id,
                        apr_pool_t *result_pool,
                        apr_pool_t *scratch_pool)
 {
@@ -277,7 +278,7 @@ get_node_revision_body(node_revision_t *
   svn_boolean_t is_cached = FALSE;
   fs_x_data_t *ffd = fs->fsap_data;
 
-  if (svn_fs_x__id_is_txn(id))
+  if (svn_fs_x__is_txn(id->change_set))
     {
       apr_file_t *file;
 
@@ -310,8 +311,7 @@ get_node_revision_body(node_revision_t *
       svn_fs_x__revision_file_t *revision_file;
 
       /* noderevs in rev / pack files can be cached */
-      const svn_fs_x__id_part_t *noderev_id = svn_fs_x__id_noderev_id(id);
-      svn_revnum_t revision = svn_fs_x__get_revnum(noderev_id->change_set);
+      svn_revnum_t revision = svn_fs_x__get_revnum(id->change_set);
       pair_cache_key_t key;
 
       SVN_ERR(svn_fs_x__open_pack_or_rev_file(&revision_file, fs, revision,
@@ -324,7 +324,7 @@ get_node_revision_body(node_revision_t *
           apr_off_t offset;
           apr_uint32_t sub_item;
           SVN_ERR(svn_fs_x__item_offset(&offset, &sub_item, fs, revision_file,
-                                        noderev_id, scratch_pool));
+                                        id, scratch_pool));
           key.revision = svn_fs_x__packed_base_rev(fs, revision);
           key.second = offset;
 
@@ -337,7 +337,7 @@ get_node_revision_body(node_revision_t *
         }
 
       key.revision = revision;
-      key.second = noderev_id->number;
+      key.second = id->number;
 
       /* Not found or not applicable. Try a noderev cache lookup.
        * If that succeeds, we are done here. */
@@ -353,13 +353,13 @@ get_node_revision_body(node_revision_t *
         }
 
       /* read the data from disk */
-      SVN_ERR(open_and_seek_revision(&revision_file, fs, noderev_id,
+      SVN_ERR(open_and_seek_revision(&revision_file, fs, id,
                                      scratch_pool));
 
       /* block-read will parse the whole block and will also return
          the one noderev that we need right now. */
       SVN_ERR(block_read((void **)noderev_p, fs,
-                         noderev_id,
+                         id,
                          revision_file,
                          result_pool,
                          scratch_pool));
@@ -372,12 +372,10 @@ get_node_revision_body(node_revision_t *
 svn_error_t *
 svn_fs_x__get_node_revision(node_revision_t **noderev_p,
                             svn_fs_t *fs,
-                            const svn_fs_id_t *id,
+                            const svn_fs_x__id_t *id,
                             apr_pool_t *result_pool,
                             apr_pool_t *scratch_pool)
 {
-  const svn_fs_x__id_part_t *noderev_id = svn_fs_x__id_noderev_id(id);
-
   svn_error_t *err = get_node_revision_body(noderev_p, fs, id,
                                             result_pool, scratch_pool);
   if (err && err->apr_err == SVN_ERR_FS_CORRUPT)
@@ -388,7 +386,7 @@ svn_fs_x__get_node_revision(node_revisio
                                id_string->data);
     }
 
-  SVN_ERR(dgb__log_access(fs, noderev_id, *noderev_p,
+  SVN_ERR(dgb__log_access(fs, id, *noderev_p,
                           SVN_FS_X__ITEM_TYPE_NODEREV, scratch_pool));
 
   return svn_error_trace(err);
@@ -398,7 +396,7 @@ svn_fs_x__get_node_revision(node_revisio
 svn_error_t *
 svn_fs_x__get_mergeinfo_count(apr_int64_t *count,
                               svn_fs_t *fs,
-                              const svn_fs_id_t *id,
+                              const svn_fs_x__id_t *id,
                               apr_pool_t *pool)
 {
   node_revision_t *noderev;
@@ -408,12 +406,11 @@ svn_fs_x__get_mergeinfo_count(apr_int64_
 #if !defined(SVN_FS_X__LOG_ACCESS)
 
   /* First, try a noderevs container cache lookup. */
-  if (! svn_fs_x__id_is_txn(id))
+  if (! svn_fs_x__is_txn(id->change_set))
     {
       /* noderevs in rev / pack files can be cached */
-      const svn_fs_x__id_part_t *noderev_id = svn_fs_x__id_noderev_id(id);
       fs_x_data_t *ffd = fs->fsap_data;
-      svn_revnum_t revision = svn_fs_x__get_revnum(noderev_id->change_set);
+      svn_revnum_t revision = svn_fs_x__get_revnum(id->change_set);
 
       svn_fs_x__revision_file_t *rev_file;
       SVN_ERR(svn_fs_x__open_pack_or_rev_file(&rev_file, fs, revision, pool,
@@ -428,7 +425,7 @@ svn_fs_x__get_mergeinfo_count(apr_int64_
           svn_boolean_t is_cached;
 
           SVN_ERR(svn_fs_x__item_offset(&offset, &sub_item, fs, rev_file,
-                                        noderev_id, pool));
+                                        id, pool));
           key.revision = svn_fs_x__packed_base_rev(fs, revision);
           key.second = offset;
 
@@ -451,14 +448,13 @@ svn_fs_x__get_mergeinfo_count(apr_int64_
 
 
 svn_error_t *
-svn_fs_x__rev_get_root(svn_fs_id_t **root_id_p,
+svn_fs_x__rev_get_root(svn_fs_x__id_t *root_id,
                        svn_fs_t *fs,
                        svn_revnum_t rev,
-                       apr_pool_t *result_pool,
                        apr_pool_t *scratch_pool)
 {
   SVN_ERR(svn_fs_x__ensure_revision_exists(rev, fs, scratch_pool));
-  *root_id_p = svn_fs_x__id_create_root(rev, result_pool);
+  svn_fs_x__init_rev_root(root_id, rev);
 
   return SVN_NO_ERROR;
 }
@@ -494,7 +490,7 @@ typedef struct rep_state_t
                     /* Caches un-deltified windows. May be NULL. */
   svn_cache__t *combined_cache;
                     /* ID addressing the representation */
-  svn_fs_x__id_part_t rep_id;
+  svn_fs_x__id_t rep_id;
                     /* length of the header at the start of the rep.
                        0 iff this is rep is stored in a container
                        (i.e. does not have a header) */
@@ -2392,14 +2388,14 @@ svn_fs_x__get_file_delta_stream(svn_txde
   return SVN_NO_ERROR;
 }
 
-/* Return TRUE when all svn_fs_dirent_t* in ENTRIES are already sorted
+/* Return TRUE when all dirent_t* in ENTRIES are already sorted
    by their respective name. */
 static svn_boolean_t
 sorted(apr_array_header_t *entries)
 {
   int i;
 
-  const svn_fs_dirent_t * const *dirents = (const void *)entries->elts;
+  const dirent_t * const *dirents = (const void *)entries->elts;
   for (i = 0; i < entries->nelts-1; ++i)
     if (strcmp(dirents[i]->name, dirents[i+1]->name) > 0)
       return FALSE;
@@ -2411,8 +2407,8 @@ sorted(apr_array_header_t *entries)
 static int
 compare_dirents(const void *a, const void *b)
 {
-  const svn_fs_dirent_t *lhs = *((const svn_fs_dirent_t * const *) a);
-  const svn_fs_dirent_t *rhs = *((const svn_fs_dirent_t * const *) b);
+  const dirent_t *lhs = *((const dirent_t * const *) a);
+  const dirent_t *rhs = *((const dirent_t * const *) b);
 
   return strcmp(lhs->name, rhs->name);
 }
@@ -2421,7 +2417,7 @@ compare_dirents(const void *a, const voi
 static int
 compare_dirent_name(const void *a, const void *b)
 {
-  const svn_fs_dirent_t *lhs = *((const svn_fs_dirent_t * const *) a);
+  const dirent_t *lhs = *((const dirent_t * const *) a);
   const char *rhs = b;
 
   return strcmp(lhs->name, rhs);
@@ -2435,7 +2431,7 @@ static svn_error_t *
 read_dir_entries(apr_array_header_t *entries,
                  svn_stream_t *stream,
                  svn_boolean_t incremental,
-                 const svn_fs_id_t *id,
+                 const svn_fs_x__id_t *id,
                  apr_pool_t *result_pool,
                  apr_pool_t *scratch_pool)
 {
@@ -2449,7 +2445,7 @@ read_dir_entries(apr_array_header_t *ent
   while (1)
     {
       svn_hash__entry_t entry;
-      svn_fs_dirent_t *dirent;
+      dirent_t *dirent;
       char *str;
 
       svn_pool_clear(iterpool);
@@ -2483,8 +2479,8 @@ read_dir_entries(apr_array_header_t *ent
       str = svn_cstring_tokenize(" ", &entry.val);
       if (str == NULL)
         return svn_error_createf(SVN_ERR_FS_CORRUPT, NULL,
-                           _("Directory entry corrupt in '%s'"),
-                           svn_fs_x__id_unparse(id, scratch_pool)->data);
+                      _("Directory entry corrupt in '%s'"),
+                      svn_fs_x__id_unparse(id, scratch_pool)->data);
 
       if (strcmp(str, SVN_FS_X__KIND_FILE) == 0)
         {
@@ -2497,24 +2493,24 @@ read_dir_entries(apr_array_header_t *ent
       else
         {
           return svn_error_createf(SVN_ERR_FS_CORRUPT, NULL,
-                           _("Directory entry corrupt in '%s'"),
-                           svn_fs_x__id_unparse(id, scratch_pool)->data);
+                      _("Directory entry corrupt in '%s'"),
+                      svn_fs_x__id_unparse(id, scratch_pool)->data);
         }
 
       str = svn_cstring_tokenize(" ", &entry.val);
       if (str == NULL)
         return svn_error_createf(SVN_ERR_FS_CORRUPT, NULL,
-                           _("Directory entry corrupt in '%s'"),
-                           svn_fs_x__id_unparse(id, scratch_pool)->data);
+                      _("Directory entry corrupt in '%s'"),
+                      svn_fs_x__id_unparse(id, scratch_pool)->data);
 
-      SVN_ERR(svn_fs_x__id_parse(&dirent->id, str, result_pool));
+      SVN_ERR(svn_fs_x__id_parse(&dirent->id, str));
 
       /* In incremental mode, update the hash; otherwise, write to the
        * final array. */
       if (incremental)
         apr_hash_set(hash, entry.key, entry.keylen, dirent);
       else
-        APR_ARRAY_PUSH(entries, svn_fs_dirent_t *) = dirent;
+        APR_ARRAY_PUSH(entries, dirent_t *) = dirent;
     }
 
   /* Convert container to a sorted array. */
@@ -2522,7 +2518,7 @@ read_dir_entries(apr_array_header_t *ent
     {
       apr_hash_index_t *hi;
       for (hi = apr_hash_first(iterpool, hash); hi; hi = apr_hash_next(hi))
-        APR_ARRAY_PUSH(entries, svn_fs_dirent_t *) = apr_hash_this_val(hi);
+        APR_ARRAY_PUSH(entries, dirent_t *) = apr_hash_this_val(hi);
     }
 
   if (!sorted(entries))
@@ -2535,7 +2531,7 @@ read_dir_entries(apr_array_header_t *ent
 
 /* Fetch the contents of a directory into ENTRIES.  Values are stored
    as filename to string mappings; further conversion is necessary to
-   convert them into svn_fs_dirent_t values. */
+   convert them into dirent_t values. */
 static svn_error_t *
 get_dir_contents(apr_array_header_t **entries,
                  svn_fs_t *fs,
@@ -2544,20 +2540,21 @@ get_dir_contents(apr_array_header_t **en
                  apr_pool_t *scratch_pool)
 {
   svn_stream_t *contents;
+  const svn_fs_x__id_t *id = &noderev->noderev_id;
 
-  *entries = apr_array_make(result_pool, 16, sizeof(svn_fs_dirent_t *));
+  *entries = apr_array_make(result_pool, 16, sizeof(dirent_t *));
   if (noderev->data_rep
       && ! svn_fs_x__is_revision(noderev->data_rep->id.change_set))
     {
       const char *filename
-        = svn_fs_x__path_txn_node_children(fs, noderev->id, scratch_pool);
+        = svn_fs_x__path_txn_node_children(fs, id, scratch_pool);
 
       /* The representation is mutable.  Read the old directory
          contents from the mutable children file, followed by the
          changes we've made in this transaction. */
       SVN_ERR(svn_stream_open_readonly(&contents, filename, scratch_pool,
                                        scratch_pool));
-      SVN_ERR(read_dir_entries(*entries, contents, TRUE,  noderev->id,
+      SVN_ERR(read_dir_entries(*entries, contents, TRUE,  id,
                                result_pool, scratch_pool));
       SVN_ERR(svn_stream_close(contents));
     }
@@ -2577,7 +2574,7 @@ get_dir_contents(apr_array_header_t **en
 
       /* de-serialize hash */
       contents = svn_stream_from_stringbuf(text, scratch_pool);
-      SVN_ERR(read_dir_entries(*entries, contents, FALSE,  noderev->id,
+      SVN_ERR(read_dir_entries(*entries, contents, FALSE,  id,
                                result_pool, scratch_pool));
     }
 
@@ -2590,16 +2587,16 @@ get_dir_contents(apr_array_header_t **en
  */
 static svn_cache__t *
 locate_dir_cache(svn_fs_t *fs,
-                 svn_fs_x__id_part_t *key,
+                 svn_fs_x__id_t *key,
                  node_revision_t *noderev,
                  apr_pool_t *pool)
 {
   fs_x_data_t *ffd = fs->fsap_data;
-  if (svn_fs_x__id_is_txn(noderev->id))
+  if (svn_fs_x__is_txn(noderev->noderev_id.change_set))
     {
       /* data in txns must be addressed by ID since the representation has
          not been created, yet. */
-      *key = *svn_fs_x__id_noderev_id(noderev->id);
+      *key = noderev->noderev_id;
     }
   else
     {
@@ -2627,7 +2624,7 @@ svn_fs_x__rep_contents_dir(apr_array_hea
                            apr_pool_t *result_pool,
                            apr_pool_t *scratch_pool)
 {
-  svn_fs_x__id_part_t key;
+  svn_fs_x__id_t key;
 
   /* find the cache we may use */
   svn_cache__t *cache = locate_dir_cache(fs, &key, noderev, scratch_pool);
@@ -2652,18 +2649,18 @@ svn_fs_x__rep_contents_dir(apr_array_hea
   return SVN_NO_ERROR;
 }
 
-svn_fs_dirent_t *
+dirent_t *
 svn_fs_x__find_dir_entry(apr_array_header_t *entries,
                          const char *name,
                          int *hint)
 {
-  svn_fs_dirent_t **result
+  dirent_t **result
     = svn_sort__array_lookup(entries, name, hint, compare_dirent_name);
   return result ? *result : NULL;
 }
 
 svn_error_t *
-svn_fs_x__rep_contents_dir_entry(svn_fs_dirent_t **dirent,
+svn_fs_x__rep_contents_dir_entry(dirent_t **dirent,
                                  svn_fs_t *fs,
                                  node_revision_t *noderev,
                                  const char *name,
@@ -2673,7 +2670,7 @@ svn_fs_x__rep_contents_dir_entry(svn_fs_
   svn_boolean_t found = FALSE;
 
   /* find the cache we may use */
-  svn_fs_x__id_part_t key;
+  svn_fs_x__id_t key;
   svn_cache__t *cache = locate_dir_cache(fs, &key, noderev, scratch_pool);
   if (cache)
     {
@@ -2691,8 +2688,8 @@ svn_fs_x__rep_contents_dir_entry(svn_fs_
   if (! found)
     {
       apr_array_header_t *entries;
-      svn_fs_dirent_t *entry;
-      svn_fs_dirent_t *entry_copy = NULL;
+      dirent_t *entry;
+      dirent_t *entry_copy = NULL;
 
       /* read the dir from the file system. It will probably be put it
          into the cache for faster lookup in future calls. */
@@ -2703,10 +2700,8 @@ svn_fs_x__rep_contents_dir_entry(svn_fs_
       entry = svn_fs_x__find_dir_entry(entries, name, NULL);
       if (entry)
         {
-          entry_copy = apr_palloc(result_pool, sizeof(*entry_copy));
+          entry_copy = apr_pmemdup(result_pool, entry, sizeof(*entry_copy));
           entry_copy->name = apr_pstrdup(result_pool, entry->name);
-          entry_copy->id = svn_fs_x__id_copy(entry->id, result_pool);
-          entry_copy->kind = entry->kind;
         }
 
       *dirent = entry_copy;
@@ -2723,12 +2718,13 @@ svn_fs_x__get_proplist(apr_hash_t **prop
 {
   apr_hash_t *proplist;
   svn_stream_t *stream;
+  const svn_fs_x__id_t *noderev_id = &noderev->noderev_id;
 
   if (noderev->prop_rep
       && !svn_fs_x__is_revision(noderev->prop_rep->id.change_set))
     {
       const char *filename
-        = svn_fs_x__path_txn_node_props(fs, noderev->id, pool);
+        = svn_fs_x__path_txn_node_props(fs, noderev_id, pool);
       proplist = apr_hash_make(pool);
 
       SVN_ERR(svn_stream_open_readonly(&stream, filename, pool, pool));
@@ -2785,7 +2781,7 @@ svn_fs_x__get_changes(apr_array_header_t
   fs_x_data_t *ffd = fs->fsap_data;
   apr_pool_t *scratch_pool = svn_pool_create(result_pool);
 
-  svn_fs_x__id_part_t id;
+  svn_fs_x__id_t id;
   id.change_set = svn_fs_x__change_set_by_rev(rev);
   id.number = SVN_FS_X__ITEM_INDEX_CHANGES;
 
@@ -3172,7 +3168,7 @@ block_read_reps_container(svn_fs_x__rep_
 static svn_error_t *
 block_read(void **result,
            svn_fs_t *fs,
-           const svn_fs_x__id_part_t *id,
+           const svn_fs_x__id_t *id,
            svn_fs_x__revision_file_t *revision_file,
            apr_pool_t *result_pool,
            apr_pool_t *scratch_pool)
@@ -3222,8 +3218,7 @@ block_read(void **result,
           /* the item / container we were looking for? */
           is_wanted =    entry->offset == wanted_offset
                       && entry->item_count >= wanted_sub_item
-                      && svn_fs_x__id_part_eq(entry->items + wanted_sub_item,
-                                              id);
+                      && svn_fs_x__id_eq(entry->items + wanted_sub_item, id);
           is_result = result && is_wanted;
 
           /* select the pool that we want the item to be allocated in */

Modified: subversion/trunk/subversion/libsvn_fs_x/cached_data.h
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_fs_x/cached_data.h?rev=1649012&r1=1649011&r2=1649012&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_fs_x/cached_data.h (original)
+++ subversion/trunk/subversion/libsvn_fs_x/cached_data.h Fri Jan  2 12:43:42 
2015
@@ -36,7 +36,7 @@
 svn_error_t *
 svn_fs_x__get_node_revision(node_revision_t **noderev_p,
                             svn_fs_t *fs,
-                            const svn_fs_id_t *id,
+                            const svn_fs_x__id_t *id,
                             apr_pool_t *result_pool,
                             apr_pool_t *scratch_pool);
 
@@ -45,16 +45,15 @@ svn_fs_x__get_node_revision(node_revisio
 svn_error_t *
 svn_fs_x__get_mergeinfo_count(apr_int64_t *count,
                               svn_fs_t *fs,
-                              const svn_fs_id_t *id,
+                              const svn_fs_x__id_t *id,
                               apr_pool_t *pool);
 
-/* Set *ROOT_ID to the node-id for the root of revision REV in
-   filesystem FS.  Do any allocations in POOL. */
+/* Set *ROOT_ID to the noderev ID for the root of revision REV in
+   filesystem FS.  Do temporary allocations in SCRATCH_POOL. */
 svn_error_t *
-svn_fs_x__rev_get_root(svn_fs_id_t **root_id,
+svn_fs_x__rev_get_root(svn_fs_x__id_t *root_id,
                        svn_fs_t *fs,
                        svn_revnum_t rev,
-                       apr_pool_t *result_pool,
                        apr_pool_t *scratch_pool);
 
 /* Verify that representation REP in FS can be accessed.
@@ -140,7 +139,7 @@ svn_fs_x__rep_contents_dir(apr_array_hea
    entry exists, return NULL.  If HINT is not NULL, set *HINT to the array
    index of the entry returned.  Successive calls in a linear scan scenario
    will be faster called with the same HINT variable. */
-svn_fs_dirent_t *
+dirent_t *
 svn_fs_x__find_dir_entry(apr_array_header_t *entries,
                          const char *name,
                          int *hint);
@@ -150,7 +149,7 @@ svn_fs_x__find_dir_entry(apr_array_heade
    be NULL. The returned object is allocated in RESULT_POOL; SCRATCH_POOL
    used for temporary allocations. */
 svn_error_t *
-svn_fs_x__rep_contents_dir_entry(svn_fs_dirent_t **dirent,
+svn_fs_x__rep_contents_dir_entry(dirent_t **dirent,
                                  svn_fs_t *fs,
                                  node_revision_t *noderev,
                                  const char *name,

Modified: subversion/trunk/subversion/libsvn_fs_x/caching.c
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_fs_x/caching.c?rev=1649012&r1=1649011&r2=1649012&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_fs_x/caching.c (original)
+++ subversion/trunk/subversion/libsvn_fs_x/caching.c Fri Jan  2 12:43:42 2015
@@ -405,27 +405,6 @@ svn_fs_x__initialize_caches(svn_fs_t *fs
                               apr_pool_cleanup_null);
 #endif
 
-  /* Make the cache for revision roots.  For the vast majority of
-   * commands, this is only going to contain a few entries (svnadmin
-   * dump/verify is an exception here), so to reduce overhead let's
-   * try to keep it to just one page.  I estimate each entry has about
-   * 72 bytes of overhead (svn_revnum_t key, svn_fs_id_t +
-   * id_private_t + 3 strings for value, and the cache_entry); the
-   * default pool size is 8192, so about a hundred should fit
-   * comfortably. */
-  SVN_ERR(create_cache(&(ffd->rev_root_id_cache),
-                       NULL,
-                       membuffer,
-                       1, 100,
-                       svn_fs_x__serialize_id,
-                       svn_fs_x__deserialize_id,
-                       sizeof(svn_revnum_t),
-                       apr_pstrcat(pool, prefix, "RRI", SVN_VA_NULL),
-                       0,
-                       fs,
-                       no_handler,
-                       fs->pool, pool));
-
   /* Rough estimate: revision DAG nodes have size around 320 bytes, so
    * let's put 16 on a page. */
   SVN_ERR(create_cache(&(ffd->rev_node_cache),
@@ -451,7 +430,7 @@ svn_fs_x__initialize_caches(svn_fs_t *fs
                        1024, 8,
                        svn_fs_x__serialize_dir_entries,
                        svn_fs_x__deserialize_dir_entries,
-                       sizeof(svn_fs_x__id_part_t),
+                       sizeof(svn_fs_x__id_t),
                        apr_pstrcat(pool, prefix, "DIR", SVN_VA_NULL),
                        SVN_CACHE__MEMBUFFER_DEFAULT_PRIORITY,
                        fs,

Modified: subversion/trunk/subversion/libsvn_fs_x/changes.c
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_fs_x/changes.c?rev=1649012&r1=1649011&r2=1649012&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_fs_x/changes.c (original)
+++ subversion/trunk/subversion/libsvn_fs_x/changes.c Fri Jan  2 12:43:42 2015
@@ -79,9 +79,7 @@ typedef struct binary_change_t
 
   /* Relevant parts of the node revision ID of the change.
    * Empty, if REV_ID is not "used". */
-  svn_fs_x__id_part_t node_id;
-  svn_fs_x__id_part_t copy_id;
-  svn_fs_x__id_part_t noderev_id;
+  svn_fs_x__id_t noderev_id;
 
 } binary_change_t;
 
@@ -140,20 +138,21 @@ append_change(svn_fs_x__changes_t *chang
 {
   binary_change_t binary_change = { 0 };
   svn_boolean_t is_txn_id;
-  svn_fs_path_change2_t *info;
 
   /* CHANGE must be sufficiently complete */
   SVN_ERR_ASSERT(change);
   SVN_ERR_ASSERT(change->path.data);
 
+  /* Relevant parts of the revision ID of the change. */
+  binary_change.noderev_id = change->noderev_id;
+
   /* define the kind of change and what specific information is present */
-  info = &change->info;
-  is_txn_id = info->node_rev_id && svn_fs_x__id_is_txn(info->node_rev_id);
-  binary_change.flags = (info->text_mod ? CHANGE_TEXT_MOD : 0)
-                      | (info->prop_mod ? CHANGE_PROP_MOD : 0)
+  is_txn_id = svn_fs_x__is_txn(binary_change.noderev_id.change_set);
+  binary_change.flags = (change->text_mod ? CHANGE_TEXT_MOD : 0)
+                      | (change->prop_mod ? CHANGE_PROP_MOD : 0)
                       | (is_txn_id ? CHANGE_TXN_NODE : 0)
-                      | ((int)info->change_kind << CHANGE_KIND_SHIFT)
-                      | ((int)info->node_kind << CHANGE_NODE_SHIFT);
+                      | ((int)change->change_kind << CHANGE_KIND_SHIFT)
+                      | ((int)change->node_kind << CHANGE_NODE_SHIFT);
 
   /* Path of the change. */
   binary_change.path
@@ -162,12 +161,12 @@ append_change(svn_fs_x__changes_t *chang
                                          change->path.len);
 
   /* copy-from information, if presence is indicated by FLAGS */
-  if (SVN_IS_VALID_REVNUM(info->copyfrom_rev))
+  if (SVN_IS_VALID_REVNUM(change->copyfrom_rev))
     {
-      binary_change.copyfrom_rev = info->copyfrom_rev;
+      binary_change.copyfrom_rev = change->copyfrom_rev;
       binary_change.copyfrom_path
         = svn_fs_x__string_table_builder_add(changes->builder,
-                                             info->copyfrom_path,
+                                             change->copyfrom_path,
                                              0);
     }
   else
@@ -176,19 +175,6 @@ append_change(svn_fs_x__changes_t *chang
       binary_change.copyfrom_path = 0;
     }
 
-  /* Relevant parts of the revision ID of the change. */
-  if (info->node_rev_id)
-    {
-      binary_change.node_id = *svn_fs_x__id_node_id(info->node_rev_id);
-      binary_change.copy_id = *svn_fs_x__id_copy_id(info->node_rev_id);
-      binary_change.noderev_id = *svn_fs_x__id_noderev_id(info->node_rev_id);
-    }
-  else
-    {
-      binary_change.noderev_id.number = 0;
-      binary_change.noderev_id.change_set = SVN_FS_X__INVALID_CHANGE_SET;
-    }
-
   APR_ARRAY_PUSH(changes->changes, binary_change_t) = binary_change;
 
   return SVN_NO_ERROR;
@@ -267,29 +253,25 @@ svn_fs_x__changes_get_list(apr_array_hea
 
       /* convert BINARY_CHANGE into a standard FSX change_t */
       change_t *change = apr_pcalloc(pool, sizeof(*change));
-      svn_fs_path_change2_t *info = &change->info;
       change->path.data = svn_fs_x__string_table_get(changes->paths,
                                                      binary_change->path,
                                                      &change->path.len,
                                                      pool);
 
       if (binary_change->noderev_id.change_set != SVN_FS_X__INVALID_CHANGE_SET)
-        info->node_rev_id = svn_fs_x__id_create(&binary_change->node_id,
-                                                &binary_change->copy_id,
-                                                &binary_change->noderev_id,
-                                                pool);
+        change->noderev_id = binary_change->noderev_id;
 
-      info->change_kind = (svn_fs_path_change_kind_t)
+      change->change_kind = (svn_fs_path_change_kind_t)
         ((binary_change->flags & CHANGE_KIND_MASK) >> CHANGE_KIND_SHIFT);
-      info->text_mod = (binary_change->flags & CHANGE_TEXT_MOD) != 0;
-      info->prop_mod = (binary_change->flags & CHANGE_PROP_MOD) != 0;
-      info->node_kind = (svn_node_kind_t)
+      change->text_mod = (binary_change->flags & CHANGE_TEXT_MOD) != 0;
+      change->prop_mod = (binary_change->flags & CHANGE_PROP_MOD) != 0;
+      change->node_kind = (svn_node_kind_t)
         ((binary_change->flags & CHANGE_NODE_MASK) >> CHANGE_NODE_SHIFT);
 
-      info->copyfrom_rev = binary_change->copyfrom_rev;
-      info->copyfrom_known = TRUE;
+      change->copyfrom_rev = binary_change->copyfrom_rev;
+      change->copyfrom_known = TRUE;
       if (SVN_IS_VALID_REVNUM(binary_change->copyfrom_rev))
-        info->copyfrom_path 
+        change->copyfrom_path 
           = svn_fs_x__string_table_get(changes->paths,
                                         binary_change->copyfrom_path,
                                         NULL,
@@ -330,11 +312,7 @@ svn_fs_x__write_changes_container(svn_st
   svn_packed__create_int_substream(changes_stream, TRUE, FALSE);
   svn_packed__create_int_substream(changes_stream, TRUE, TRUE);
   svn_packed__create_int_substream(changes_stream, TRUE, FALSE);
-  svn_packed__create_int_substream(changes_stream, TRUE, TRUE);
-  svn_packed__create_int_substream(changes_stream, TRUE, FALSE);
-  svn_packed__create_int_substream(changes_stream, TRUE, TRUE);
-  svn_packed__create_int_substream(changes_stream, TRUE, FALSE);
-  
+
   /* serialize offsets array */
   for (i = 0; i < changes->offsets->nelts; ++i)
     svn_packed__add_uint(offsets_stream,
@@ -352,10 +330,6 @@ svn_fs_x__write_changes_container(svn_st
       svn_packed__add_int(changes_stream, change->copyfrom_rev);
       svn_packed__add_uint(changes_stream, change->copyfrom_path);
 
-      svn_packed__add_int(changes_stream, change->node_id.change_set);
-      svn_packed__add_uint(changes_stream, change->node_id.number);
-      svn_packed__add_int(changes_stream, change->copy_id.change_set);
-      svn_packed__add_uint(changes_stream, change->copy_id.number);
       svn_packed__add_int(changes_stream, change->noderev_id.change_set);
       svn_packed__add_uint(changes_stream, change->noderev_id.number);
     }
@@ -412,10 +386,6 @@ svn_fs_x__read_changes_container(svn_fs_
       change.copyfrom_rev = (svn_revnum_t)svn_packed__get_int(changes_stream);
       change.copyfrom_path = (apr_size_t)svn_packed__get_uint(changes_stream);
 
-      change.node_id.change_set = svn_packed__get_int(changes_stream);
-      change.node_id.number = svn_packed__get_uint(changes_stream);
-      change.copy_id.change_set = svn_packed__get_int(changes_stream);
-      change.copy_id.number = svn_packed__get_uint(changes_stream);
       change.noderev_id.change_set = svn_packed__get_int(changes_stream);
       change.noderev_id.number = svn_packed__get_uint(changes_stream);
 
@@ -533,28 +503,23 @@ svn_fs_x__changes_get_list_func(void **o
 
       /* convert BINARY_CHANGE into a standard FSX change_t */
       change_t *change = apr_pcalloc(pool, sizeof(*change));
-      svn_fs_path_change2_t *info = &change->info;
       change->path.data
         = svn_fs_x__string_table_get_func(paths, binary_change->path,
                                           &change->path.len, pool);
 
-      if (binary_change->noderev_id.change_set != SVN_FS_X__INVALID_CHANGE_SET)
-        info->node_rev_id = svn_fs_x__id_create(&binary_change->node_id,
-                                                &binary_change->copy_id,
-                                                &binary_change->noderev_id,
-                                                pool);
+      change->noderev_id = binary_change->noderev_id;
 
-      info->change_kind = (svn_fs_path_change_kind_t)
+      change->change_kind = (svn_fs_path_change_kind_t)
         ((binary_change->flags & CHANGE_KIND_MASK) >> CHANGE_KIND_SHIFT);
-      info->text_mod = (binary_change->flags & CHANGE_TEXT_MOD) != 0;
-      info->prop_mod = (binary_change->flags & CHANGE_PROP_MOD) != 0;
-      info->node_kind = (svn_node_kind_t)
+      change->text_mod = (binary_change->flags & CHANGE_TEXT_MOD) != 0;
+      change->prop_mod = (binary_change->flags & CHANGE_PROP_MOD) != 0;
+      change->node_kind = (svn_node_kind_t)
         ((binary_change->flags & CHANGE_NODE_MASK) >> CHANGE_NODE_SHIFT);
 
-      info->copyfrom_rev = binary_change->copyfrom_rev;
-      info->copyfrom_known = TRUE;
+      change->copyfrom_rev = binary_change->copyfrom_rev;
+      change->copyfrom_known = TRUE;
       if (SVN_IS_VALID_REVNUM(binary_change->copyfrom_rev))
-        info->copyfrom_path 
+        change->copyfrom_path 
           = svn_fs_x__string_table_get_func(paths,
                                             binary_change->copyfrom_path,
                                             NULL,

Modified: subversion/trunk/subversion/libsvn_fs_x/dag.c
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_fs_x/dag.c?rev=1649012&r1=1649011&r2=1649012&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_fs_x/dag.c (original)
+++ subversion/trunk/subversion/libsvn_fs_x/dag.c Fri Jan  2 12:43:42 2015
@@ -31,7 +31,7 @@
 #include "dag.h"
 #include "fs.h"
 #include "fs_x.h"
-#include "id.h"
+#include "fs_id.h"
 #include "cached_data.h"
 #include "transaction.h"
 
@@ -50,14 +50,14 @@ struct dag_node_t
   /* The filesystem this dag node came from. */
   svn_fs_t *fs;
 
-  /* The node revision ID for this dag node, allocated in POOL.  */
-  svn_fs_id_t *id;
+  /* The node revision ID for this dag node.  */
+  svn_fs_x__id_t id;
 
   /* In the special case that this node is the root of a transaction
      that has not yet been modified, the node revision ID for this dag
      node's predecessor; otherwise NULL. (Used in
      svn_fs_node_created_rev.) */
-  const svn_fs_id_t *fresh_root_predecessor_id;
+  svn_fs_x__id_t fresh_root_predecessor_id;
 
   /* The node's type (file, dir, etc.) */
   svn_node_kind_t kind;
@@ -86,11 +86,10 @@ svn_node_kind_t svn_fs_x__dag_node_kind(
   return node->kind;
 }
 
-
-const svn_fs_id_t *
+const svn_fs_x__id_t *
 svn_fs_x__dag_get_id(const dag_node_t *node)
 {
-  return node->id;
+  return &node->id;
 }
 
 
@@ -120,23 +119,18 @@ static node_revision_t *
 copy_node_revision(node_revision_t *noderev,
                    apr_pool_t *pool)
 {
-  node_revision_t *nr = apr_pcalloc(pool, sizeof(*nr));
-  nr->kind = noderev->kind;
-  if (noderev->predecessor_id)
-    nr->predecessor_id = svn_fs_x__id_copy(noderev->predecessor_id, pool);
-  nr->predecessor_count = noderev->predecessor_count;
+  node_revision_t *nr = apr_pmemdup(pool, noderev, sizeof(*noderev));
+
   if (noderev->copyfrom_path)
     nr->copyfrom_path = apr_pstrdup(pool, noderev->copyfrom_path);
-  nr->copyfrom_rev = noderev->copyfrom_rev;
+
   nr->copyroot_path = apr_pstrdup(pool, noderev->copyroot_path);
-  nr->copyroot_rev = noderev->copyroot_rev;
   nr->data_rep = svn_fs_x__rep_copy(noderev->data_rep, pool);
   nr->prop_rep = svn_fs_x__rep_copy(noderev->prop_rep, pool);
-  nr->mergeinfo_count = noderev->mergeinfo_count;
-  nr->has_mergeinfo = noderev->has_mergeinfo;
 
   if (noderev->created_path)
     nr->created_path = apr_pstrdup(pool, noderev->created_path);
+
   return nr;
 }
 
@@ -162,9 +156,8 @@ get_node_revision(node_revision_t **node
       node_revision_t *noderev;
       apr_pool_t *scratch_pool = svn_pool_create(node->node_pool);
 
-      SVN_ERR(svn_fs_x__get_node_revision(&noderev, node->fs,
-                                          node->id, node->node_pool,
-                                          scratch_pool));
+      SVN_ERR(svn_fs_x__get_node_revision(&noderev, node->fs, &node->id,
+                                          node->node_pool, scratch_pool));
       node->node_revision = noderev;
       svn_pool_destroy(scratch_pool);
     }
@@ -174,17 +167,74 @@ get_node_revision(node_revision_t **node
   return SVN_NO_ERROR;
 }
 
+/* Return the node revision ID of NODE.  The value returned is shared
+   with NODE, and will be deallocated when NODE is.  */
+svn_error_t *
+svn_fs_x__dag_get_node_id(svn_fs_x__id_t *node_id,
+                          dag_node_t *node)
+{
+  node_revision_t *noderev;
+  SVN_ERR(get_node_revision(&noderev, node));
+
+  *node_id = noderev->node_id;
+  return SVN_NO_ERROR;
+}
+
+/* Return the node revision ID of NODE.  The value returned is shared
+   with NODE, and will be deallocated when NODE is.  */
+svn_error_t *
+svn_fs_x__dag_get_copy_id(svn_fs_x__id_t *copy_id,
+                          dag_node_t *node)
+{
+  node_revision_t *noderev;
+  SVN_ERR(get_node_revision(&noderev, node));
+
+  *copy_id = noderev->copy_id;
+  return SVN_NO_ERROR;
+}
+
+/* Return the node ID of NODE.  The value returned is shared with NODE,
+   and will be deallocated when NODE is.  */
+svn_error_t *
+svn_fs_x__dag_related_node(svn_boolean_t *same,
+                           dag_node_t *lhs,
+                           dag_node_t *rhs)
+{
+  svn_fs_x__id_t lhs_node, rhs_node;
+
+  SVN_ERR(svn_fs_x__dag_get_node_id(&lhs_node, lhs));
+  SVN_ERR(svn_fs_x__dag_get_node_id(&rhs_node, rhs));
+  *same = svn_fs_x__id_eq(&lhs_node, &rhs_node);
+
+  return SVN_NO_ERROR;
+}
+
+svn_error_t *
+svn_fs_x__dag_same_line_of_history(svn_boolean_t *same,
+                                   dag_node_t *lhs,
+                                   dag_node_t *rhs)
+{
+  node_revision_t *lhs_noderev, *rhs_noderev;
+
+  SVN_ERR(get_node_revision(&lhs_noderev, lhs));
+  SVN_ERR(get_node_revision(&rhs_noderev, rhs));
+
+  *same = svn_fs_x__id_eq(&lhs_noderev->node_id, &rhs_noderev->node_id)
+       && svn_fs_x__id_eq(&lhs_noderev->copy_id, &rhs_noderev->copy_id);
+
+  return SVN_NO_ERROR;
+}
 
 svn_boolean_t svn_fs_x__dag_check_mutable(const dag_node_t *node)
 {
-  return svn_fs_x__id_is_txn(svn_fs_x__dag_get_id(node));
+  return svn_fs_x__is_txn(svn_fs_x__dag_get_id(node)->change_set);
 }
 
 
 svn_error_t *
 svn_fs_x__dag_get_node(dag_node_t **node,
                        svn_fs_t *fs,
-                       const svn_fs_id_t *id,
+                       const svn_fs_x__id_t *id,
                        apr_pool_t *pool)
 {
   dag_node_t *new_node;
@@ -193,7 +243,7 @@ svn_fs_x__dag_get_node(dag_node_t **node
   /* Construct the node. */
   new_node = apr_pcalloc(pool, sizeof(*new_node));
   new_node->fs = fs;
-  new_node->id = svn_fs_x__id_copy(id, pool);
+  new_node->id = *id;
 
   /* Grab the contents so we can inspect the node's kind and created path. */
   new_node->node_pool = pool;
@@ -206,7 +256,7 @@ svn_fs_x__dag_get_node(dag_node_t **node
   if (noderev->is_fresh_txn_root)
     new_node->fresh_root_predecessor_id = noderev->predecessor_id;
   else
-    new_node->fresh_root_predecessor_id = NULL;
+    svn_fs_x__id_reset(&new_node->fresh_root_predecessor_id);
 
   /* Return a fresh new node */
   *node = new_node;
@@ -214,32 +264,31 @@ svn_fs_x__dag_get_node(dag_node_t **node
 }
 
 
-svn_error_t *
-svn_fs_x__dag_get_revision(svn_revnum_t *rev,
-                           dag_node_t *node,
-                           apr_pool_t *pool)
+svn_revnum_t
+svn_fs_x__dag_get_revision(const dag_node_t *node)
 {
   /* In the special case that this is an unmodified transaction root,
      we need to actually get the revision of the noderev's predecessor
      (the revision root); see Issue #2608. */
-  const svn_fs_id_t *correct_id = node->fresh_root_predecessor_id
-    ? node->fresh_root_predecessor_id : node->id;
+  const svn_fs_x__id_t *correct_id
+    = svn_fs_x__id_used(&node->fresh_root_predecessor_id)
+        ? &node->fresh_root_predecessor_id
+        : &node->id;
 
   /* Look up the committed revision from the Node-ID. */
-  *rev = svn_fs_x__id_rev(correct_id);
-
-  return SVN_NO_ERROR;
+  return svn_fs_x__get_revnum(correct_id->change_set);
 }
 
 
 svn_error_t *
-svn_fs_x__dag_get_predecessor_id(const svn_fs_id_t **id_p,
+svn_fs_x__dag_get_predecessor_id(svn_fs_x__id_t *id_p,
                                  dag_node_t *node)
 {
   node_revision_t *noderev;
 
   SVN_ERR(get_node_revision(&noderev, node));
   *id_p = noderev->predecessor_id;
+
   return SVN_NO_ERROR;
 }
 
@@ -304,21 +353,22 @@ svn_fs_x__dag_has_descendants_with_merge
 
 /* Some of these are helpers for functions outside this section. */
 
-/* Set *ID_P to the node-id for entry NAME in PARENT.  If no such
-   entry, set *ID_P to NULL but do not error.  The node-id is
-   allocated in POOL. */
+/* Set *ID_P to the noderev-id for entry NAME in PARENT.  If no such
+   entry, set *ID_P to NULL but do not error. */
 static svn_error_t *
-dir_entry_id_from_node(const svn_fs_id_t **id_p,
+dir_entry_id_from_node(svn_fs_x__id_t *id_p,
                        dag_node_t *parent,
                        const char *name,
-                       apr_pool_t *result_pool,
                        apr_pool_t *scratch_pool)
 {
-  svn_fs_dirent_t *dirent;
+  dirent_t *dirent;
 
-  SVN_ERR(svn_fs_x__dag_dir_entry(&dirent, parent, name, result_pool,
+  SVN_ERR(svn_fs_x__dag_dir_entry(&dirent, parent, name, scratch_pool,
                                   scratch_pool));
-  *id_p = dirent ? dirent->id : NULL;
+  if (dirent)
+    *id_p = dirent->id;
+  else
+    svn_fs_x__id_reset(id_p);
 
   return SVN_NO_ERROR;
 }
@@ -335,7 +385,7 @@ dir_entry_id_from_node(const svn_fs_id_t
 static svn_error_t *
 set_entry(dag_node_t *parent,
           const char *name,
-          const svn_fs_id_t *id,
+          const svn_fs_x__id_t *id,
           svn_node_kind_t kind,
           svn_fs_x__txn_id_t txn_id,
           apr_pool_t *pool)
@@ -367,7 +417,6 @@ make_entry(dag_node_t **child_p,
            svn_fs_x__txn_id_t txn_id,
            apr_pool_t *pool)
 {
-  const svn_fs_id_t *new_node_id;
   node_revision_t new_noderev, *parent_noderev;
 
   /* Make sure that NAME is a single path component. */
@@ -399,20 +448,20 @@ make_entry(dag_node_t **child_p,
   new_noderev.copyroot_rev = parent_noderev->copyroot_rev;
   new_noderev.copyfrom_rev = SVN_INVALID_REVNUM;
   new_noderev.copyfrom_path = NULL;
+  svn_fs_x__id_reset(&new_noderev.predecessor_id);
 
   SVN_ERR(svn_fs_x__create_node
-          (&new_node_id, svn_fs_x__dag_get_fs(parent), &new_noderev,
-           svn_fs_x__id_copy_id(svn_fs_x__dag_get_id(parent)),
-           txn_id, pool));
+          (svn_fs_x__dag_get_fs(parent), &new_noderev,
+           &parent_noderev->copy_id, txn_id, pool));
 
   /* Create a new dag_node_t for our new node */
   SVN_ERR(svn_fs_x__dag_get_node(child_p, svn_fs_x__dag_get_fs(parent),
-                                 new_node_id, pool));
+                                 &new_noderev.noderev_id, pool));
 
   /* We can safely call set_entry because we already know that
      PARENT is mutable, and we just created CHILD, so we know it has
      no ancestors (therefore, PARENT cannot be an ancestor of CHILD) */
-  return set_entry(parent, name, svn_fs_x__dag_get_id(*child_p),
+  return set_entry(parent, name, &new_noderev.noderev_id,
                    new_noderev.kind, txn_id, pool);
 }
 
@@ -434,11 +483,11 @@ svn_fs_x__dag_dir_entries(apr_array_head
 }
 
 svn_error_t *
-svn_fs_x__dag_dir_entry(svn_fs_dirent_t **dirent,
-                         dag_node_t *node,
-                         const char* name,
-                         apr_pool_t *result_pool,
-                         apr_pool_t *scratch_pool)
+svn_fs_x__dag_dir_entry(dirent_t **dirent,
+                        dag_node_t *node,
+                        const char* name,
+                        apr_pool_t *result_pool,
+                        apr_pool_t *scratch_pool)
 {
   node_revision_t *noderev;
   SVN_ERR(get_node_revision(&noderev, node));
@@ -456,7 +505,7 @@ svn_fs_x__dag_dir_entry(svn_fs_dirent_t
 svn_error_t *
 svn_fs_x__dag_set_entry(dag_node_t *node,
                         const char *entry_name,
-                        const svn_fs_id_t *id,
+                        const svn_fs_x__id_t *id,
                         svn_node_kind_t kind,
                         svn_fs_x__txn_id_t txn_id,
                         apr_pool_t *pool)
@@ -508,7 +557,7 @@ svn_fs_x__dag_set_proplist(dag_node_t *n
   /* Sanity check: this node better be mutable! */
   if (! svn_fs_x__dag_check_mutable(node))
     {
-      svn_string_t *idstr = svn_fs_x__id_unparse(node->id, pool);
+      svn_string_t *idstr = svn_fs_x__id_unparse(&node->id, pool);
       return svn_error_createf
         (SVN_ERR_FS_NOT_MUTABLE, NULL,
          "Can't set proplist on *immutable* node-revision %s",
@@ -533,7 +582,7 @@ svn_fs_x__dag_increment_mergeinfo_count(
   /* Sanity check: this node better be mutable! */
   if (! svn_fs_x__dag_check_mutable(node))
     {
-      svn_string_t *idstr = svn_fs_x__id_unparse(node->id, pool);
+      svn_string_t *idstr = svn_fs_x__id_unparse(&node->id, pool);
       return svn_error_createf
         (SVN_ERR_FS_NOT_MUTABLE, NULL,
          "Can't increment mergeinfo count on *immutable* node-revision %s",
@@ -549,7 +598,7 @@ svn_fs_x__dag_increment_mergeinfo_count(
   noderev->mergeinfo_count += increment;
   if (noderev->mergeinfo_count < 0)
     {
-      svn_string_t *idstr = svn_fs_x__id_unparse(node->id, pool);
+      svn_string_t *idstr = svn_fs_x__id_unparse(&node->id, pool);
       return svn_error_createf
         (SVN_ERR_FS_CORRUPT, NULL,
          apr_psprintf(pool,
@@ -560,7 +609,7 @@ svn_fs_x__dag_increment_mergeinfo_count(
     }
   if (noderev->mergeinfo_count > 1 && noderev->kind == svn_node_file)
     {
-      svn_string_t *idstr = svn_fs_x__id_unparse(node->id, pool);
+      svn_string_t *idstr = svn_fs_x__id_unparse(&node->id, pool);
       return svn_error_createf
         (SVN_ERR_FS_CORRUPT, NULL,
          apr_psprintf(pool,
@@ -571,8 +620,7 @@ svn_fs_x__dag_increment_mergeinfo_count(
     }
 
   /* Flush it out. */
-  return svn_fs_x__put_node_revision(node->fs, noderev->id,
-                                     noderev, FALSE, pool);
+  return svn_fs_x__put_node_revision(node->fs, noderev, FALSE, pool);
 }
 
 svn_error_t *
@@ -585,7 +633,7 @@ svn_fs_x__dag_set_has_mergeinfo(dag_node
   /* Sanity check: this node better be mutable! */
   if (! svn_fs_x__dag_check_mutable(node))
     {
-      svn_string_t *idstr = svn_fs_x__id_unparse(node->id, pool);
+      svn_string_t *idstr = svn_fs_x__id_unparse(&node->id, pool);
       return svn_error_createf
         (SVN_ERR_FS_NOT_MUTABLE, NULL,
          "Can't set mergeinfo flag on *immutable* node-revision %s",
@@ -598,8 +646,7 @@ svn_fs_x__dag_set_has_mergeinfo(dag_node
   noderev->has_mergeinfo = has_mergeinfo;
 
   /* Flush it out. */
-  return svn_fs_x__put_node_revision(node->fs, noderev->id,
-                                     noderev, FALSE, pool);
+  return svn_fs_x__put_node_revision(node->fs, noderev, FALSE, pool);
 }
 
 
@@ -616,7 +663,8 @@ svn_fs_x__dag_revision_root(dag_node_t *
   /* Construct the node. */
   new_node = apr_pcalloc(pool, sizeof(*new_node));
   new_node->fs = fs;
-  SVN_ERR(svn_fs_x__rev_get_root(&new_node->id, fs, rev, pool, pool));
+  SVN_ERR(svn_fs_x__rev_get_root(&new_node->id, fs, rev, pool));
+  svn_fs_x__id_reset(&new_node->fresh_root_predecessor_id);
 
   /* Grab the contents so we can inspect the node's kind and created path. */
   new_node->node_pool = pool;
@@ -624,7 +672,6 @@ svn_fs_x__dag_revision_root(dag_node_t *
   /* Initialize the KIND and CREATED_PATH attributes */
   new_node->kind = svn_node_dir;
   new_node->created_path = "/";
-  new_node->fresh_root_predecessor_id = NULL;
 
   /* Return a fresh new node */
   *node_p = new_node;
@@ -638,10 +685,10 @@ svn_fs_x__dag_txn_root(dag_node_t **node
                        svn_fs_x__txn_id_t txn_id,
                        apr_pool_t *pool)
 {
-  const svn_fs_id_t *root_id, *ignored;
+  svn_fs_x__id_t root_id;
 
-  SVN_ERR(svn_fs_x__get_txn_ids(&root_id, &ignored, fs, txn_id, pool));
-  return svn_fs_x__dag_get_node(node_p, fs, root_id, pool);
+  svn_fs_x__init_txn_root(&root_id, txn_id);
+  return svn_fs_x__dag_get_node(node_p, fs, &root_id, pool);
 }
 
 
@@ -651,10 +698,13 @@ svn_fs_x__dag_txn_base_root(dag_node_t *
                             svn_fs_x__txn_id_t txn_id,
                             apr_pool_t *pool)
 {
-  const svn_fs_id_t *base_root_id, *ignored;
+  svn_fs_x__id_t base_root_id;
+  svn_revnum_t base_rev;
+
+  SVN_ERR(svn_fs_x__get_base_rev(&base_rev, fs, txn_id, pool));
 
-  SVN_ERR(svn_fs_x__get_txn_ids(&ignored, &base_root_id, fs, txn_id, pool));
-  return svn_fs_x__dag_get_node(node_p, fs, base_root_id, pool);
+  svn_fs_x__init_rev_root(&base_root_id, base_rev);
+  return svn_fs_x__dag_get_node(node_p, fs, &base_root_id, pool);
 }
 
 
@@ -663,13 +713,13 @@ svn_fs_x__dag_clone_child(dag_node_t **c
                           dag_node_t *parent,
                           const char *parent_path,
                           const char *name,
-                          const svn_fs_x__id_part_t *copy_id,
+                          const svn_fs_x__id_t *copy_id,
                           svn_fs_x__txn_id_t txn_id,
                           svn_boolean_t is_parent_copyroot,
                           apr_pool_t *pool)
 {
   dag_node_t *cur_entry; /* parent's current entry named NAME */
-  const svn_fs_id_t *new_node_id; /* node id we'll put into NEW_NODE */
+  const svn_fs_x__id_t *new_node_id; /* node id we'll put into NEW_NODE */
   svn_fs_t *fs = svn_fs_x__dag_get_fs(parent);
   apr_pool_t *subpool = svn_pool_create(pool);
 
@@ -697,7 +747,7 @@ svn_fs_x__dag_clone_child(dag_node_t **c
   if (svn_fs_x__dag_check_mutable(cur_entry))
     {
       /* This has already been cloned */
-      new_node_id = cur_entry->id;
+      new_node_id = svn_fs_x__dag_get_id(cur_entry);
     }
   else
     {
@@ -717,13 +767,16 @@ svn_fs_x__dag_clone_child(dag_node_t **c
       noderev->copyfrom_path = NULL;
       noderev->copyfrom_rev = SVN_INVALID_REVNUM;
 
-      noderev->predecessor_id = svn_fs_x__id_copy(cur_entry->id, pool);
+      noderev->predecessor_id = noderev->noderev_id;
       if (noderev->predecessor_count != -1)
         noderev->predecessor_count++;
       noderev->created_path = svn_fspath__join(parent_path, name, pool);
 
-      SVN_ERR(svn_fs_x__create_successor(&new_node_id, fs, cur_entry->id,
-                                          noderev, copy_id, txn_id, pool));
+      if (copy_id == NULL)
+        copy_id = &noderev->copy_id;
+
+      SVN_ERR(svn_fs_x__create_successor(fs, noderev, copy_id, txn_id, pool));
+      new_node_id = &noderev->noderev_id;
 
       /* Replace the ID in the parent's ENTRY list with the ID which
          refers to the mutable clone of this child. */
@@ -744,24 +797,11 @@ svn_fs_x__dag_clone_root(dag_node_t **ro
                          svn_fs_x__txn_id_t txn_id,
                          apr_pool_t *pool)
 {
-  const svn_fs_id_t *base_root_id, *root_id;
-
-  /* Get the node ID's of the root directories of the transaction and
-     its base revision.  */
-  SVN_ERR(svn_fs_x__get_txn_ids(&root_id, &base_root_id, fs, txn_id, pool));
-
-  /* Oh, give me a clone...
-     (If they're the same, we haven't cloned the transaction's root
-     directory yet.)  */
-  SVN_ERR_ASSERT(!svn_fs_x__id_eq(root_id, base_root_id));
-
-  /*
-   * (Sung to the tune of "Home, Home on the Range", with thanks to
-   * Randall Garrett and Isaac Asimov.)
-   */
+  svn_fs_x__id_t root_id;
+  svn_fs_x__init_txn_root(&root_id, txn_id);
 
   /* One way or another, root_id now identifies a cloned root node. */
-  return svn_fs_x__dag_get_node(root_p, fs, root_id, pool);
+  return svn_fs_x__dag_get_node(root_p, fs, &root_id, pool);
 }
 
 
@@ -773,8 +813,7 @@ svn_fs_x__dag_delete(dag_node_t *parent,
 {
   node_revision_t *parent_noderev;
   svn_fs_t *fs = parent->fs;
-  svn_fs_dirent_t *dirent;
-  svn_fs_id_t *id;
+  dirent_t *dirent;
   apr_pool_t *subpool;
 
   /* Make sure parent is a directory. */
@@ -812,13 +851,9 @@ svn_fs_x__dag_delete(dag_node_t *parent,
       (SVN_ERR_FS_NO_SUCH_ENTRY, NULL,
        "Delete failed--directory has no entry '%s'", name);
 
-  /* Copy the ID out of the subpool and release the rest of the
-     directory listing. */
-  id = svn_fs_x__id_copy(dirent->id, pool);
-  svn_pool_destroy(subpool);
-
   /* If mutable, remove it and any mutable children from db. */
-  SVN_ERR(svn_fs_x__dag_delete_if_mutable(parent->fs, id, pool));
+  SVN_ERR(svn_fs_x__dag_delete_if_mutable(parent->fs, &dirent->id, pool));
+  svn_pool_destroy(subpool);
 
   /* Remove this entry from its parent's entries list. */
   return svn_fs_x__set_entry(parent->fs, txn_id, parent_noderev, name,
@@ -827,28 +862,8 @@ svn_fs_x__dag_delete(dag_node_t *parent,
 
 
 svn_error_t *
-svn_fs_x__dag_remove_node(svn_fs_t *fs,
-                          const svn_fs_id_t *id,
-                          apr_pool_t *pool)
-{
-  dag_node_t *node;
-
-  /* Fetch the node. */
-  SVN_ERR(svn_fs_x__dag_get_node(&node, fs, id, pool));
-
-  /* If immutable, do nothing and return immediately. */
-  if (! svn_fs_x__dag_check_mutable(node))
-    return svn_error_createf(SVN_ERR_FS_NOT_MUTABLE, NULL,
-                             "Attempted removal of immutable node");
-
-  /* Delete the node revision. */
-  return svn_fs_x__delete_node_revision(fs, id, pool);
-}
-
-
-svn_error_t *
 svn_fs_x__dag_delete_if_mutable(svn_fs_t *fs,
-                                const svn_fs_id_t *id,
+                                const svn_fs_x__id_t *id,
                                 apr_pool_t *pool)
 {
   dag_node_t *node;
@@ -872,10 +887,11 @@ svn_fs_x__dag_delete_if_mutable(svn_fs_t
       if (entries)
         for (i = 0; i < entries->nelts; ++i)
           {
+            const svn_fs_x__id_t *noderev_id
+              = &APR_ARRAY_IDX(entries, i, dirent_t *)->id;
+
             svn_pool_clear(iterpool);
-            SVN_ERR(svn_fs_x__dag_delete_if_mutable(fs,
-                          APR_ARRAY_IDX(entries, i, svn_fs_dirent_t *)->id,
-                          iterpool));
+            SVN_ERR(svn_fs_x__dag_delete_if_mutable(fs, noderev_id, pool));
           }
 
       svn_pool_destroy(iterpool);
@@ -883,7 +899,7 @@ svn_fs_x__dag_delete_if_mutable(svn_fs_t
 
   /* ... then delete the node itself, after deleting any mutable
      representations and strings it points to. */
-  return svn_fs_x__dag_remove_node(fs, id, pool);
+  return svn_fs_x__delete_node_revision(fs, id, pool);
 }
 
 svn_error_t *
@@ -1083,22 +1099,13 @@ svn_fs_x__dag_dup(const dag_node_t *node
                   apr_pool_t *pool)
 {
   /* Allocate our new node. */
-  dag_node_t *new_node = apr_pcalloc(pool, sizeof(*new_node));
-
-  new_node->fs = node->fs;
-  new_node->id = svn_fs_x__id_copy(node->id, pool);
-  new_node->kind = node->kind;
+  dag_node_t *new_node = apr_pmemdup(pool, node, sizeof(*new_node));
   new_node->created_path = apr_pstrdup(pool, node->created_path);
 
   /* Only copy cached node_revision_t for immutable nodes. */
   if (node->node_revision && !svn_fs_x__dag_check_mutable(node))
-    {
-      new_node->node_revision = copy_node_revision(node->node_revision, pool);
-      new_node->node_revision->id =
-          svn_fs_x__id_copy(node->node_revision->id, pool);
-      new_node->node_revision->is_fresh_txn_root =
-          node->node_revision->is_fresh_txn_root;
-    }
+    new_node->node_revision = copy_node_revision(node->node_revision, pool);
+
   new_node->node_pool = pool;
 
   return new_node;
@@ -1132,8 +1139,6 @@ svn_fs_x__dag_serialize(void **data,
                                 (const void * const *)&node->node_pool);
 
   /* serialize other sub-structures */
-  svn_fs_x__id_serialize(context, (const svn_fs_id_t **)&node->id);
-  svn_fs_x__id_serialize(context, &node->fresh_root_predecessor_id);
   svn_temp_serializer__add_string(context, &node->created_path);
 
   /* return serialized data */
@@ -1159,10 +1164,6 @@ svn_fs_x__dag_deserialize(void **out,
   node->fs = NULL;
 
   /* fixup all references to sub-structures */
-  svn_fs_x__id_deserialize(node, &node->id, pool);
-  svn_fs_x__id_deserialize(node,
-                           (svn_fs_id_t **)&node->fresh_root_predecessor_id,
-                           pool);
   svn_fs_x__noderev_deserialize(node, &node->node_revision, pool);
   node->node_pool = pool;
 
@@ -1181,12 +1182,11 @@ svn_fs_x__dag_open(dag_node_t **child_p,
                    apr_pool_t *result_pool,
                    apr_pool_t *scratch_pool)
 {
-  const svn_fs_id_t *node_id;
+  svn_fs_x__id_t node_id;
 
   /* Ensure that NAME exists in PARENT's entry list. */
-  SVN_ERR(dir_entry_id_from_node(&node_id, parent, name,
-                                 scratch_pool, scratch_pool));
-  if (! node_id)
+  SVN_ERR(dir_entry_id_from_node(&node_id, parent, name, scratch_pool));
+  if (! svn_fs_x__id_used(&node_id))
     {
       *child_p = NULL;
       return SVN_NO_ERROR;
@@ -1200,7 +1200,7 @@ svn_fs_x__dag_open(dag_node_t **child_p,
 
   /* Now get the node that was requested. */
   return svn_fs_x__dag_get_node(child_p, svn_fs_x__dag_get_fs(parent),
-                                node_id, result_pool);
+                                &node_id, result_pool);
 }
 
 
@@ -1214,13 +1214,12 @@ svn_fs_x__dag_copy(dag_node_t *to_node,
                    svn_fs_x__txn_id_t txn_id,
                    apr_pool_t *pool)
 {
-  const svn_fs_id_t *id;
+  const svn_fs_x__id_t *id;
 
   if (preserve_history)
     {
       node_revision_t *from_noderev, *to_noderev;
-      svn_fs_x__id_part_t copy_id;
-      const svn_fs_id_t *src_id = svn_fs_x__dag_get_id(from_node);
+      svn_fs_x__id_t copy_id;
       svn_fs_t *fs = svn_fs_x__dag_get_fs(from_node);
 
       /* Make a copy of the original node revision. */
@@ -1232,7 +1231,7 @@ svn_fs_x__dag_copy(dag_node_t *to_node,
 
       /* Create a successor with its predecessor pointing at the copy
          source. */
-      to_noderev->predecessor_id = svn_fs_x__id_copy(src_id, pool);
+      to_noderev->predecessor_id = to_noderev->noderev_id;
       if (to_noderev->predecessor_count != -1)
         to_noderev->predecessor_count++;
       to_noderev->created_path =
@@ -1244,9 +1243,9 @@ svn_fs_x__dag_copy(dag_node_t *to_node,
       /* Set the copyroot equal to our own id. */
       to_noderev->copyroot_path = NULL;
 
-      SVN_ERR(svn_fs_x__create_successor(&id, fs, src_id, to_noderev,
+      SVN_ERR(svn_fs_x__create_successor(fs, to_noderev,
                                          &copy_id, txn_id, pool));
-
+      id = &to_noderev->noderev_id;
     }
   else  /* don't preserve history */
     {
@@ -1360,11 +1359,11 @@ svn_fs_x__dag_update_ancestry(dag_node_t
   SVN_ERR(get_node_revision(&source_noderev, source));
   SVN_ERR(get_node_revision(&target_noderev, target));
 
-  target_noderev->predecessor_id = source->id;
+  target_noderev->predecessor_id = source_noderev->noderev_id;
   target_noderev->predecessor_count = source_noderev->predecessor_count;
   if (target_noderev->predecessor_count != -1)
     target_noderev->predecessor_count++;
 
-  return svn_fs_x__put_node_revision(target->fs, target->id, target_noderev,
-                                     FALSE, pool);
+  return svn_fs_x__put_node_revision(target->fs, target_noderev, FALSE,
+                                     pool);
 }

Modified: subversion/trunk/subversion/libsvn_fs_x/dag.h
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_fs_x/dag.h?rev=1649012&r1=1649011&r2=1649012&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_fs_x/dag.h (original)
+++ subversion/trunk/subversion/libsvn_fs_x/dag.h Fri Jan  2 12:43:42 2015
@@ -27,6 +27,7 @@
 #include "svn_delta.h"
 #include "private/svn_cache.h"
 
+#include "fs.h"
 #include "id.h"
 
 #ifdef __cplusplus
@@ -68,7 +69,7 @@ typedef struct dag_node_t dag_node_t;
 svn_error_t *
 svn_fs_x__dag_get_node(dag_node_t **node,
                        svn_fs_t *fs,
-                       const svn_fs_id_t *id,
+                       const svn_fs_x__id_t *id,
                        apr_pool_t *pool);
 
 
@@ -104,28 +105,49 @@ svn_fs_t *svn_fs_x__dag_get_fs(dag_node_
 void svn_fs_x__dag_set_fs(dag_node_t *node, svn_fs_t *fs);
 
 
-/* Set *REV to NODE's revision number, allocating in POOL.  If NODE
-   has never been committed as part of a revision, set *REV to
-   SVN_INVALID_REVNUM.  */
-svn_error_t *svn_fs_x__dag_get_revision(svn_revnum_t *rev,
-                                        dag_node_t *node,
-                                        apr_pool_t *pool);
+/* Return NODE's revision number.  If NODE has never been committed as
+   part of a revision, set *REV to SVN_INVALID_REVNUM.  */
+svn_revnum_t svn_fs_x__dag_get_revision(const dag_node_t *node);
 
 
 /* Return the node revision ID of NODE.  The value returned is shared
    with NODE, and will be deallocated when NODE is.  */
-const svn_fs_id_t *svn_fs_x__dag_get_id(const dag_node_t *node);
+const svn_fs_x__id_t *
+svn_fs_x__dag_get_id(const dag_node_t *node);
+
+/* Return the node ID of NODE.  The value returned is shared with NODE,
+   and will be deallocated when NODE is.  */
+svn_error_t *
+svn_fs_x__dag_get_node_id(svn_fs_x__id_t *node_id,
+                          dag_node_t *node);
 
+/* Return the copy ID of NODE.  The value returned is shared with NODE,
+   and will be deallocated when NODE is.  */
+svn_error_t *
+svn_fs_x__dag_get_copy_id(svn_fs_x__id_t *copy_id,
+                          dag_node_t *node);
+
+/* Set *SAME to TRUE, if nodes LHS and RHS have the same node ID. */
+svn_error_t *
+svn_fs_x__dag_related_node(svn_boolean_t *same,
+                           dag_node_t *lhs,
+                           dag_node_t *rhs);
+
+/* Set *SAME to TRUE, if nodes LHS and RHS have the same node and copy IDs.
+ */
+svn_error_t *
+svn_fs_x__dag_same_line_of_history(svn_boolean_t *same,
+                                   dag_node_t *lhs,
+                                   dag_node_t *rhs);
 
 /* Return the created path of NODE.  The value returned is shared
    with NODE, and will be deallocated when NODE is.  */
 const char *svn_fs_x__dag_get_created_path(dag_node_t *node);
 
 
-/* Set *ID_P to the node revision ID of NODE's immediate predecessor,
-   or NULL if NODE has no predecessor.
+/* Set *ID_P to the node revision ID of NODE's immediate predecessor.
  */
-svn_error_t *svn_fs_x__dag_get_predecessor_id(const svn_fs_id_t **id_p,
+svn_error_t *svn_fs_x__dag_get_predecessor_id(svn_fs_x__id_t *id_p,
                                               dag_node_t *node);
 
 
@@ -266,7 +288,7 @@ svn_fs_x__dag_open(dag_node_t **child_p,
 
 
 /* Set *ENTRIES_P to an array of NODE's entries, sorted by entry names,
-   and the values are svn_fs_dirent_t's.  The returned table (and elements)
+   and the values are dirent_t's.  The returned table (and elements)
    is allocated in POOL, which is also used for temporary allocations. */
 svn_error_t *svn_fs_x__dag_dir_entries(apr_array_header_t **entries_p,
                                        dag_node_t *node,
@@ -279,7 +301,7 @@ svn_error_t *svn_fs_x__dag_dir_entries(a
    Otherwise, the *DIRENT will be set to NULL.
  */
 /* ### This function is currently only called from dag.c. */
-svn_error_t * svn_fs_x__dag_dir_entry(svn_fs_dirent_t **dirent,
+svn_error_t * svn_fs_x__dag_dir_entry(dirent_t **dirent,
                                       dag_node_t *node,
                                       const char* name,
                                       apr_pool_t *result_pool,
@@ -296,7 +318,7 @@ svn_error_t * svn_fs_x__dag_dir_entry(sv
  */
 svn_error_t *svn_fs_x__dag_set_entry(dag_node_t *node,
                                      const char *entry_name,
-                                     const svn_fs_id_t *id,
+                                     const svn_fs_x__id_t *id,
                                      svn_node_kind_t kind,
                                      svn_fs_x__txn_id_t txn_id,
                                      apr_pool_t *pool);
@@ -325,7 +347,7 @@ svn_error_t *svn_fs_x__dag_clone_child(d
                                        dag_node_t *parent,
                                        const char *parent_path,
                                        const char *name,
-                                       const svn_fs_x__id_part_t *copy_id,
+                                       const svn_fs_x__id_t *copy_id,
                                        svn_fs_x__txn_id_t txn_id,
                                        svn_boolean_t is_parent_copyroot,
                                        apr_pool_t *pool);
@@ -349,27 +371,13 @@ svn_error_t *svn_fs_x__dag_delete(dag_no
                                   apr_pool_t *pool);
 
 
-/* Delete the node revision assigned to node ID from FS's `nodes'
-   table, allocating from POOL.  Also delete any mutable
-   representations and strings associated with that node revision.  ID
-   may refer to a file or directory, which must be mutable.
-
-   NOTE: If ID represents a directory, and that directory has mutable
-   children, you risk orphaning those children by leaving them
-   dangling, disconnected from all DAG trees.  It is assumed that
-   callers of this interface know what in the world they are doing.  */
-svn_error_t *svn_fs_x__dag_remove_node(svn_fs_t *fs,
-                                       const svn_fs_id_t *id,
-                                       apr_pool_t *pool);
-
-
 /* Delete all mutable node revisions reachable from node ID, including
    ID itself, from FS's `nodes' table, allocating from POOL.  Also
    delete any mutable representations and strings associated with that
    node revision.  ID may refer to a file or directory, which may be
    mutable or immutable. */
 svn_error_t *svn_fs_x__dag_delete_if_mutable(svn_fs_t *fs,
-                                             const svn_fs_id_t *id,
+                                             const svn_fs_x__id_t *id,
                                              apr_pool_t *pool);
 
 

Modified: subversion/trunk/subversion/libsvn_fs_x/fs.h
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_fs_x/fs.h?rev=1649012&r1=1649011&r2=1649012&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_fs_x/fs.h (original)
+++ subversion/trunk/subversion/libsvn_fs_x/fs.h Fri Jan  2 12:43:42 2015
@@ -279,10 +279,6 @@ typedef struct fs_x_data_t
      e.g. memcached may be ignored as caching is an optional feature. */
   svn_boolean_t fail_stop;
 
-  /* A cache of revision root IDs, mapping from (svn_revnum_t *) to
-     (svn_fs_id_t *).  (Not threadsafe.) */
-  svn_cache__t *rev_root_id_cache;
-
   /* Caches native dag_node_t* instances and acts as a 1st level cache */
   fs_x_dag_cache_t *dag_node_cache;
 
@@ -292,7 +288,7 @@ typedef struct fs_x_data_t
 
   /* A cache of the contents of immutable directories; maps from
      unparsed FS ID to a apr_hash_t * mapping (const char *) dirent
-     names to (svn_fs_dirent_t *). */
+     names to (dirent_t *). */
   svn_cache__t *dir_cache;
 
   /* Fulltext cache; currently only used with memcached.  Maps from
@@ -431,12 +427,8 @@ typedef struct transaction_t
      may be NULL if there are no properties.  */
   apr_hash_t *proplist;
 
-  /* node revision id of the root node.  */
-  const svn_fs_id_t *root_id;
-
-  /* node revision id of the node which is the root of the revision
-     upon which this txn is base.  (unfinished only) */
-  const svn_fs_id_t *base_id;
+  /* revision upon which this txn is base.  (unfinished only) */
+  svn_revnum_t base_rev;
 
   /* copies list (const char * copy_ids), or NULL if there have been
      no copies in this transaction.  */
@@ -466,7 +458,7 @@ typedef struct representation_t
   unsigned char md5_digest[APR_MD5_DIGESTSIZE];
 
   /* Change set and item number where this representation is located. */
-  svn_fs_x__id_part_t id;
+  svn_fs_x__id_t id;
 
   /* The size of the representation in bytes as seen in the revision
      file. */
@@ -486,12 +478,18 @@ typedef struct node_revision_t
   /* node kind */
   svn_node_kind_t kind;
 
-  /* The node-id for this node-rev. */
-  const svn_fs_id_t *id;
+  /* Predecessor node revision id.  Will be "unused" if there is no
+     predecessor for this node revision. */
+  svn_fs_x__id_t predecessor_id;
+
+  /* The ID of this noderev */
+  svn_fs_x__id_t noderev_id;
+
+  /* Identifier of the node that this noderev belongs to. */
+  svn_fs_x__id_t node_id;
 
-  /* predecessor node revision id, or NULL if there is no predecessor
-     for this node revision */
-  const svn_fs_id_t *predecessor_id;
+  /* Copy identifier of this line of history. */
+  svn_fs_x__id_t copy_id;
 
   /* If this node-rev is a copy, where was it copied from? */
   const char *copyfrom_path;
@@ -530,14 +528,43 @@ typedef struct node_revision_t
 } node_revision_t;
 
 
+/** The type of a directory entry.  */
+typedef struct dirent_t
+{
+
+  /** The name of this directory entry.  */
+  const char *name;
+
+  /** The node revision ID it names.  */
+  svn_fs_x__id_t id;
+
+  /** The node kind. */
+  svn_node_kind_t kind;
+} dirent_t;
+
+
 /*** Change ***/
 typedef struct change_t
 {
   /* Path of the change. */
   svn_string_t path;
 
-  /* API compatible change description */
-  svn_fs_path_change2_t info;
+  /* node revision id of changed path */
+  svn_fs_x__id_t noderev_id;
+
+  /* See svn_fs_path_change2_t for a description for the remaining elements.
+   */
+  svn_fs_path_change_kind_t change_kind;
+
+  svn_boolean_t text_mod;
+  svn_boolean_t prop_mod;
+  svn_node_kind_t node_kind;
+
+  svn_boolean_t copyfrom_known;
+  svn_revnum_t copyfrom_rev;
+  const char *copyfrom_path;
+
+  svn_tristate_t mergeinfo_mod;
 } change_t;
 
 

Modified: subversion/trunk/subversion/libsvn_fs_x/fs_x.c
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_fs_x/fs_x.c?rev=1649012&r1=1649011&r2=1649012&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_fs_x/fs_x.c (original)
+++ subversion/trunk/subversion/libsvn_fs_x/fs_x.c Fri Jan  2 12:43:42 2015
@@ -708,7 +708,7 @@ svn_fs_x__file_text_rep_equal(representa
 
   /* Same physical representation?  Note that these IDs are always up-to-date
      instead of e.g. being set lazily. */
-  if (svn_fs_x__id_part_eq(&a->id, &b->id))
+  if (svn_fs_x__id_eq(&a->id, &b->id))
     return TRUE;
 
   /* Contents are equal if the checksums match.  These are also always known.
@@ -750,7 +750,7 @@ svn_fs_x__prop_rep_equal(svn_boolean_t *
     }
 
   /* Same path in same txn? */
-  if (svn_fs_x__id_eq(a->id, b->id))
+  if (svn_fs_x__id_eq(&a->noderev_id, &b->noderev_id))
     {
       *equal = TRUE;
       return SVN_NO_ERROR;
@@ -854,14 +854,16 @@ write_revision_zero(svn_fs_t *fs,
                  "\1\x84"     /* 1 instr byte, new 4 bytes */
                  "\4END\n"    /* 4 new bytes, E, N, D, \n */
                  "ENDREP\n"
-               "id: 0+0.0+0.2+0\n"
+               "id: 2+0\n"
+               "node: 0+0\n"
+               "copy: 0+0\n"
                "type: dir\n"
                "count: 0\n"
                "text: 0 3 16 4 "
                "2d2977d1c96f487abe4a1e202dd03b4e\n"
                "cpath: /\n"
                "\n\n",
-               0x7b, subpool));
+               0x8b, subpool));
 
   /* Construct the index P2L contents: describe the 3 items we have.
      Be sure to create them in on-disk order. */
@@ -879,7 +881,7 @@ write_revision_zero(svn_fs_t *fs,
 
   entry = apr_pcalloc(subpool, sizeof(*entry));
   entry->offset = 0x1d;
-  entry->size = 0x5d;
+  entry->size = 0x6d;
   entry->type = SVN_FS_X__ITEM_TYPE_NODEREV;
   entry->item_count = 1;
   entry->items = apr_pcalloc(subpool, sizeof(*entry->items));
@@ -888,7 +890,7 @@ write_revision_zero(svn_fs_t *fs,
   APR_ARRAY_PUSH(index_entries, svn_fs_x__p2l_entry_t *) = entry;
 
   entry = apr_pcalloc(subpool, sizeof(*entry));
-  entry->offset = 0x1d + 0x5d;
+  entry->offset = 0x1d + 0x6d;
   entry->size = 1;
   entry->type = SVN_FS_X__ITEM_TYPE_CHANGES;
   entry->item_count = 1;

Modified: subversion/trunk/subversion/libsvn_fs_x/id.c
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_fs_x/id.c?rev=1649012&r1=1649011&r2=1649012&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_fs_x/id.c (original)
+++ subversion/trunk/subversion/libsvn_fs_x/id.c Fri Jan  2 12:43:42 2015
@@ -1,4 +1,4 @@
-/* id.c : operations on node-revision IDs
+/* id.c : implements FSX-internal ID functions
  *
  * ====================================================================
  *    Licensed to the Apache Software Foundation (ASF) under one
@@ -21,32 +21,14 @@
  */
 
 #include <assert.h>
-#include <string.h>
-#include <stdlib.h>
 
 #include "id.h"
 #include "index.h"
 #include "util.h"
 
-#include "../libsvn_fs/fs-loader.h"
-#include "private/svn_temp_serializer.h"
 #include "private/svn_string_private.h"
 
 
-typedef struct fs_x__id_t
-{
-  /* API visible part */
-  svn_fs_id_t generic_id;
-
-  /* private members */
-  svn_fs_x__id_part_t node_id;
-  svn_fs_x__id_part_t copy_id;
-  svn_fs_x__id_part_t noderev_id;
-
-  apr_pool_t *pool; /* pool that was used to allocate this struct */
-} fs_x__id_t;
-
-
 
 svn_boolean_t
 svn_fs_x__is_txn(svn_fs_x__change_set_t change_set)
@@ -95,7 +77,7 @@ svn_fs_x__change_set_by_txn(apr_int64_t
 /* Parse the NUL-terminated ID part at DATA and write the result into *PART.
  * Return TRUE if no errors were detected. */
 static svn_boolean_t
-part_parse(svn_fs_x__id_part_t *part,
+part_parse(svn_fs_x__id_t *part,
            const char *data)
 {
   part->number = svn__base36toui64(&data, data);
@@ -119,7 +101,7 @@ part_parse(svn_fs_x__id_part_t *part,
  */
 static char *
 part_unparse(char *p,
-             const svn_fs_x__id_part_t *part)
+             const svn_fs_x__id_t *part)
 {
   p += svn__ui64tobase36(p, part->number);
   if (part->change_set >= 0)
@@ -141,151 +123,71 @@ part_unparse(char *p,
 /* Operations on ID parts */
 
 svn_boolean_t
-svn_fs_x__id_part_is_root(const svn_fs_x__id_part_t* part)
+svn_fs_x__id_is_root(const svn_fs_x__id_t* part)
 {
   return part->change_set == 0 && part->number == 0;
 }
 
 svn_boolean_t
-svn_fs_x__id_part_eq(const svn_fs_x__id_part_t *lhs,
-                     const svn_fs_x__id_part_t *rhs)
+svn_fs_x__id_eq(const svn_fs_x__id_t *lhs,
+                const svn_fs_x__id_t *rhs)
 {
   return lhs->change_set == rhs->change_set && lhs->number == rhs->number;
 }
 
-
-
-/* Accessing ID Pieces.  */
-
-const svn_fs_x__id_part_t *
-svn_fs_x__id_node_id(const svn_fs_id_t *fs_id)
-{
-  const fs_x__id_t *id = (const fs_x__id_t *)fs_id;
-
-  return &id->node_id;
-}
-
-
-const svn_fs_x__id_part_t *
-svn_fs_x__id_copy_id(const svn_fs_id_t *fs_id)
-{
-  const fs_x__id_t *id = (const fs_x__id_t *)fs_id;
-
-  return &id->copy_id;
-}
-
-
-svn_fs_x__txn_id_t
-svn_fs_x__id_txn_id(const svn_fs_id_t *fs_id)
-{
-  const fs_x__id_t *id = (const fs_x__id_t *)fs_id;
-
-  return svn_fs_x__get_txn_id(id->noderev_id.change_set);
-}
-
-
-const svn_fs_x__id_part_t *
-svn_fs_x__id_noderev_id(const svn_fs_id_t *fs_id)
-{
-  const fs_x__id_t *id = (const fs_x__id_t *)fs_id;
-
-  return &id->noderev_id;
-}
-
-svn_revnum_t
-svn_fs_x__id_rev(const svn_fs_id_t *fs_id)
-{
-  const fs_x__id_t *id = (const fs_x__id_t *)fs_id;
-
-  return svn_fs_x__get_revnum(id->noderev_id.change_set);
-}
-
-
-apr_uint64_t
-svn_fs_x__id_item(const svn_fs_id_t *fs_id)
-{
-  const fs_x__id_t *id = (const fs_x__id_t *)fs_id;
-
-  return id->noderev_id.number;
-}
-
-svn_boolean_t
-svn_fs_x__id_is_txn(const svn_fs_id_t *fs_id)
+svn_error_t *
+svn_fs_x__id_parse(svn_fs_x__id_t *part,
+                   const char *data)
 {
-  const fs_x__id_t *id = (const fs_x__id_t *)fs_id;
+  if (!part_parse(part, data))
+    return svn_error_createf(SVN_ERR_FS_MALFORMED_NODEREV_ID, NULL,
+                             "Malformed ID string");
 
-  return svn_fs_x__is_txn(id->noderev_id.change_set);
+  return SVN_NO_ERROR;
 }
 
 svn_string_t *
-svn_fs_x__id_unparse(const svn_fs_id_t *fs_id,
+svn_fs_x__id_unparse(const svn_fs_x__id_t *id,
                      apr_pool_t *pool)
 {
-  char string[6 * SVN_INT64_BUFFER_SIZE + 10];
-  const fs_x__id_t *id = (const fs_x__id_t *)fs_id;
-
-  char *p = part_unparse(string, &id->node_id);
-  *(p++) = '.';
-  p = part_unparse(p, &id->copy_id);
-  *(p++) = '.';
-  p = part_unparse(p, &id->noderev_id);
+  char string[2 * SVN_INT64_BUFFER_SIZE + 1];
+  char *p = part_unparse(string, id);
 
   return svn_string_ncreate(string, p - string, pool);
 }
 
-
-/*** Comparing node IDs ***/
-
-svn_boolean_t
-svn_fs_x__id_eq(const svn_fs_id_t *a,
-                const svn_fs_id_t *b)
+void
+svn_fs_x__id_reset(svn_fs_x__id_t *part)
 {
-  const fs_x__id_t *id_a = (const fs_x__id_t *)a;
-  const fs_x__id_t *id_b = (const fs_x__id_t *)b;
-
-  if (a == b)
-    return TRUE;
-
-  return svn_fs_x__id_part_eq(&id_a->node_id, &id_b->node_id)
-      && svn_fs_x__id_part_eq(&id_a->copy_id, &id_b->copy_id)
-      && svn_fs_x__id_part_eq(&id_a->noderev_id, &id_b->noderev_id);
+  part->change_set = SVN_FS_X__INVALID_CHANGE_SET;
+  part->number = 0;
 }
 
-
 svn_boolean_t
-svn_fs_x__id_check_related(const svn_fs_id_t *a,
-                           const svn_fs_id_t *b)
+svn_fs_x__id_used(const svn_fs_x__id_t *part)
 {
-  const fs_x__id_t *id_a = (const fs_x__id_t *)a;
-  const fs_x__id_t *id_b = (const fs_x__id_t *)b;
-
-  if (a == b)
-    return TRUE;
-
-  /* Items from different txns are unrelated. */
-  if (   svn_fs_x__is_txn(id_a->noderev_id.change_set)
-      && svn_fs_x__is_txn(id_b->noderev_id.change_set)
-      && id_a->noderev_id.change_set != id_b->noderev_id.change_set)
-    return FALSE;
-
-  /* related if they trace back to the same node creation */
-  return svn_fs_x__id_part_eq(&id_a->node_id, &id_b->node_id);
+  return part->change_set != SVN_FS_X__INVALID_CHANGE_SET;
 }
 
+void
+svn_fs_x__init_txn_root(svn_fs_x__id_t *noderev_id,
+                        svn_fs_x__txn_id_t txn_id)
+{
+  noderev_id->change_set = svn_fs_x__change_set_by_txn(txn_id);
+  noderev_id->number = SVN_FS_X__ITEM_INDEX_ROOT_NODE;
+}
 
-svn_fs_node_relation_t
-svn_fs_x__id_compare(const svn_fs_id_t *a,
-                     const svn_fs_id_t *b)
+void
+svn_fs_x__init_rev_root(svn_fs_x__id_t *noderev_id,
+                        svn_revnum_t rev)
 {
-  if (svn_fs_x__id_eq(a, b))
-    return svn_fs_node_same;
-  return (svn_fs_x__id_check_related(a, b) ? svn_fs_node_common_ancestor
-                                           : svn_fs_node_unrelated);
+  noderev_id->change_set = svn_fs_x__change_set_by_rev(rev);
+  noderev_id->number = SVN_FS_X__ITEM_INDEX_ROOT_NODE;
 }
 
 int
-svn_fs_x__id_part_compare(const svn_fs_x__id_part_t *a,
-                          const svn_fs_x__id_part_t *b)
+svn_fs_x__id_compare(const svn_fs_x__id_t *a,
+                     const svn_fs_x__id_t *b)
 {
   if (a->change_set < b->change_set)
     return -1;
@@ -294,210 +196,3 @@ svn_fs_x__id_part_compare(const svn_fs_x
 
   return a->number < b->number ? -1 : a->number == b->number ? 0 : 1;
 }
-
-
-
-/* Creating ID's.  */
-
-static id_vtable_t id_vtable = {
-  svn_fs_x__id_unparse,
-  svn_fs_x__id_compare
-};
-
-svn_fs_id_t *
-svn_fs_x__id_txn_create_root(svn_fs_x__txn_id_t txn_id,
-                             apr_pool_t *pool)
-{
-  fs_x__id_t *id = apr_pcalloc(pool, sizeof(*id));
-
-  /* node ID and copy ID are "0" */
-
-  id->noderev_id.change_set = svn_fs_x__change_set_by_txn(txn_id);
-  id->noderev_id.number = SVN_FS_X__ITEM_INDEX_ROOT_NODE;
-
-  id->generic_id.vtable = &id_vtable;
-  id->generic_id.fsap_data = id;
-  id->pool = pool;
-
-  return (svn_fs_id_t *)id;
-}
-
-svn_fs_id_t *svn_fs_x__id_create_root(const svn_revnum_t revision,
-                                      apr_pool_t *pool)
-{
-  fs_x__id_t *id = apr_pcalloc(pool, sizeof(*id));
-
-  /* node ID and copy ID are "0" */
-
-  id->noderev_id.change_set = svn_fs_x__change_set_by_rev(revision);
-  id->noderev_id.number = SVN_FS_X__ITEM_INDEX_ROOT_NODE;
-
-  id->generic_id.vtable = &id_vtable;
-  id->generic_id.fsap_data = id;
-  id->pool = pool;
-
-  return (svn_fs_id_t *)id;
-}
-
-svn_fs_id_t *
-svn_fs_x__id_txn_create(const svn_fs_x__id_part_t *node_id,
-                        const svn_fs_x__id_part_t *copy_id,
-                        svn_fs_x__txn_id_t txn_id,
-                        apr_uint64_t item,
-                        apr_pool_t *pool)
-{
-  fs_x__id_t *id = apr_pcalloc(pool, sizeof(*id));
-
-  id->node_id = *node_id;
-  id->copy_id = *copy_id;
-
-  id->noderev_id.change_set = svn_fs_x__change_set_by_txn(txn_id);
-  id->noderev_id.number = item;
-
-  id->generic_id.vtable = &id_vtable;
-  id->generic_id.fsap_data = id;
-  id->pool = pool;
-
-  return (svn_fs_id_t *)id;
-}
-
-
-svn_fs_id_t *
-svn_fs_x__id_create(const svn_fs_x__id_part_t *node_id,
-                    const svn_fs_x__id_part_t *copy_id,
-                    const svn_fs_x__id_part_t *noderev_id,
-                    apr_pool_t *pool)
-{
-  fs_x__id_t *id = apr_pcalloc(pool, sizeof(*id));
-
-  id->node_id = *node_id;
-  id->copy_id = *copy_id;
-  id->noderev_id = *noderev_id;
-
-  id->generic_id.vtable = &id_vtable;
-  id->generic_id.fsap_data = id;
-  id->pool = pool;
-
-  return (svn_fs_id_t *)id;
-}
-
-
-svn_fs_id_t *
-svn_fs_x__id_copy(const svn_fs_id_t *source, apr_pool_t *pool)
-{
-  const fs_x__id_t *id = (const fs_x__id_t *)source;
-  fs_x__id_t *new_id = apr_pmemdup(pool, id, sizeof(*new_id));
-
-  new_id->generic_id.fsap_data = new_id;
-  new_id->pool = pool;
-
-  return (svn_fs_id_t *)new_id;
-}
-
-/* Return an ID resulting from parsing the string DATA, or NULL if DATA is
-   an invalid ID string. *DATA will be modified / invalidated by this call. */
-static svn_fs_id_t *
-id_parse(char *data,
-         apr_pool_t *pool)
-{
-  fs_x__id_t *id;
-  char *str;
-
-  /* Alloc a new svn_fs_id_t structure. */
-  id = apr_pcalloc(pool, sizeof(*id));
-  id->generic_id.vtable = &id_vtable;
-  id->generic_id.fsap_data = id;
-  id->pool = pool;
-
-  /* Now, we basically just need to "split" this data on `.'
-     characters.  We will use svn_cstring_tokenize, which will put
-     terminators where each of the '.'s used to be.  Then our new
-     id field will reference string locations inside our duplicate
-     string.*/
-
-  /* Node Id */
-  str = svn_cstring_tokenize(".", &data);
-  if (str == NULL)
-    return NULL;
-  if (! part_parse(&id->node_id, str))
-    return NULL;
-
-  /* Copy Id */
-  str = svn_cstring_tokenize(".", &data);
-  if (str == NULL)
-    return NULL;
-  if (! part_parse(&id->copy_id, str))
-    return NULL;
-
-  /* NodeRev Id */
-  str = svn_cstring_tokenize(".", &data);
-  if (str == NULL)
-    return NULL;
-
-  if (! part_parse(&id->noderev_id, str))
-    return NULL;
-
-  return (svn_fs_id_t *)id;
-}
-
-svn_error_t *
-svn_fs_x__id_parse(const svn_fs_id_t **id_p,
-                   char *data,
-                   apr_pool_t *pool)
-{
-  svn_fs_id_t *id = id_parse(data, pool);
-  if (id == NULL)
-    return svn_error_createf(SVN_ERR_FS_MALFORMED_NODEREV_ID, NULL,
-                             "Malformed node revision ID string");
-
-  *id_p = id;
-
-  return SVN_NO_ERROR;
-}
-
-/* (de-)serialization support */
-
-/* Serialize an ID within the serialization CONTEXT.
- */
-void
-svn_fs_x__id_serialize(svn_temp_serializer__context_t *context,
-                       const svn_fs_id_t * const *in)
-{
-  const fs_x__id_t *id = (const fs_x__id_t *)*in;
-
-  /* nothing to do for NULL ids */
-  if (id == NULL)
-    return;
-
-  /* serialize the id data struct itself */
-  svn_temp_serializer__add_leaf(context,
-                                (const void * const *)in,
-                                sizeof(fs_x__id_t));
-}
-
-/* Deserialize an ID inside the BUFFER.
- */
-void
-svn_fs_x__id_deserialize(void *buffer,
-                         svn_fs_id_t **in_out,
-                         apr_pool_t *pool)
-{
-  fs_x__id_t *id;
-
-  /* The id maybe all what is in the whole buffer.
-   * Don't try to fixup the pointer in that case*/
-  if (*in_out != buffer)
-    svn_temp_deserializer__resolve(buffer, (void**)in_out);
-
-  id = (fs_x__id_t *)*in_out;
-
-  /* no id, no sub-structure fixup necessary */
-  if (id == NULL)
-    return;
-
-  /* the stored vtable is bogus at best -> set the right one */
-  id->generic_id.vtable = &id_vtable;
-  id->generic_id.fsap_data = id;
-  id->pool = pool;
-}
-


Reply via email to