You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by br...@apache.org on 2014/02/17 06:53:26 UTC
svn commit: r1568883 [3/6] - in /subversion/branches/fsfs-ucsnorm: ./
build/generator/ contrib/client-side/ contrib/client-side/emacs/
contrib/hook-scripts/ contrib/server-side/ notes/ notes/meetings/
notes/wc-ng/ subversion/bindings/ctypes-python/csvn...
Modified: subversion/branches/fsfs-ucsnorm/subversion/libsvn_fs_x/dag.h
URL: http://svn.apache.org/viewvc/subversion/branches/fsfs-ucsnorm/subversion/libsvn_fs_x/dag.h?rev=1568883&r1=1568882&r2=1568883&view=diff
==============================================================================
--- subversion/branches/fsfs-ucsnorm/subversion/libsvn_fs_x/dag.h (original)
+++ subversion/branches/fsfs-ucsnorm/subversion/libsvn_fs_x/dag.h Mon Feb 17 05:53:23 2014
@@ -226,7 +226,7 @@ svn_error_t *svn_fs_x__dag_revision_root
for a transaction, call svn_fs_x__dag_clone_root. */
svn_error_t *svn_fs_x__dag_txn_root(dag_node_t **node_p,
svn_fs_t *fs,
- const svn_fs_x__id_part_t *txn_id,
+ svn_fs_x__txn_id_t txn_id,
apr_pool_t *pool);
@@ -234,7 +234,7 @@ svn_error_t *svn_fs_x__dag_txn_root(dag_
allocating from POOL. Allocate the node in TRAIL->pool. */
svn_error_t *svn_fs_x__dag_txn_base_root(dag_node_t **node_p,
svn_fs_t *fs,
- const svn_fs_x__id_part_t *txn_id,
+ svn_fs_x__txn_id_t txn_id,
apr_pool_t *pool);
@@ -244,7 +244,7 @@ svn_error_t *svn_fs_x__dag_txn_base_root
root directory clone. Allocate *ROOT_P in POOL. */
svn_error_t *svn_fs_x__dag_clone_root(dag_node_t **root_p,
svn_fs_t *fs,
- const svn_fs_x__id_part_t *txn_id,
+ svn_fs_x__txn_id_t txn_id,
apr_pool_t *pool);
@@ -298,7 +298,7 @@ svn_error_t *svn_fs_x__dag_set_entry(dag
const char *entry_name,
const svn_fs_id_t *id,
svn_node_kind_t kind,
- const svn_fs_x__id_part_t *txn_id,
+ svn_fs_x__txn_id_t txn_id,
apr_pool_t *pool);
@@ -326,7 +326,7 @@ svn_error_t *svn_fs_x__dag_clone_child(d
const char *parent_path,
const char *name,
const svn_fs_x__id_part_t *copy_id,
- const svn_fs_x__id_part_t *txn_id,
+ svn_fs_x__txn_id_t txn_id,
svn_boolean_t is_parent_copyroot,
apr_pool_t *pool);
@@ -345,7 +345,7 @@ svn_error_t *svn_fs_x__dag_clone_child(d
*/
svn_error_t *svn_fs_x__dag_delete(dag_node_t *parent,
const char *name,
- const svn_fs_x__id_part_t *txn_id,
+ svn_fs_x__txn_id_t txn_id,
apr_pool_t *pool);
@@ -388,7 +388,7 @@ svn_error_t *svn_fs_x__dag_make_dir(dag_
dag_node_t *parent,
const char *parent_path,
const char *name,
- const svn_fs_x__id_part_t *txn_id,
+ svn_fs_x__txn_id_t txn_id,
apr_pool_t *pool);
@@ -499,7 +499,7 @@ svn_error_t *svn_fs_x__dag_make_file(dag
dag_node_t *parent,
const char *parent_path,
const char *name,
- const svn_fs_x__id_part_t *txn_id,
+ svn_fs_x__txn_id_t txn_id,
apr_pool_t *pool);
@@ -526,7 +526,7 @@ svn_error_t *svn_fs_x__dag_copy(dag_node
svn_boolean_t preserve_history,
svn_revnum_t from_rev,
const char *from_path,
- const svn_fs_x__id_part_t *txn_id,
+ svn_fs_x__txn_id_t txn_id,
apr_pool_t *pool);
Modified: subversion/branches/fsfs-ucsnorm/subversion/libsvn_fs_x/fs.h
URL: http://svn.apache.org/viewvc/subversion/branches/fsfs-ucsnorm/subversion/libsvn_fs_x/fs.h?rev=1568883&r1=1568882&r2=1568883&view=diff
==============================================================================
--- subversion/branches/fsfs-ucsnorm/subversion/libsvn_fs_x/fs.h (original)
+++ subversion/branches/fsfs-ucsnorm/subversion/libsvn_fs_x/fs.h Mon Feb 17 05:53:23 2014
@@ -134,7 +134,7 @@ typedef struct fs_x_shared_txn_data_t
struct fs_x_shared_txn_data_t *next;
/* ID of this transaction. */
- svn_fs_x__id_part_t txn_id;
+ svn_fs_x__txn_id_t txn_id;
/* Whether the transaction's prototype revision file is locked for
writing by any thread in this process (including the current
@@ -448,11 +448,8 @@ typedef struct representation_t
unsigned char sha1_digest[APR_SHA1_DIGESTSIZE];
unsigned char md5_digest[APR_MD5_DIGESTSIZE];
- /* Revision where this representation is located. */
- svn_revnum_t revision;
-
- /* Item index with the the revision. */
- apr_uint64_t item_index;
+ /* Change set and item number where this representation is located. */
+ svn_fs_x__id_part_t id;
/* The size of the representation in bytes as seen in the revision
file. */
@@ -461,18 +458,6 @@ typedef struct representation_t
/* The size of the fulltext of the representation. */
svn_filesize_t expanded_size;
- /* Is this representation a transaction? */
- svn_fs_x__id_part_t txn_id;
-
- /* For rep-sharing, we need a way of uniquifying node-revs which share the
- same representation (see svn_fs_x__noderev_same_rep_key() ). So, we
- store the original txn of the node rev (not the rep!), along with some
- intra-node uniqification content. */
- struct
- {
- svn_fs_x__id_part_t txn_id;
- apr_uint64_t number;
- } uniquifier;
} representation_t;
Modified: subversion/branches/fsfs-ucsnorm/subversion/libsvn_fs_x/fs_x.c
URL: http://svn.apache.org/viewvc/subversion/branches/fsfs-ucsnorm/subversion/libsvn_fs_x/fs_x.c?rev=1568883&r1=1568882&r2=1568883&view=diff
==============================================================================
--- subversion/branches/fsfs-ucsnorm/subversion/libsvn_fs_x/fs_x.c (original)
+++ subversion/branches/fsfs-ucsnorm/subversion/libsvn_fs_x/fs_x.c Mon Feb 17 05:53:23 2014
@@ -647,13 +647,7 @@ svn_fs_x__noderev_same_rep_key(represent
if (a == NULL || b == NULL)
return FALSE;
- if (a->item_index != b->item_index)
- return FALSE;
-
- if (a->revision != b->revision)
- return FALSE;
-
- return memcmp(&a->uniquifier, &b->uniquifier, sizeof(a->uniquifier)) == 0;
+ return svn_fs_x__id_part_eq(&a->id, &b->id);
}
svn_error_t *
@@ -728,14 +722,14 @@ 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.r0/2\n"
+ "id: 0+0.0+0.2+0\n"
"type: dir\n"
"count: 0\n"
"text: 0 3 16 4 "
"2d2977d1c96f487abe4a1e202dd03b4e\n"
"cpath: /\n"
"\n\n",
- 0x78, fs->pool));
+ 0x7b, fs->pool));
SVN_ERR(svn_io_set_file_read_only(path_revision_zero, FALSE, fs->pool));
@@ -745,7 +739,7 @@ write_revision_zero(svn_fs_t *fs)
"\0\1\x80\x40\1\1" /* rev 0, single page */
"\5\4" /* page size: bytes, count */
"\0" /* 0 container offsets in list */
- "\0\x78\x1e\1", /* phys offsets + 1 */
+ "\0\x7b\x1e\1", /* phys offsets + 1 */
13,
fs->pool));
SVN_ERR(svn_io_set_file_read_only(path, FALSE, fs->pool));
@@ -757,9 +751,9 @@ write_revision_zero(svn_fs_t *fs)
"\x80\x80\4\1\x11" /* 64k pages, 1 page using 17 bytes */
"\0" /* offset entry 0 page 1 */
"\x1d\x11\0\6" /* len, type + 16 * count, (rev, 2*item)* */
- "\x5a\x15\0\4"
+ "\x5d\x15\0\4"
"\1\x16\0\2"
- "\x88\xff\3\0", /* last entry fills up 64k page */
+ "\x85\xff\3\0", /* last entry fills up 64k page */
23,
fs->pool));
SVN_ERR(svn_io_set_file_read_only(path, FALSE, fs->pool));
Modified: subversion/branches/fsfs-ucsnorm/subversion/libsvn_fs_x/id.c
URL: http://svn.apache.org/viewvc/subversion/branches/fsfs-ucsnorm/subversion/libsvn_fs_x/id.c?rev=1568883&r1=1568882&r2=1568883&view=diff
==============================================================================
--- subversion/branches/fsfs-ucsnorm/subversion/libsvn_fs_x/id.c (original)
+++ subversion/branches/fsfs-ucsnorm/subversion/libsvn_fs_x/id.c Mon Feb 17 05:53:23 2014
@@ -20,11 +20,13 @@
* ====================================================================
*/
+#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"
@@ -39,91 +41,98 @@ typedef struct fs_x__id_t
/* private members */
svn_fs_x__id_part_t node_id;
svn_fs_x__id_part_t copy_id;
- svn_fs_x__id_part_t txn_id;
- svn_fs_x__id_part_t rev_item;
+ svn_fs_x__id_part_t noderev_id;
apr_pool_t *pool; /* pool that was used to allocate this struct */
} fs_x__id_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,
- const char *data)
+svn_boolean_t
+svn_fs_x__is_txn(svn_fs_x__change_set_t change_set)
{
- /* special case: ID inside some transaction */
- if (data[0] == '_')
- {
- part->revision = SVN_INVALID_REVNUM;
- part->number = svn__base36toui64(&data, data + 1);
- return *data == '\0';
- }
+ return change_set < SVN_FS_X__INVALID_CHANGE_SET;
+}
- /* special case: 0 / default ID */
- if (data[0] == '0' && data[1] == '\0')
- {
- part->revision = 0;
- part->number = 0;
- return TRUE;
- }
+svn_boolean_t
+svn_fs_x__is_revision(svn_fs_x__change_set_t change_set)
+{
+ return change_set > SVN_FS_X__INVALID_CHANGE_SET;
+}
- /* read old style / new style ID */
- part->number = svn__base36toui64(&data, data);
- if (data[0] != '-')
- {
- part->revision = 0;
- return *data == '\0';
- }
+svn_revnum_t
+svn_fs_x__get_revnum(svn_fs_x__change_set_t change_set)
+{
+ return svn_fs_x__is_revision(change_set)
+ ? (svn_revnum_t)change_set
+ : SVN_INVALID_REVNUM;
+}
+
+apr_int64_t
+svn_fs_x__get_txn_id(svn_fs_x__change_set_t change_set)
+{
+ return svn_fs_x__is_txn(change_set)
+ ? -change_set + SVN_FS_X__INVALID_CHANGE_SET -1
+ : SVN_FS_X__INVALID_TXN_ID;
+}
- part->revision = SVN_STR_TO_REV(++data);
- return TRUE;
+svn_fs_x__change_set_t
+svn_fs_x__change_set_by_rev(svn_revnum_t revnum)
+{
+ assert(revnum >= SVN_FS_X__INVALID_CHANGE_SET);
+ return revnum;
}
-/* Parse the transaction id in DATA and store the result in *TXN_ID.
- * Return FALSE if there was some problem.
- */
+svn_fs_x__change_set_t
+svn_fs_x__change_set_by_txn(apr_int64_t txn_id)
+{
+ assert(txn_id >= SVN_FS_X__INVALID_CHANGE_SET);
+ return -txn_id + SVN_FS_X__INVALID_CHANGE_SET -1;
+}
+
+
+/* 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
-txn_id_parse(svn_fs_x__id_part_t *txn_id,
- const char *data)
+part_parse(svn_fs_x__id_part_t *part,
+ const char *data)
{
- txn_id->revision = SVN_STR_TO_REV(data);
- data = strchr(data, '-');
- if (data == NULL)
- return FALSE;
-
- txn_id->number = svn__base36toui64(&data, ++data);
- return *data == '\0';
+ part->number = svn__base36toui64(&data, data);
+ switch (data[0])
+ {
+ /* txn number? */
+ case '-': part->change_set = -svn__base36toui64(&data, data + 1);
+ return TRUE;
+
+ /* revision number? */
+ case '+': part->change_set = svn__base36toui64(&data, data + 1);
+ return TRUE;
+
+ /* everything else is forbidden */
+ default: return FALSE;
+ }
}
/* Write the textual representation of *PART into P and return a pointer
* to the first position behind that string.
*/
static char *
-unparse_id_part(char *p,
- const svn_fs_x__id_part_t *part)
+part_unparse(char *p,
+ const svn_fs_x__id_part_t *part)
{
- if (SVN_IS_VALID_REVNUM(part->revision))
+ p += svn__ui64tobase36(p, part->number);
+ if (part->change_set >= 0)
{
- /* ordinary old style / new style ID */
- p += svn__ui64tobase36(p, part->number);
- if (part->revision > 0)
- {
- *(p++) = '-';
- p += svn__i64toa(p, part->revision);
- }
+ *(p++) = '+';
+ p += svn__ui64tobase36(p, part->change_set);
}
else
{
- /* in txn: mark with "_" prefix */
- *(p++) = '_';
- p += svn__ui64tobase36(p, part->number);
+ *(p++) = '-';
+ p += svn__ui64tobase36(p, -part->change_set);
}
- *(p++) = '.';
-
return p;
}
@@ -134,52 +143,14 @@ unparse_id_part(char *p,
svn_boolean_t
svn_fs_x__id_part_is_root(const svn_fs_x__id_part_t* part)
{
- return part->revision == 0 && part->number == 0;
+ 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)
{
- return lhs->revision == rhs->revision && lhs->number == rhs->number;
-}
-
-svn_boolean_t
-svn_fs_x__id_txn_used(const svn_fs_x__id_part_t *txn_id)
-{
- return SVN_IS_VALID_REVNUM(txn_id->revision) || (txn_id->number != 0);
-}
-
-void
-svn_fs_x__id_txn_reset(svn_fs_x__id_part_t *txn_id)
-{
- txn_id->revision = SVN_INVALID_REVNUM;
- txn_id->number = 0;
-}
-
-svn_error_t *
-svn_fs_x__id_txn_parse(svn_fs_x__id_part_t *txn_id,
- const char *data)
-{
- if (! txn_id_parse(txn_id, data))
- return svn_error_createf(SVN_ERR_FS_MALFORMED_TXN_ID, NULL,
- "malformed txn id '%s'", data);
-
- return SVN_NO_ERROR;
-}
-
-const char *
-svn_fs_x__id_txn_unparse(const svn_fs_x__id_part_t *txn_id,
- apr_pool_t *pool)
-{
- char string[2 * SVN_INT64_BUFFER_SIZE + 1];
- char *p = string;
-
- p += svn__i64toa(p, txn_id->revision);
- *(p++) = '-';
- p += svn__ui64tobase36(p, txn_id->number);
-
- return apr_pstrmemdup(pool, string, p - string);
+ return lhs->change_set == rhs->change_set && lhs->number == rhs->number;
}
@@ -204,21 +175,21 @@ svn_fs_x__id_copy_id(const svn_fs_id_t *
}
-const svn_fs_x__id_part_t *
+svn_fs_x__txn_id_t
svn_fs_x__id_txn_id(const svn_fs_id_t *fs_id)
{
fs_x__id_t *id = (fs_x__id_t *)fs_id;
- return &id->txn_id;
+ return svn_fs_x__get_txn_id(id->noderev_id.change_set);
}
const svn_fs_x__id_part_t *
-svn_fs_x__id_rev_item(const svn_fs_id_t *fs_id)
+svn_fs_x__id_noderev_id(const svn_fs_id_t *fs_id)
{
fs_x__id_t *id = (fs_x__id_t *)fs_id;
- return &id->rev_item;
+ return &id->noderev_id;
}
svn_revnum_t
@@ -226,7 +197,7 @@ svn_fs_x__id_rev(const svn_fs_id_t *fs_i
{
fs_x__id_t *id = (fs_x__id_t *)fs_id;
- return id->rev_item.revision;
+ return svn_fs_x__get_revnum(id->noderev_id.change_set);
}
@@ -235,7 +206,7 @@ svn_fs_x__id_item(const svn_fs_id_t *fs_
{
fs_x__id_t *id = (fs_x__id_t *)fs_id;
- return id->rev_item.number;
+ return id->noderev_id.number;
}
svn_boolean_t
@@ -243,7 +214,7 @@ svn_fs_x__id_is_txn(const svn_fs_id_t *f
{
fs_x__id_t *id = (fs_x__id_t *)fs_id;
- return svn_fs_x__id_txn_used(&id->txn_id);
+ return svn_fs_x__is_txn(id->noderev_id.change_set);
}
svn_string_t *
@@ -253,23 +224,11 @@ svn_fs_x__id_unparse(const svn_fs_id_t *
char string[6 * SVN_INT64_BUFFER_SIZE + 10];
fs_x__id_t *id = (fs_x__id_t *)fs_id;
- char *p = unparse_id_part(string, &id->node_id);
- p = unparse_id_part(p, &id->copy_id);
-
- if (svn_fs_x__id_txn_used(&id->txn_id))
- {
- *(p++) = 't';
- p += svn__i64toa(p, id->txn_id.revision);
- *(p++) = '-';
- p += svn__ui64tobase36(p, id->txn_id.number);
- }
- else
- {
- *(p++) = 'r';
- p += svn__i64toa(p, id->rev_item.revision);
- *(p++) = '/';
- p += svn__i64toa(p, id->rev_item.number);
- }
+ char *p = part_unparse(string, &id->node_id);
+ *(p++) = '.';
+ p = part_unparse(p, &id->copy_id);
+ *(p++) = '.';
+ p = part_unparse(p, &id->noderev_id);
return svn_string_ncreate(string, p - string, pool);
}
@@ -288,7 +247,7 @@ svn_fs_x__id_eq(const svn_fs_id_t *a,
return TRUE;
return memcmp(&id_a->node_id, &id_b->node_id,
- 4 * sizeof(svn_fs_x__id_part_t)) == 0;
+ 3 * sizeof(svn_fs_x__id_part_t)) == 0;
}
@@ -302,15 +261,13 @@ svn_fs_x__id_check_related(const svn_fs_
if (a == b)
return TRUE;
- /* If both node_ids start with _ and they have differing transaction
- IDs, then it is impossible for them to be related. */
- if (id_a->node_id.revision == SVN_INVALID_REVNUM)
- {
- if ( !svn_fs_x__id_part_eq(&id_a->txn_id, &id_b->txn_id)
- || !svn_fs_x__id_txn_used(&id_a->txn_id))
- return FALSE;
- }
+ /* 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_a->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);
}
@@ -328,9 +285,9 @@ int
svn_fs_x__id_part_compare(const svn_fs_x__id_part_t *a,
const svn_fs_x__id_part_t *b)
{
- if (a->revision < b->revision)
+ if (a->change_set < b->change_set)
return -1;
- if (a->revision > b->revision)
+ if (a->change_set > b->change_set)
return 1;
return a->number < b->number ? -1 : a->number == b->number ? 0 : 1;
@@ -346,15 +303,15 @@ static id_vtable_t id_vtable = {
};
svn_fs_id_t *
-svn_fs_x__id_txn_create_root(const svn_fs_x__id_part_t *txn_id,
+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->txn_id = *txn_id;
- id->rev_item.revision = SVN_INVALID_REVNUM;
+ 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;
@@ -368,9 +325,10 @@ svn_fs_id_t *svn_fs_x__id_create_root(co
{
fs_x__id_t *id = apr_pcalloc(pool, sizeof(*id));
- id->txn_id.revision = SVN_INVALID_REVNUM;
- id->rev_item.revision = revision;
- id->rev_item.number = SVN_FS_X__ITEM_INDEX_ROOT_NODE;
+ /* 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;
@@ -382,15 +340,15 @@ svn_fs_id_t *svn_fs_x__id_create_root(co
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,
- const svn_fs_x__id_part_t *txn_id,
+ svn_fs_x__txn_id_t txn_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->txn_id = *txn_id;
- id->rev_item.revision = SVN_INVALID_REVNUM;
+
+ id->noderev_id.change_set = svn_fs_x__change_set_by_txn(txn_id);
id->generic_id.vtable = &id_vtable;
id->generic_id.fsap_data = id;
@@ -401,17 +359,16 @@ svn_fs_x__id_txn_create(const svn_fs_x__
svn_fs_id_t *
-svn_fs_x__id_rev_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 *rev_item,
- apr_pool_t *pool)
+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->txn_id.revision = SVN_INVALID_REVNUM;
- id->rev_item = *rev_item;
+ id->noderev_id = *noderev_id;
id->generic_id.vtable = &id_vtable;
id->generic_id.fsap_data = id;
@@ -472,44 +429,12 @@ svn_fs_x__id_parse(const char *data,
if (! part_parse(&id->copy_id, str))
return NULL;
- /* Txn/Rev Id */
+ /* NodeRev Id */
str = svn_cstring_tokenize(".", &data_copy);
if (str == NULL)
return NULL;
- if (str[0] == 'r')
- {
- apr_int64_t val;
- svn_error_t *err;
-
- /* This is a revision type ID */
- id->txn_id.revision = SVN_INVALID_REVNUM;
- id->txn_id.number = 0;
-
- data_copy = str + 1;
- str = svn_cstring_tokenize("/", &data_copy);
- if (str == NULL)
- return NULL;
- id->rev_item.revision = SVN_STR_TO_REV(str);
-
- err = svn_cstring_atoi64(&val, data_copy);
- if (err)
- {
- svn_error_clear(err);
- return NULL;
- }
- id->rev_item.number = (apr_uint64_t)val;
- }
- else if (str[0] == 't')
- {
- /* This is a transaction type ID */
- id->rev_item.revision = SVN_INVALID_REVNUM;
- id->rev_item.number = 0;
-
- if (! txn_id_parse(&id->txn_id, str + 1))
- return NULL;
- }
- else
+ if (! part_parse(&id->noderev_id, str))
return NULL;
return (svn_fs_id_t *)id;
@@ -524,7 +449,7 @@ svn_fs_x__id_serialize(svn_temp_serializ
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;
Modified: subversion/branches/fsfs-ucsnorm/subversion/libsvn_fs_x/id.h
URL: http://svn.apache.org/viewvc/subversion/branches/fsfs-ucsnorm/subversion/libsvn_fs_x/id.h?rev=1568883&r1=1568882&r2=1568883&view=diff
==============================================================================
--- subversion/branches/fsfs-ucsnorm/subversion/libsvn_fs_x/id.h (original)
+++ subversion/branches/fsfs-ucsnorm/subversion/libsvn_fs_x/id.h Mon Feb 17 05:53:23 2014
@@ -29,18 +29,50 @@
extern "C" {
#endif /* __cplusplus */
+/* Unique identifier for a transaction within the given repository. */
+typedef apr_int64_t svn_fs_x__txn_id_t;
+
+/* svn_fs_x__txn_id_t value for everything that is not a transaction. */
+#define SVN_FS_X__INVALID_TXN_ID ((svn_fs_x__txn_id_t)(-1))
+
+/* Change set is the umbrella term for transaction and revision in FSX.
+ * Revision numbers (>=0) map 1:1 onto change sets while txns are mapped
+ * onto the negatve value range. */
+typedef apr_int64_t svn_fs_x__change_set_t;
+
+/* Invalid / unused change set number. */
+#define SVN_FS_X__INVALID_CHANGE_SET ((svn_fs_x__change_set_t)(-1))
+
+/* Return TRUE iff the CHANGE_SET refers to a revision
+ (will return FALSE for SVN_INVALID_REVNUM). */
+svn_boolean_t svn_fs_x__is_revision(svn_fs_x__change_set_t change_set);
+
+/* Return TRUE iff the CHANGE_SET refers to a transaction
+ (will return FALSE for SVN_FS_X__INVALID_TXN_ID). */
+svn_boolean_t svn_fs_x__is_txn(svn_fs_x__change_set_t change_set);
+
+/* Return the revision number that corresponds to CHANGE_SET.
+ Will SVN_INVALID_REVNUM for transactions. */
+svn_revnum_t svn_fs_x__get_revnum(svn_fs_x__change_set_t change_set);
+
+/* Return the transaction ID that corresponds to CHANGE_SET.
+ Will SVN_FS_X__INVALID_TXN_ID for revisions. */
+apr_int64_t svn_fs_x__get_txn_id(svn_fs_x__change_set_t change_set);
+
+/* Convert REVNUM into a change set number */
+svn_fs_x__change_set_t svn_fs_x__change_set_by_rev(svn_revnum_t revnum);
+
+/* Convert TXN_ID into a change set number */
+svn_fs_x__change_set_t svn_fs_x__change_set_by_txn(apr_int64_t txn_id);
+
/* A rev node ID in FSX consists of a 3 of sub-IDs ("parts") that consist
- * of a creation REVISION number and some revision-local counter value
- * (NUMBER). Old-style ID parts use global counter values.
+ * of a creation CHANGE_SET number and some revision-local counter value
+ * (NUMBER).
*/
typedef struct svn_fs_x__id_part_t
{
- /* SVN_INVALID_REVNUM for txns -> not a txn, COUNTER must be 0.
- SVN_INVALID_REVNUM for others -> not assigned to a revision, yet.
- 0 for others -> old-style ID or the root in rev 0. */
- svn_revnum_t revision;
+ svn_fs_x__change_set_t change_set;
- /* some numerical value. */
apr_uint64_t number;
} svn_fs_x__id_part_t;
@@ -55,21 +87,6 @@ svn_boolean_t svn_fs_x__id_part_is_root(
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);
-/* Return TRUE, if TXN_ID is used, i.e. doesn't contain just the defaults. */
-svn_boolean_t svn_fs_x__id_txn_used(const svn_fs_x__id_part_t *txn_id);
-
-/* Reset TXN_ID to the defaults. */
-void svn_fs_x__id_txn_reset(svn_fs_x__id_part_t *txn_id);
-
-/* Parse the transaction id in DATA and store the result in *TXN_ID */
-svn_error_t *svn_fs_x__id_txn_parse(svn_fs_x__id_part_t *txn_id,
- const char *data);
-
-/* Convert the transaction id in *TXN_ID into a textual representation
- * allocated in POOL. */
-const char *svn_fs_x__id_txn_unparse(const svn_fs_x__id_part_t *txn_id,
- apr_pool_t *pool);
-
/*** ID accessor functions. ***/
@@ -79,11 +96,12 @@ const svn_fs_x__id_part_t *svn_fs_x__id_
/* Get the "copy id" portion of ID. */
const svn_fs_x__id_part_t *svn_fs_x__id_copy_id(const svn_fs_id_t *id);
-/* Get the "txn id" portion of ID, or NULL if it is a permanent ID. */
-const svn_fs_x__id_part_t *svn_fs_x__id_txn_id(const svn_fs_id_t *id);
+/* Get the "txn id" portion of ID,
+ * or SVN_FS_X__INVALID_TXN_ID if it is a permanent ID. */
+svn_fs_x__txn_id_t svn_fs_x__id_txn_id(const svn_fs_id_t *id);
-/* Get the "rev,item" portion of ID. */
-const svn_fs_x__id_part_t *svn_fs_x__id_rev_item(const svn_fs_id_t *id);
+/* Get the "noderev id" portion of ID. */
+const svn_fs_x__id_part_t *svn_fs_x__id_noderev_id(const svn_fs_id_t *id);
/* Get the "rev" portion of ID, or SVN_INVALID_REVNUM if it is a
transaction ID. */
@@ -117,7 +135,7 @@ int svn_fs_x__id_part_compare(const svn_
const svn_fs_x__id_part_t *b);
/* Create the txn root ID for transaction TXN_ID. Allocate it in POOL. */
-svn_fs_id_t *svn_fs_x__id_txn_create_root(const svn_fs_x__id_part_t *txn_id,
+svn_fs_id_t *svn_fs_x__id_txn_create_root(svn_fs_x__txn_id_t txnnum,
apr_pool_t *pool);
/* Create the root ID for REVISION. Allocate it in POOL. */
@@ -128,15 +146,15 @@ svn_fs_id_t *svn_fs_x__id_create_root(co
TXN_ID, allocated in POOL. */
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,
- const svn_fs_x__id_part_t *txn_id,
+ svn_fs_x__txn_id_t txn_id,
apr_pool_t *pool);
-/* Create a permanent ID based on NODE_ID, COPY_ID and REV_ITEM,
+/* Create a permanent ID based on NODE_ID, COPY_ID and NODEREV_ID,
allocated in POOL. */
-svn_fs_id_t *svn_fs_x__id_rev_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 *rev_item,
- apr_pool_t *pool);
+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);
/* Return a copy of ID, allocated from POOL. */
svn_fs_id_t *svn_fs_x__id_copy(const svn_fs_id_t *id,
Modified: subversion/branches/fsfs-ucsnorm/subversion/libsvn_fs_x/index.c
URL: http://svn.apache.org/viewvc/subversion/branches/fsfs-ucsnorm/subversion/libsvn_fs_x/index.c?rev=1568883&r1=1568882&r2=1568883&view=diff
==============================================================================
--- subversion/branches/fsfs-ucsnorm/subversion/libsvn_fs_x/index.c (original)
+++ subversion/branches/fsfs-ucsnorm/subversion/libsvn_fs_x/index.c Mon Feb 17 05:53:23 2014
@@ -1542,7 +1542,7 @@ static svn_error_t *
l2p_proto_index_lookup(apr_off_t *offset,
apr_uint32_t *sub_item,
svn_fs_t *fs,
- const svn_fs_x__id_part_t *txn_id,
+ svn_fs_x__txn_id_t txn_id,
apr_uint64_t item_index,
apr_pool_t *pool)
{
@@ -1763,9 +1763,10 @@ svn_fs_x__p2l_index_create(svn_fs_t *fs,
}
for (sub_item = 0; sub_item < entry.item_count; ++sub_item)
- if (entry.items[sub_item].revision == SVN_INVALID_REVNUM)
- entry.items[sub_item].revision = revision;
-
+ if (entry.items[sub_item].change_set == SVN_FS_X__INVALID_CHANGE_SET)
+ entry.items[sub_item].change_set
+ = svn_fs_x__change_set_by_rev(revision);
+
/* end pages if entry is extending beyond their boundaries */
entry_end = entry.offset + entry.size;
while (entry_end - last_page_end > page_size)
@@ -1800,11 +1801,13 @@ svn_fs_x__p2l_index_create(svn_fs_t *fs,
/* container contents (only one for non-container items) */
for (sub_item = 0; sub_item < entry.item_count; ++sub_item)
{
- apr_int64_t diff = entry.items[sub_item].revision - last_revision;
+ svn_revnum_t item_rev
+ = svn_fs_x__get_revnum(entry.items[sub_item].change_set);
+ apr_int64_t diff = item_rev - last_revision;
SVN_ERR(svn_spillbuf__write(buffer, (const char *)encoded,
encode_int(encoded, diff),
iter_pool));
- last_revision = entry.items[sub_item].revision;
+ last_revision = item_rev;
}
for (sub_item = 0; sub_item < entry.item_count; ++sub_item)
@@ -2109,7 +2112,8 @@ read_entry(packed_number_stream_t *strea
{
SVN_ERR(packed_stream_get(&value, stream));
revision += (svn_revnum_t)(value % 2 ? -1 - value / 2 : value / 2);
- entry.items[sub_item].revision = revision;
+ entry.items[sub_item].change_set
+ = svn_fs_x__change_set_by_rev(revision);
}
for (sub_item = 0; sub_item < entry.item_count; ++sub_item)
@@ -2671,17 +2675,17 @@ svn_error_t *
svn_fs_x__item_offset(apr_off_t *offset,
apr_uint32_t *sub_item,
svn_fs_t *fs,
- svn_revnum_t revision,
- const svn_fs_x__id_part_t *txn_id,
- apr_uint64_t item_index,
+ const svn_fs_x__id_part_t *item_id,
apr_pool_t *pool)
{
- if (txn_id)
- SVN_ERR(l2p_proto_index_lookup(offset, sub_item,
- fs, txn_id, item_index, pool));
+ if (svn_fs_x__is_txn(item_id->change_set))
+ SVN_ERR(l2p_proto_index_lookup(offset, sub_item, fs,
+ svn_fs_x__get_txn_id(item_id->change_set),
+ item_id->number, pool));
else
- SVN_ERR(l2p_index_lookup(offset, sub_item,
- fs, revision, item_index, pool));
+ SVN_ERR(l2p_index_lookup(offset, sub_item, fs,
+ svn_fs_x__get_revnum(item_id->change_set),
+ item_id->number, pool));
return SVN_NO_ERROR;
}
Modified: subversion/branches/fsfs-ucsnorm/subversion/libsvn_fs_x/index.h
URL: http://svn.apache.org/viewvc/subversion/branches/fsfs-ucsnorm/subversion/libsvn_fs_x/index.h?rev=1568883&r1=1568882&r2=1568883&view=diff
==============================================================================
--- subversion/branches/fsfs-ucsnorm/subversion/libsvn_fs_x/index.h (original)
+++ subversion/branches/fsfs-ucsnorm/subversion/libsvn_fs_x/index.h Mon Feb 17 05:53:23 2014
@@ -201,20 +201,14 @@ svn_fs_x__p2l_item_lookup(svn_fs_x__id_p
apr_pool_t *pool);
/* Use the log-to-phys mapping files in FS to find the packed / non-packed /
- * proto-rev file offset and container sub-item of either (REVISION,
- * ITEM_INDEX) or (TXN_ID, ITEM_INDEX). *SUB_ITEM will be 0 for non-
- * container items. For committed revision, TXN_ID must be NULL. For
- * format 6 and older repositories, we simply map the revision local offset
- * given as ITEM_INDEX to the actual file offset (when packed).
- * Use POOL for allocations.
+ * proto-rev file offset and container sub-item of ITEM_ID. *SUB_ITEM will
+ * be 0 for non-container items. Use POOL for allocations.
*/
svn_error_t *
svn_fs_x__item_offset(apr_off_t *offset,
apr_uint32_t *sub_item,
svn_fs_t *fs,
- svn_revnum_t revision,
- const svn_fs_x__id_part_t *txn_id,
- apr_uint64_t item_index,
+ const svn_fs_x__id_part_t *item_id,
apr_pool_t *pool);
/* Use the log-to-phys indexes in FS to determine the maximum item indexes
Modified: subversion/branches/fsfs-ucsnorm/subversion/libsvn_fs_x/low_level.c
URL: http://svn.apache.org/viewvc/subversion/branches/fsfs-ucsnorm/subversion/libsvn_fs_x/low_level.c?rev=1568883&r1=1568882&r2=1568883&view=diff
==============================================================================
--- subversion/branches/fsfs-ucsnorm/subversion/libsvn_fs_x/low_level.c (original)
+++ subversion/branches/fsfs-ucsnorm/subversion/libsvn_fs_x/low_level.c Mon Feb 17 05:53:23 2014
@@ -241,25 +241,24 @@ svn_fs_x__parse_representation(represent
return svn_error_create(SVN_ERR_FS_CORRUPT, NULL,
_("Malformed text representation offset line in node-rev"));
+ SVN_ERR(svn_cstring_atoi64(&rep->id.change_set, str));
- rep->revision = SVN_STR_TO_REV(str);
-
- /* initialize transaction info (never stored) */
- svn_fs_x__id_txn_reset(&rep->txn_id);
-
/* while in transactions, it is legal to simply write "-1" */
+ if (rep->id.change_set == -1)
+ return SVN_NO_ERROR;
+
str = svn_cstring_tokenize(" ", &string);
if (str == NULL)
{
- if (rep->revision == SVN_INVALID_REVNUM)
+ if (rep->id.change_set == SVN_FS_X__INVALID_CHANGE_SET)
return SVN_NO_ERROR;
-
+
return svn_error_create(SVN_ERR_FS_CORRUPT, NULL,
_("Malformed text representation offset line in node-rev"));
}
SVN_ERR(svn_cstring_atoi64(&val, str));
- rep->item_index = (apr_off_t)val;
+ rep->id.number = (apr_off_t)val;
str = svn_cstring_tokenize(" ", &string);
if (str == NULL)
@@ -284,7 +283,8 @@ svn_fs_x__parse_representation(represent
_("Malformed text representation offset line in node-rev"));
SVN_ERR(svn_checksum_parse_hex(&checksum, svn_checksum_md5, str, pool));
- memcpy(rep->md5_digest, checksum->digest, sizeof(rep->md5_digest));
+ if (checksum)
+ memcpy(rep->md5_digest, checksum->digest, sizeof(rep->md5_digest));
/* The remaining fields are only used for formats >= 4, so check that. */
str = svn_cstring_tokenize(" ", &string);
@@ -298,22 +298,8 @@ svn_fs_x__parse_representation(represent
SVN_ERR(svn_checksum_parse_hex(&checksum, svn_checksum_sha1, str, pool));
rep->has_sha1 = checksum != NULL;
- memcpy(rep->sha1_digest, checksum->digest, sizeof(rep->sha1_digest));
-
- /* Read the uniquifier. */
- str = svn_cstring_tokenize("/", &string);
- if (str == NULL)
- return svn_error_create(SVN_ERR_FS_CORRUPT, NULL,
- _("Malformed text representation offset line in node-rev"));
-
- SVN_ERR(svn_fs_x__id_txn_parse(&rep->uniquifier.txn_id, str));
-
- str = svn_cstring_tokenize(" ", &string);
- if (str == NULL)
- return svn_error_create(SVN_ERR_FS_CORRUPT, NULL,
- _("Malformed text representation offset line in node-rev"));
-
- rep->uniquifier.number = svn__base36toui64(NULL, str);
+ if (checksum)
+ memcpy(rep->sha1_digest, checksum->digest, sizeof(rep->sha1_digest));
return SVN_NO_ERROR;
}
@@ -342,10 +328,6 @@ read_rep_offsets(representation_t **rep_
return svn_error_quick_wrap(err, where);
}
- if ((*rep_p)->revision == SVN_INVALID_REVNUM)
- if (noderev_id)
- (*rep_p)->txn_id = *svn_fs_x__id_txn_id(noderev_id);
-
return SVN_NO_ERROR;
}
@@ -579,29 +561,22 @@ svn_fs_x__unparse_representation(represe
svn_boolean_t mutable_rep_truncated,
apr_pool_t *pool)
{
- char buffer[SVN_INT64_BUFFER_SIZE];
- if (svn_fs_x__id_txn_used(&rep->txn_id) && mutable_rep_truncated)
- return svn_stringbuf_ncreate("-1", 2, pool);
-
if (!rep->has_sha1)
return svn_stringbuf_createf
- (pool, "%ld %" APR_OFF_T_FMT " %" SVN_FILESIZE_T_FMT
+ (pool, "%ld %" APR_INT64_T_FMT " %" SVN_FILESIZE_T_FMT
" %" SVN_FILESIZE_T_FMT " %s",
- rep->revision, rep->item_index, rep->size,
+ rep->id.change_set, rep->id.number, rep->size,
rep->expanded_size,
format_digest(rep->md5_digest, svn_checksum_md5, FALSE, pool));
- svn__ui64tobase36(buffer, rep->uniquifier.number);
return svn_stringbuf_createf
- (pool, "%ld %" APR_OFF_T_FMT " %" SVN_FILESIZE_T_FMT
- " %" SVN_FILESIZE_T_FMT " %s %s %s/%s",
- rep->revision, rep->item_index, rep->size,
+ (pool, "%ld %" APR_INT64_T_FMT " %" SVN_FILESIZE_T_FMT
+ " %" SVN_FILESIZE_T_FMT " %s %s",
+ rep->id.change_set, rep->id.number, rep->size,
rep->expanded_size,
format_digest(rep->md5_digest, svn_checksum_md5, FALSE, pool),
format_digest(rep->sha1_digest, svn_checksum_sha1,
- !rep->has_sha1, pool),
- svn_fs_x__id_txn_unparse(&rep->uniquifier.txn_id, pool),
- buffer);
+ !rep->has_sha1, pool));
#undef DISPLAY_MAYBE_NULL_CHECKSUM
Modified: subversion/branches/fsfs-ucsnorm/subversion/libsvn_fs_x/noderevs.c
URL: http://svn.apache.org/viewvc/subversion/branches/fsfs-ucsnorm/subversion/libsvn_fs_x/noderevs.c?rev=1568883&r1=1568882&r2=1568883&view=diff
==============================================================================
--- subversion/branches/fsfs-ucsnorm/subversion/libsvn_fs_x/noderevs.c (original)
+++ subversion/branches/fsfs-ucsnorm/subversion/libsvn_fs_x/noderevs.c Mon Feb 17 05:53:23 2014
@@ -56,7 +56,7 @@ typedef struct binary_id_t
{
svn_fs_x__id_part_t node_id;
svn_fs_x__id_part_t copy_id;
- svn_fs_x__id_part_t rev_id;
+ svn_fs_x__id_part_t noderev_id;
} binary_id_t;
/* Our internal representation of an representation.
@@ -71,11 +71,8 @@ typedef struct binary_representation_t
unsigned char sha1_digest[APR_SHA1_DIGESTSIZE];
unsigned char md5_digest[APR_MD5_DIGESTSIZE];
- /* Revision where this representation is located. */
- svn_revnum_t revision;
-
- /* Item index with the the revision. */
- apr_uint64_t item_index;
+ /* Location of this representation. */
+ svn_fs_x__id_part_t id;
/* The size of the representation in bytes as seen in the revision
file. */
@@ -86,27 +83,6 @@ typedef struct binary_representation_t
svn_filesize_t expanded_size;
} binary_representation_t;
-/* Add a uniquifier to binary_representation_t to distinguish between
- * multiple uses of the same shared representation.
- */
-typedef struct shared_representation_t
-{
- /* For rep-sharing, we need a way of uniquifying node-revs which share the
- same representation (see svn_fs_x__noderev_same_rep_key() ). So, we
- store the original txn of the node rev (not the rep!), along with some
- intra-node uniqification content. */
- struct
- {
- svn_fs_x__id_part_t txn_id;
- apr_uint64_t number;
- } uniquifier;
-
- /* Index+1 of the representation.
- */
- int representation;
-} shared_representation_t;
-
-
/* Our internal representation of a node_revision_t.
*
* We will store path strings in a string container and reference them
@@ -151,7 +127,7 @@ typedef struct binary_noderev_t
/* Index+1 of the representation for this node's data.
May be 0 if there is no data. */
- shared_representation_t data_rep;
+ int data_rep;
/* String index+1 of the path at which this node first came into
existence. */
@@ -240,7 +216,7 @@ store_id(apr_array_header_t *ids,
bin_id.node_id = *svn_fs_x__id_node_id(id);
bin_id.copy_id = *svn_fs_x__id_copy_id(id);
- bin_id.rev_id = *svn_fs_x__id_rev_item(id);
+ bin_id.noderev_id = *svn_fs_x__id_noderev_id(id);
idx = (int)(apr_uintptr_t)apr_hash_get(dict, &bin_id, sizeof(bin_id));
if (idx == 0)
@@ -271,8 +247,7 @@ store_representation(apr_array_header_t
binary_rep.has_sha1 = rep->has_sha1;
memcpy(binary_rep.sha1_digest, rep->sha1_digest, sizeof(rep->sha1_digest));
memcpy(binary_rep.md5_digest, rep->md5_digest, sizeof(rep->md5_digest));
- binary_rep.revision = rep->revision;
- binary_rep.item_index = rep->item_index;
+ binary_rep.id = rep->id;
binary_rep.size = rep->size;
binary_rep.expanded_size = rep->expanded_size;
@@ -329,16 +304,9 @@ svn_fs_x__noderevs_add(svn_fs_x__noderev
container->prop_reps_dict,
noderev->prop_rep);
if (noderev->data_rep)
- {
- binary_noderev.data_rep.representation
- = store_representation(container->data_reps,
- container->data_reps_dict,
- noderev->data_rep);
- binary_noderev.data_rep.uniquifier.txn_id
- = noderev->data_rep->uniquifier.txn_id;
- binary_noderev.data_rep.uniquifier.number
- = noderev->data_rep->uniquifier.number;
- }
+ binary_noderev.data_rep = store_representation(container->data_reps,
+ container->data_reps_dict,
+ noderev->data_rep);
if (noderev->created_path)
binary_noderev.created_path
@@ -401,10 +369,10 @@ get_id(const svn_fs_id_t **id,
/* create a svn_fs_id_t from stored info */
binary_id = &APR_ARRAY_IDX(ids, idx - 1, binary_id_t);
- *id = svn_fs_x__id_rev_create(&binary_id->node_id,
- &binary_id->copy_id,
- &binary_id->rev_id,
- pool);
+ *id = svn_fs_x__id_create(&binary_id->node_id,
+ &binary_id->copy_id,
+ &binary_id->noderev_id,
+ pool);
return SVN_NO_ERROR;
}
@@ -443,11 +411,9 @@ get_representation(representation_t **re
sizeof((*rep)->sha1_digest));
memcpy((*rep)->md5_digest, binary_rep->md5_digest,
sizeof((*rep)->md5_digest));
- (*rep)->revision = binary_rep->revision;
- (*rep)->item_index = binary_rep->item_index;
+ (*rep)->id = binary_rep->id;
(*rep)->size = binary_rep->size;
(*rep)->expanded_size = binary_rep->expanded_size;
- svn_fs_x__id_txn_reset(&(*rep)->txn_id);
return SVN_NO_ERROR;
}
@@ -518,14 +484,7 @@ svn_fs_x__noderevs_get(node_revision_t *
SVN_ERR(get_representation(&noderev->prop_rep, container->prop_reps,
binary_noderev->prop_rep, pool));
SVN_ERR(get_representation(&noderev->data_rep, container->data_reps,
- binary_noderev->data_rep.representation, pool));
- if (noderev->data_rep)
- {
- noderev->data_rep->uniquifier.txn_id
- = binary_noderev->data_rep.uniquifier.txn_id;
- noderev->data_rep->uniquifier.number
- = binary_noderev->data_rep.uniquifier.number;
- }
+ binary_noderev->data_rep, pool));
if (binary_noderev->flags & NODEREV_HAS_CPATH)
noderev->created_path
@@ -580,11 +539,11 @@ write_reps(svn_packed__int_stream_t *rep
svn_packed__add_uint(rep_stream, rep->has_sha1);
- svn_packed__add_uint(rep_stream, rep->revision);
- svn_packed__add_uint(rep_stream, rep->item_index);
+ svn_packed__add_uint(rep_stream, rep->id.change_set);
+ svn_packed__add_uint(rep_stream, rep->id.number);
svn_packed__add_uint(rep_stream, rep->size);
svn_packed__add_uint(rep_stream, rep->expanded_size);
-
+
svn_packed__add_bytes(digest_stream,
(const char *)rep->md5_digest,
sizeof(rep->md5_digest));
@@ -629,7 +588,7 @@ svn_fs_x__write_noderevs_container(svn_s
svn_packed__create_int_substream(ids_stream, TRUE, FALSE);
svn_packed__create_int_substream(noderevs_stream, FALSE, FALSE);
- for (i = 0; i < 14; ++i)
+ for (i = 0; i < 12; ++i)
svn_packed__create_int_substream(noderevs_stream, TRUE, FALSE);
/* serialize ids array */
@@ -637,12 +596,12 @@ svn_fs_x__write_noderevs_container(svn_s
{
binary_id_t *id = &APR_ARRAY_IDX(container->ids, i, binary_id_t);
- svn_packed__add_int(ids_stream, id->node_id.revision);
+ svn_packed__add_int(ids_stream, id->node_id.change_set);
svn_packed__add_uint(ids_stream, id->node_id.number);
- svn_packed__add_int(ids_stream, id->copy_id.revision);
+ svn_packed__add_int(ids_stream, id->copy_id.change_set);
svn_packed__add_uint(ids_stream, id->copy_id.number);
- svn_packed__add_int(ids_stream, id->rev_id.revision);
- svn_packed__add_uint(ids_stream, id->rev_id.number);
+ svn_packed__add_int(ids_stream, id->noderev_id.change_set);
+ svn_packed__add_uint(ids_stream, id->noderev_id.number);
}
/* serialize rep arrays */
@@ -656,25 +615,18 @@ svn_fs_x__write_noderevs_container(svn_s
= &APR_ARRAY_IDX(container->noderevs, i, binary_noderev_t);
svn_packed__add_uint(noderevs_stream, noderev->flags);
-
+
svn_packed__add_uint(noderevs_stream, noderev->id);
svn_packed__add_uint(noderevs_stream, noderev->predecessor_id);
svn_packed__add_uint(noderevs_stream, noderev->predecessor_count);
-
+
svn_packed__add_uint(noderevs_stream, noderev->copyfrom_path);
svn_packed__add_int(noderevs_stream, noderev->copyfrom_rev);
svn_packed__add_uint(noderevs_stream, noderev->copyroot_path);
svn_packed__add_int(noderevs_stream, noderev->copyroot_rev);
svn_packed__add_uint(noderevs_stream, noderev->prop_rep);
- svn_packed__add_uint(noderevs_stream, noderev->data_rep.representation);
-
- svn_packed__add_int(noderevs_stream,
- noderev->data_rep.uniquifier.txn_id.revision);
- svn_packed__add_uint(noderevs_stream,
- noderev->data_rep.uniquifier.txn_id.number);
- svn_packed__add_uint(noderevs_stream,
- noderev->data_rep.uniquifier.number);
+ svn_packed__add_uint(noderevs_stream, noderev->data_rep);
svn_packed__add_uint(noderevs_stream, noderev->created_path);
svn_packed__add_uint(noderevs_stream, noderev->mergeinfo_count);
@@ -712,8 +664,8 @@ read_reps(apr_array_header_t **reps_p,
rep.has_sha1 = (svn_boolean_t)svn_packed__get_uint(rep_stream);
- rep.revision = (svn_revnum_t)svn_packed__get_uint(rep_stream);
- rep.item_index = svn_packed__get_uint(rep_stream);
+ rep.id.change_set = (svn_revnum_t)svn_packed__get_uint(rep_stream);
+ rep.id.number = svn_packed__get_uint(rep_stream);
rep.size = svn_packed__get_uint(rep_stream);
rep.expanded_size = svn_packed__get_uint(rep_stream);
@@ -793,16 +745,16 @@ svn_fs_x__read_noderevs_container(svn_fs
{
binary_id_t id;
- id.node_id.revision = (svn_revnum_t)svn_packed__get_int(ids_stream);
+ id.node_id.change_set = (svn_revnum_t)svn_packed__get_int(ids_stream);
id.node_id.number = svn_packed__get_uint(ids_stream);
- id.copy_id.revision = (svn_revnum_t)svn_packed__get_int(ids_stream);
+ id.copy_id.change_set = (svn_revnum_t)svn_packed__get_int(ids_stream);
id.copy_id.number = svn_packed__get_uint(ids_stream);
- id.rev_id.revision = (svn_revnum_t)svn_packed__get_int(ids_stream);
- id.rev_id.number = svn_packed__get_uint(ids_stream);
+ id.noderev_id.change_set = (svn_revnum_t)svn_packed__get_int(ids_stream);
+ id.noderev_id.number = svn_packed__get_uint(ids_stream);
APR_ARRAY_PUSH(noderevs->ids, binary_id_t) = id;
}
-
+
/* read rep arrays */
SVN_ERR(read_reps(&noderevs->data_reps, data_reps_stream, digests_stream,
result_pool));
@@ -830,15 +782,7 @@ svn_fs_x__read_noderevs_container(svn_fs
noderev.copyroot_rev = (svn_revnum_t)svn_packed__get_int(noderevs_stream);
noderev.prop_rep = (int)svn_packed__get_uint(noderevs_stream);
- noderev.data_rep.representation
- = (int)svn_packed__get_uint(noderevs_stream);
-
- noderev.data_rep.uniquifier.txn_id.revision
- = (svn_revnum_t)svn_packed__get_int(noderevs_stream);
- noderev.data_rep.uniquifier.txn_id.number
- = svn_packed__get_uint(noderevs_stream);
- noderev.data_rep.uniquifier.number
- = svn_packed__get_uint(noderevs_stream);
+ noderev.data_rep = (int)svn_packed__get_uint(noderevs_stream);
noderev.created_path = (int)svn_packed__get_uint(noderevs_stream);
noderev.mergeinfo_count = svn_packed__get_uint(noderevs_stream);
@@ -998,14 +942,7 @@ svn_fs_x__noderevs_get_func(void **out,
SVN_ERR(get_representation(&noderev->prop_rep, &prop_reps,
binary_noderev->prop_rep, pool));
SVN_ERR(get_representation(&noderev->data_rep, &data_reps,
- binary_noderev->data_rep.representation, pool));
- if (noderev->data_rep)
- {
- noderev->data_rep->uniquifier.txn_id
- = binary_noderev->data_rep.uniquifier.txn_id;
- noderev->data_rep->uniquifier.number
- = binary_noderev->data_rep.uniquifier.number;
- }
+ binary_noderev->data_rep, pool));
if (binary_noderev->flags & NODEREV_HAS_CPATH)
noderev->created_path
Modified: subversion/branches/fsfs-ucsnorm/subversion/libsvn_fs_x/pack.c
URL: http://svn.apache.org/viewvc/subversion/branches/fsfs-ucsnorm/subversion/libsvn_fs_x/pack.c?rev=1568883&r1=1568882&r2=1568883&view=diff
==============================================================================
--- subversion/branches/fsfs-ucsnorm/subversion/libsvn_fs_x/pack.c (original)
+++ subversion/branches/fsfs-ucsnorm/subversion/libsvn_fs_x/pack.c Mon Feb 17 05:53:23 2014
@@ -498,7 +498,7 @@ add_item_rep_mapping(pack_context_t *con
/* index of INFO */
idx = get_item_array_index(context,
- entry->items[0].revision,
+ entry->items[0].change_set,
entry->items[0].number);
/* make sure the index exists in the array */
@@ -521,9 +521,10 @@ get_item(pack_context_t *context,
svn_boolean_t reset)
{
svn_fs_x__p2l_entry_t *result = NULL;
- if (id->number && id->revision >= context->start_rev)
+ svn_revnum_t revision = svn_fs_x__get_revnum(id->change_set);
+ if (id->number && revision >= context->start_rev)
{
- int idx = get_item_array_index(context, id->revision, id->number);
+ int idx = get_item_array_index(context, revision, id->number);
if (context->reps->nelts > idx)
{
result = APR_ARRAY_IDX(context->reps, idx, void *);
@@ -569,7 +570,8 @@ copy_rep_to_temp(pack_context_t *context
reference_t *reference = apr_pcalloc(context->info_pool,
sizeof(*reference));
reference->from = entry->items[0];
- reference->to.revision = rep_header->base_revision;
+ reference->to.change_set
+ = svn_fs_x__change_set_by_rev(rep_header->base_revision);
reference->to.number = rep_header->base_item_index;
APR_ARRAY_PUSH(context->references, reference_t *) = reference;
}
@@ -659,13 +661,15 @@ copy_node_to_temp(pack_context_t *contex
* This will (often) cause the noderev to be placed right in front of
* its data representation. */
- if (noderev->data_rep && noderev->data_rep->revision >= context->start_rev)
+ if (noderev->data_rep
+ && svn_fs_x__get_revnum(noderev->data_rep->id.change_set)
+ >= context->start_rev)
{
reference_t *reference = apr_pcalloc(context->info_pool,
sizeof(*reference));
reference->from = entry->items[0];
- reference->to.revision = noderev->data_rep->revision;
- reference->to.number = noderev->data_rep->item_index;
+ reference->to.change_set = noderev->data_rep->id.change_set;
+ reference->to.number = noderev->data_rep->id.number;
APR_ARRAY_PUSH(context->references, reference_t *) = reference;
path_order->rep_id = reference->to;
@@ -676,7 +680,7 @@ copy_node_to_temp(pack_context_t *contex
noderev->created_path);
path_order->node_id = *svn_fs_x__id_node_id(noderev->id);
path_order->revision = svn_fs_x__id_rev(noderev->id);
- path_order->noderev_id = *svn_fs_x__id_rev_item(noderev->id);
+ path_order->noderev_id = *svn_fs_x__id_noderev_id(noderev->id);
APR_ARRAY_PUSH(context->path_order, path_order_t *) = path_order;
return SVN_NO_ERROR;
@@ -694,10 +698,10 @@ compare_p2l_info(const svn_fs_x__p2l_ent
if ((*lhs)->item_count == 0)
return 1;
- if ((*lhs)->items[0].revision == (*rhs)->items[0].revision)
+ if ((*lhs)->items[0].change_set == (*rhs)->items[0].change_set)
return (*lhs)->items[0].number > (*rhs)->items[0].number ? -1 : 1;
- return (*lhs)->items[0].revision > (*rhs)->items[0].revision ? -1 : 1;
+ return (*lhs)->items[0].change_set > (*rhs)->items[0].change_set ? -1 : 1;
}
/* Sort svn_fs_x__p2l_entry_t * array ENTRIES by age. Place the latest
@@ -730,9 +734,9 @@ static int
compare_sub_items(const svn_fs_x__id_part_t * const * lhs,
const svn_fs_x__id_part_t * const * rhs)
{
- return (*lhs)->revision < (*rhs)->revision
+ return (*lhs)->change_set < (*rhs)->change_set
? 1
- : ((*lhs)->revision > (*rhs)->revision ? -1 : 0);
+ : ((*lhs)->change_set > (*rhs)->change_set ? -1 : 0);
}
/* implements compare_fn_t. Place LHS before RHS, if the latter belongs to
@@ -756,10 +760,10 @@ compare_p2l_info_rev(const sub_item_orde
rhs_part = rhs->order ? rhs->order[rhs->entry->item_count - 1]
: &rhs->entry->items[0];
- if (lhs_part->revision == rhs_part->revision)
+ if (lhs_part->change_set == rhs_part->change_set)
return 0;
- return lhs_part->revision < rhs_part->revision ? -1 : 1;
+ return lhs_part->change_set < rhs_part->change_set ? -1 : 1;
}
/* implements compare_fn_t. Sort descending by PATH, NODE_ID and REVISION.
@@ -1253,9 +1257,7 @@ write_reps_containers(pack_context_t *co
}
assert(entry->item_count == 1);
- representation.revision = entry->items[0].revision;
- representation.item_index = entry->items[0].number;
- svn_fs_x__id_txn_reset(&representation.txn_id);
+ representation.id = entry->items[0];
/* select the change list in the source file, parse it and add it to
* the container */
@@ -1714,9 +1716,9 @@ write_l2p_index(pack_context_t *context,
: &ordered->entry->items[0];
/* next revision? */
- if (prev_rev != sub_item->revision)
+ if (prev_rev != svn_fs_x__get_revnum(sub_item->change_set))
{
- prev_rev = sub_item->revision;
+ prev_rev = svn_fs_x__get_revnum(sub_item->change_set);
SVN_ERR(svn_fs_x__l2p_proto_index_add_revision
(context->proto_l2p_index, iterpool));
}
Modified: subversion/branches/fsfs-ucsnorm/subversion/libsvn_fs_x/rep-cache.c
URL: http://svn.apache.org/viewvc/subversion/branches/fsfs-ucsnorm/subversion/libsvn_fs_x/rep-cache.c?rev=1568883&r1=1568882&r2=1568883&view=diff
==============================================================================
--- subversion/branches/fsfs-ucsnorm/subversion/libsvn_fs_x/rep-cache.c (original)
+++ subversion/branches/fsfs-ucsnorm/subversion/libsvn_fs_x/rep-cache.c Mon Feb 17 05:53:23 2014
@@ -56,9 +56,10 @@ rep_has_been_born(representation_t *rep,
svn_fs_t *fs,
apr_pool_t *pool)
{
+ svn_revnum_t revision = svn_fs_x__get_revnum(rep->id.change_set);
SVN_ERR_ASSERT(rep);
- SVN_ERR(svn_fs_x__ensure_revision_exists(rep->revision, fs, pool));
+ SVN_ERR(svn_fs_x__ensure_revision_exists(revision, fs, pool));
return SVN_NO_ERROR;
}
@@ -81,7 +82,7 @@ open_rep_cache(void *baton,
int version;
/* Open (or create) the sqlite database. It will be automatically
- closed when fs->pool is destoyed. */
+ closed when fs->pool is destroyed. */
db_path = path_rep_cache_db(fs->path, pool);
SVN_ERR(svn_sqlite__open(&sdb, db_path,
svn_sqlite__mode_rwcreate, statements,
@@ -191,7 +192,6 @@ svn_fs_x__walk_rep_reference(svn_fs_t *f
/* Construct a representation_t. */
rep = apr_pcalloc(iterpool, sizeof(*rep));
- svn_fs_x__id_txn_reset(&rep->txn_id);
sha1_digest = svn_sqlite__column_text(stmt, 0, iterpool);
err = svn_checksum_parse_hex(&checksum, svn_checksum_sha1,
sha1_digest, iterpool);
@@ -200,8 +200,8 @@ svn_fs_x__walk_rep_reference(svn_fs_t *f
rep->has_sha1 = TRUE;
memcpy(rep->sha1_digest, checksum->digest, sizeof(rep->sha1_digest));
- rep->revision = svn_sqlite__column_revnum(stmt, 1);
- rep->item_index = svn_sqlite__column_int64(stmt, 2);
+ rep->id.change_set = svn_sqlite__column_revnum(stmt, 1);
+ rep->id.number = svn_sqlite__column_int64(stmt, 2);
rep->size = svn_sqlite__column_int64(stmt, 3);
rep->expanded_size = svn_sqlite__column_int64(stmt, 4);
@@ -251,12 +251,11 @@ svn_fs_x__get_rep_reference(representati
if (have_row)
{
*rep = apr_pcalloc(pool, sizeof(**rep));
- svn_fs_x__id_txn_reset(&(*rep)->txn_id);
memcpy((*rep)->sha1_digest, checksum->digest,
sizeof((*rep)->sha1_digest));
(*rep)->has_sha1 = TRUE;
- (*rep)->revision = svn_sqlite__column_revnum(stmt, 0);
- (*rep)->item_index = svn_sqlite__column_int64(stmt, 1);
+ (*rep)->id.change_set = svn_sqlite__column_revnum(stmt, 0);
+ (*rep)->id.number = svn_sqlite__column_int64(stmt, 1);
(*rep)->size = svn_sqlite__column_int64(stmt, 2);
(*rep)->expanded_size = svn_sqlite__column_int64(stmt, 3);
}
@@ -297,8 +296,8 @@ svn_fs_x__set_rep_reference(svn_fs_t *fs
SVN_ERR(svn_sqlite__get_statement(&stmt, ffd->rep_cache_db, STMT_SET_REP));
SVN_ERR(svn_sqlite__bindf(stmt, "siiii",
svn_checksum_to_cstring(&checksum, pool),
- (apr_int64_t) rep->revision,
- (apr_int64_t) rep->item_index,
+ (apr_int64_t) rep->id.change_set,
+ (apr_int64_t) rep->id.number,
(apr_int64_t) rep->size,
(apr_int64_t) rep->expanded_size));
@@ -320,8 +319,7 @@ svn_fs_x__set_rep_reference(svn_fs_t *fs
if (old_rep)
{
- if (reject_dup && ((old_rep->revision != rep->revision)
- || (old_rep->item_index != rep->item_index)
+ if (reject_dup && (!svn_fs_x__id_part_eq(&old_rep->id, &rep->id)
|| (old_rep->size != rep->size)
|| (old_rep->expanded_size != rep->expanded_size)))
return svn_error_createf(SVN_ERR_FS_CORRUPT, NULL,
@@ -334,9 +332,9 @@ svn_fs_x__set_rep_reference(svn_fs_t *fs
SVN_FILESIZE_T_FMT, APR_OFF_T_FMT,
SVN_FILESIZE_T_FMT, SVN_FILESIZE_T_FMT),
svn_checksum_to_cstring_display(&checksum, pool),
- fs->path, old_rep->revision, old_rep->item_index,
- old_rep->size, old_rep->expanded_size, rep->revision,
- rep->item_index, rep->size, rep->expanded_size);
+ fs->path, old_rep->id.change_set, old_rep->id.number,
+ old_rep->size, old_rep->expanded_size, rep->id.change_set,
+ rep->id.number, rep->size, rep->expanded_size);
else
return SVN_NO_ERROR;
}
Modified: subversion/branches/fsfs-ucsnorm/subversion/libsvn_fs_x/reps.c
URL: http://svn.apache.org/viewvc/subversion/branches/fsfs-ucsnorm/subversion/libsvn_fs_x/reps.c?rev=1568883&r1=1568882&r2=1568883&view=diff
==============================================================================
--- subversion/branches/fsfs-ucsnorm/subversion/libsvn_fs_x/reps.c (original)
+++ subversion/branches/fsfs-ucsnorm/subversion/libsvn_fs_x/reps.c Mon Feb 17 05:53:23 2014
@@ -401,12 +401,12 @@ svn_fs_x__reps_add_base(svn_fs_x__reps_b
SVN_ERR(svn_fs_x__get_contents(&stream, builder->fs, rep, scratch_pool));
SVN_ERR(svn_string_from_stream(&contents, stream, scratch_pool,
scratch_pool));
-
- base.revision = rep->revision;
- base.item_index = rep->item_index;
+
+ base.revision = svn_fs_x__get_revnum(rep->id.change_set);
+ base.item_index = rep->id.number;
base.priority = priority;
base.rep = (apr_uint32_t)svn_fs_x__reps_add(builder, contents);
-
+
APR_ARRAY_PUSH(builder->bases, base_t) = base;
builder->base_text_len += builder->text->len - text_start_offset;