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 2012/08/16 12:18:03 UTC
svn commit: r1373783 [13/50] - in /subversion/branches/compressed-pristines:
./ build/ build/ac-macros/ build/generator/ build/generator/templates/
build/win32/ contrib/client-side/emacs/ contrib/client-side/svn-push/
contrib/client-side/svnmerge/ cont...
Modified: subversion/branches/compressed-pristines/subversion/libsvn_delta/editor.c
URL: http://svn.apache.org/viewvc/subversion/branches/compressed-pristines/subversion/libsvn_delta/editor.c?rev=1373783&r1=1373782&r2=1373783&view=diff
==============================================================================
--- subversion/branches/compressed-pristines/subversion/libsvn_delta/editor.c (original)
+++ subversion/branches/compressed-pristines/subversion/libsvn_delta/editor.c Thu Aug 16 10:17:48 2012
@@ -61,7 +61,7 @@ struct svn_editor_t
apr_hash_t *completed_nodes;
svn_boolean_t finished;
- apr_pool_t *result_pool;
+ apr_pool_t *state_pool;
#endif
};
@@ -105,7 +105,7 @@ static const int marker_added_dir;
#define MARK_RELPATH(editor, relpath, value) \
apr_hash_set((editor)->completed_nodes, \
- apr_pstrdup((editor)->result_pool, relpath), \
+ apr_pstrdup((editor)->state_pool, relpath), \
APR_HASH_KEY_STRING, value)
#define MARK_COMPLETED(editor, relpath) \
@@ -129,6 +129,36 @@ static const int marker_added_dir;
#define CHECK_UNKNOWN_CHILD(editor, relpath) \
SVN_ERR_ASSERT(check_unknown_child(editor, relpath))
+/* When a child is changed in some way, mark the parent directory as needing
+ to be "stable" (no future structural changes). IOW, only allow "alter" on
+ the parent. Prevents parent-add/delete/move after any child operation. */
+#define MARK_PARENT_STABLE(editor, relpath) \
+ mark_parent_stable(editor, relpath)
+
+/* If the parent is MARKER_ALLOW_ADD, then it has been moved-away, and we
+ know it does not exist. All other cases: it might exist. */
+#define VERIFY_PARENT_MAY_EXIST(editor, relpath) \
+ SVN_ERR_ASSERT(apr_hash_get((editor)->completed_nodes, \
+ svn_relpath_dirname(relpath, \
+ (editor)->scratch_pool), \
+ APR_HASH_KEY_STRING) != MARKER_ALLOW_ADD)
+
+/* If the parent is MARKER_ADDED_DIR, then we should not be deleting
+ children(*). If the parent is MARKER_ALLOW_ADD, then it has been
+ moved-away, so children cannot exist. That leaves MARKER_DONE,
+ MARKER_ALLOW_ALTER, and NULL as possible values. Just assert that
+ we didn't get either of the bad ones.
+
+ (*) if the child as added via add_*(), then it would have been marked
+ as completed and delete/move-away already test against completed nodes.
+ This test is to beware of trying to delete "children" that are not
+ actually (and can't possibly be) present. */
+#define CHILD_DELETIONS_ALLOWED(editor, relpath) \
+ SVN_ERR_ASSERT(!allow_either(editor, \
+ svn_relpath_dirname(relpath, \
+ (editor)->scratch_pool), \
+ MARKER_ADDED_DIR, MARKER_ALLOW_ADD))
+
static svn_boolean_t
allow_either(const svn_editor_t *editor,
const char *relpath,
@@ -166,6 +196,30 @@ check_unknown_child(const svn_editor_t *
return TRUE;
}
+static void
+mark_parent_stable(const svn_editor_t *editor,
+ const char *relpath)
+{
+ const char *parent = svn_relpath_dirname(relpath, editor->scratch_pool);
+ const void *marker = apr_hash_get(editor->completed_nodes,
+ parent, APR_HASH_KEY_STRING);
+
+ /* If RELPATH has already been marked (to disallow adds, or that it
+ has been fully-completed), then do nothing. */
+ if (marker == MARKER_ALLOW_ALTER
+ || marker == MARKER_DONE
+ || marker == MARKER_ADDED_DIR)
+ return;
+
+ /* If the marker is MARKER_ALLOW_ADD, then that means the parent was
+ moved away. There is no way to work on a child. That should have
+ been tested before we got here by VERIFY_PARENT_MAY_EXIST(). */
+ SVN_ERR_ASSERT_NO_RETURN(marker != MARKER_ALLOW_ADD);
+
+ /* MARKER is NULL. Upgrade it to MARKER_ALLOW_ALTER. */
+ MARK_RELPATH(editor, parent, MARKER_ALLOW_ALTER);
+}
+
#else
/* Be wary with the definition of these macros so that we don't
@@ -192,6 +246,10 @@ check_unknown_child(const svn_editor_t *
#define MARK_ADDED_DIR(editor, relpath) /* empty */
#define CHECK_UNKNOWN_CHILD(editor, relpath) /* empty */
+#define MARK_PARENT_STABLE(editor, relpath) /* empty */
+#define VERIFY_PARENT_MAY_EXIST(editor, relpath) /* empty */
+#define CHILD_DELETIONS_ALLOWED(editor, relpath) /* empty */
+
#endif /* ENABLE_ORDERING_CHECK */
@@ -214,13 +272,20 @@ svn_editor_create(svn_editor_t **editor,
(*editor)->pending_incomplete_children = apr_hash_make(result_pool);
(*editor)->completed_nodes = apr_hash_make(result_pool);
(*editor)->finished = FALSE;
- (*editor)->result_pool = result_pool;
+ (*editor)->state_pool = result_pool;
#endif
return SVN_NO_ERROR;
}
+void *
+svn_editor_get_baton(const svn_editor_t *editor)
+{
+ return editor->baton;
+}
+
+
svn_error_t *
svn_editor_setcb_add_directory(svn_editor_t *editor,
svn_editor_cb_add_directory_t callback,
@@ -390,7 +455,7 @@ check_cancel(svn_editor_t *editor)
END_CALLBACK(editor);
}
- return err;
+ return svn_error_trace(err);
}
@@ -409,6 +474,7 @@ svn_editor_add_directory(svn_editor_t *e
/* ### validate children are just basenames? */
SHOULD_NOT_BE_FINISHED(editor);
SHOULD_ALLOW_ADD(editor, relpath);
+ VERIFY_PARENT_MAY_EXIST(editor, relpath);
CHECK_UNKNOWN_CHILD(editor, relpath);
SVN_ERR(check_cancel(editor));
@@ -423,6 +489,7 @@ svn_editor_add_directory(svn_editor_t *e
}
MARK_ADDED_DIR(editor, relpath);
+ MARK_PARENT_STABLE(editor, relpath);
CLEAR_INCOMPLETE(editor, relpath);
#ifdef ENABLE_ORDERING_CHECK
@@ -432,7 +499,7 @@ svn_editor_add_directory(svn_editor_t *e
{
const char *child_basename = APR_ARRAY_IDX(children, i, const char *);
const char *child = svn_relpath_join(relpath, child_basename,
- editor->result_pool);
+ editor->state_pool);
apr_hash_set(editor->pending_incomplete_children, child,
APR_HASH_KEY_STRING, "");
@@ -441,7 +508,7 @@ svn_editor_add_directory(svn_editor_t *e
#endif
svn_pool_clear(editor->scratch_pool);
- return err;
+ return svn_error_trace(err);
}
@@ -462,6 +529,7 @@ svn_editor_add_file(svn_editor_t *editor
SVN_ERR_ASSERT(props != NULL);
SHOULD_NOT_BE_FINISHED(editor);
SHOULD_ALLOW_ADD(editor, relpath);
+ VERIFY_PARENT_MAY_EXIST(editor, relpath);
CHECK_UNKNOWN_CHILD(editor, relpath);
SVN_ERR(check_cancel(editor));
@@ -476,10 +544,11 @@ svn_editor_add_file(svn_editor_t *editor
}
MARK_COMPLETED(editor, relpath);
+ MARK_PARENT_STABLE(editor, relpath);
CLEAR_INCOMPLETE(editor, relpath);
svn_pool_clear(editor->scratch_pool);
- return err;
+ return svn_error_trace(err);
}
@@ -496,6 +565,7 @@ svn_editor_add_symlink(svn_editor_t *edi
SVN_ERR_ASSERT(props != NULL);
SHOULD_NOT_BE_FINISHED(editor);
SHOULD_ALLOW_ADD(editor, relpath);
+ VERIFY_PARENT_MAY_EXIST(editor, relpath);
CHECK_UNKNOWN_CHILD(editor, relpath);
SVN_ERR(check_cancel(editor));
@@ -509,10 +579,11 @@ svn_editor_add_symlink(svn_editor_t *edi
}
MARK_COMPLETED(editor, relpath);
+ MARK_PARENT_STABLE(editor, relpath);
CLEAR_INCOMPLETE(editor, relpath);
svn_pool_clear(editor->scratch_pool);
- return err;
+ return svn_error_trace(err);
}
@@ -527,6 +598,7 @@ svn_editor_add_absent(svn_editor_t *edit
SVN_ERR_ASSERT(svn_relpath_is_canonical(relpath));
SHOULD_NOT_BE_FINISHED(editor);
SHOULD_ALLOW_ADD(editor, relpath);
+ VERIFY_PARENT_MAY_EXIST(editor, relpath);
CHECK_UNKNOWN_CHILD(editor, relpath);
SVN_ERR(check_cancel(editor));
@@ -540,10 +612,11 @@ svn_editor_add_absent(svn_editor_t *edit
}
MARK_COMPLETED(editor, relpath);
+ MARK_PARENT_STABLE(editor, relpath);
CLEAR_INCOMPLETE(editor, relpath);
svn_pool_clear(editor->scratch_pool);
- return err;
+ return svn_error_trace(err);
}
@@ -551,14 +624,17 @@ svn_error_t *
svn_editor_alter_directory(svn_editor_t *editor,
const char *relpath,
svn_revnum_t revision,
+ const apr_array_header_t *children,
apr_hash_t *props)
{
svn_error_t *err = SVN_NO_ERROR;
SVN_ERR_ASSERT(svn_relpath_is_canonical(relpath));
- SVN_ERR_ASSERT(props != NULL);
+ SVN_ERR_ASSERT(children != NULL || props != NULL);
+ /* ### validate children are just basenames? */
SHOULD_NOT_BE_FINISHED(editor);
SHOULD_ALLOW_ALTER(editor, relpath);
+ VERIFY_PARENT_MAY_EXIST(editor, relpath);
SVN_ERR(check_cancel(editor));
@@ -566,15 +642,36 @@ svn_editor_alter_directory(svn_editor_t
{
START_CALLBACK(editor);
err = editor->funcs.cb_alter_directory(editor->baton,
- relpath, revision, props,
+ relpath, revision,
+ children, props,
editor->scratch_pool);
END_CALLBACK(editor);
}
MARK_COMPLETED(editor, relpath);
+ MARK_PARENT_STABLE(editor, relpath);
+
+#ifdef ENABLE_ORDERING_CHECK
+ /* ### this is not entirely correct. we probably need to adjust the
+ ### check_unknown_child() function for this scenario. */
+#if 0
+ {
+ int i;
+ for (i = 0; i < children->nelts; i++)
+ {
+ const char *child_basename = APR_ARRAY_IDX(children, i, const char *);
+ const char *child = svn_relpath_join(relpath, child_basename,
+ editor->state_pool);
+
+ apr_hash_set(editor->pending_incomplete_children, child,
+ APR_HASH_KEY_STRING, "");
+ }
+ }
+#endif
+#endif
svn_pool_clear(editor->scratch_pool);
- return err;
+ return svn_error_trace(err);
}
@@ -596,6 +693,7 @@ svn_editor_alter_file(svn_editor_t *edit
SVN_ERR_ASSERT(checksum->kind == SVN_EDITOR_CHECKSUM_KIND);
SHOULD_NOT_BE_FINISHED(editor);
SHOULD_ALLOW_ALTER(editor, relpath);
+ VERIFY_PARENT_MAY_EXIST(editor, relpath);
SVN_ERR(check_cancel(editor));
@@ -610,9 +708,10 @@ svn_editor_alter_file(svn_editor_t *edit
}
MARK_COMPLETED(editor, relpath);
+ MARK_PARENT_STABLE(editor, relpath);
svn_pool_clear(editor->scratch_pool);
- return err;
+ return svn_error_trace(err);
}
@@ -629,6 +728,7 @@ svn_editor_alter_symlink(svn_editor_t *e
SVN_ERR_ASSERT(props != NULL || target != NULL);
SHOULD_NOT_BE_FINISHED(editor);
SHOULD_ALLOW_ALTER(editor, relpath);
+ VERIFY_PARENT_MAY_EXIST(editor, relpath);
SVN_ERR(check_cancel(editor));
@@ -643,9 +743,10 @@ svn_editor_alter_symlink(svn_editor_t *e
}
MARK_COMPLETED(editor, relpath);
+ MARK_PARENT_STABLE(editor, relpath);
svn_pool_clear(editor->scratch_pool);
- return err;
+ return svn_error_trace(err);
}
@@ -659,6 +760,8 @@ svn_editor_delete(svn_editor_t *editor,
SVN_ERR_ASSERT(svn_relpath_is_canonical(relpath));
SHOULD_NOT_BE_FINISHED(editor);
SHOULD_NOT_BE_COMPLETED(editor, relpath);
+ VERIFY_PARENT_MAY_EXIST(editor, relpath);
+ CHILD_DELETIONS_ALLOWED(editor, relpath);
SVN_ERR(check_cancel(editor));
@@ -671,9 +774,10 @@ svn_editor_delete(svn_editor_t *editor,
}
MARK_COMPLETED(editor, relpath);
+ MARK_PARENT_STABLE(editor, relpath);
svn_pool_clear(editor->scratch_pool);
- return err;
+ return svn_error_trace(err);
}
@@ -690,6 +794,8 @@ svn_editor_copy(svn_editor_t *editor,
SVN_ERR_ASSERT(svn_relpath_is_canonical(dst_relpath));
SHOULD_NOT_BE_FINISHED(editor);
SHOULD_ALLOW_ADD(editor, dst_relpath);
+ VERIFY_PARENT_MAY_EXIST(editor, src_relpath);
+ VERIFY_PARENT_MAY_EXIST(editor, dst_relpath);
SVN_ERR(check_cancel(editor));
@@ -703,10 +809,11 @@ svn_editor_copy(svn_editor_t *editor,
}
MARK_ALLOW_ALTER(editor, dst_relpath);
+ MARK_PARENT_STABLE(editor, dst_relpath);
CLEAR_INCOMPLETE(editor, dst_relpath);
svn_pool_clear(editor->scratch_pool);
- return err;
+ return svn_error_trace(err);
}
@@ -724,6 +831,9 @@ svn_editor_move(svn_editor_t *editor,
SHOULD_NOT_BE_FINISHED(editor);
SHOULD_NOT_BE_COMPLETED(editor, src_relpath);
SHOULD_ALLOW_ADD(editor, dst_relpath);
+ VERIFY_PARENT_MAY_EXIST(editor, src_relpath);
+ CHILD_DELETIONS_ALLOWED(editor, src_relpath);
+ VERIFY_PARENT_MAY_EXIST(editor, dst_relpath);
SVN_ERR(check_cancel(editor));
@@ -737,11 +847,13 @@ svn_editor_move(svn_editor_t *editor,
}
MARK_ALLOW_ADD(editor, src_relpath);
+ MARK_PARENT_STABLE(editor, src_relpath);
MARK_ALLOW_ALTER(editor, dst_relpath);
+ MARK_PARENT_STABLE(editor, dst_relpath);
CLEAR_INCOMPLETE(editor, dst_relpath);
svn_pool_clear(editor->scratch_pool);
- return err;
+ return svn_error_trace(err);
}
@@ -762,6 +874,8 @@ svn_editor_rotate(svn_editor_t *editor,
SVN_ERR_ASSERT(svn_relpath_is_canonical(relpath));
SHOULD_NOT_BE_COMPLETED(editor, relpath);
+ VERIFY_PARENT_MAY_EXIST(editor, relpath);
+ CHILD_DELETIONS_ALLOWED(editor, relpath);
}
}
#endif
@@ -783,12 +897,13 @@ svn_editor_rotate(svn_editor_t *editor,
{
const char *relpath = APR_ARRAY_IDX(relpaths, i, const char *);
MARK_ALLOW_ALTER(editor, relpath);
+ MARK_PARENT_STABLE(editor, relpath);
}
}
#endif
svn_pool_clear(editor->scratch_pool);
- return err;
+ return svn_error_trace(err);
}
@@ -812,7 +927,7 @@ svn_editor_complete(svn_editor_t *editor
MARK_FINISHED(editor);
svn_pool_clear(editor->scratch_pool);
- return err;
+ return svn_error_trace(err);
}
@@ -833,5 +948,5 @@ svn_editor_abort(svn_editor_t *editor)
MARK_FINISHED(editor);
svn_pool_clear(editor->scratch_pool);
- return err;
+ return svn_error_trace(err);
}
Modified: subversion/branches/compressed-pristines/subversion/libsvn_delta/path_driver.c
URL: http://svn.apache.org/viewvc/subversion/branches/compressed-pristines/subversion/libsvn_delta/path_driver.c?rev=1373783&r1=1373782&r2=1373783&view=diff
==============================================================================
--- subversion/branches/compressed-pristines/subversion/libsvn_delta/path_driver.c (original)
+++ subversion/branches/compressed-pristines/subversion/libsvn_delta/path_driver.c Thu Aug 16 10:17:48 2012
@@ -44,15 +44,13 @@ typedef struct dir_stack_t
} dir_stack_t;
-/* Call EDITOR's open_directory() function with the PATH and REVISION
- * arguments, and then add the resulting dir baton to the dir baton
- * stack.
+/* Call EDITOR's open_directory() function with the PATH argument, then
+ * add the resulting dir baton to the dir baton stack.
*/
static svn_error_t *
open_dir(apr_array_header_t *db_stack,
const svn_delta_editor_t *editor,
const char *path,
- svn_revnum_t revision,
apr_pool_t *pool)
{
void *parent_db, *db;
@@ -69,7 +67,8 @@ open_dir(apr_array_header_t *db_stack,
/* Call the EDITOR's open_directory function to get a new directory
baton. */
subpool = svn_pool_create(pool);
- SVN_ERR(editor->open_directory(path, parent_db, revision, subpool, &db));
+ SVN_ERR(editor->open_directory(path, parent_db, SVN_INVALID_REVNUM, subpool,
+ &db));
/* Now add the dir baton to the stack. */
item = apr_pcalloc(subpool, sizeof(*item));
@@ -131,13 +130,12 @@ count_components(const char *path)
/*** Public interfaces ***/
svn_error_t *
-svn_delta_path_driver(const svn_delta_editor_t *editor,
- void *edit_baton,
- svn_revnum_t revision,
- const apr_array_header_t *paths,
- svn_delta_path_driver_cb_func_t callback_func,
- void *callback_baton,
- apr_pool_t *pool)
+svn_delta_path_driver2(const svn_delta_editor_t *editor,
+ void *edit_baton,
+ const apr_array_header_t *paths,
+ svn_delta_path_driver_cb_func_t callback_func,
+ void *callback_baton,
+ apr_pool_t *pool)
{
apr_array_header_t *db_stack = apr_array_make(pool, 4, sizeof(void *));
const char *last_path = NULL;
@@ -155,9 +153,6 @@ svn_delta_path_driver(const svn_delta_ed
iterpool = svn_pool_create(pool);
item = apr_pcalloc(subpool, sizeof(*item));
- /* Sort the paths in a depth-first directory-ish order. */
- qsort(paths->elts, paths->nelts, paths->elt_size, svn_sort_compare_paths);
-
/* If the root of the edit is also a target path, we want to call
the callback function to let the user open the root directory and
do what needs to be done. Otherwise, we'll do the open_root()
@@ -171,7 +166,7 @@ svn_delta_path_driver(const svn_delta_ed
}
else
{
- SVN_ERR(editor->open_root(edit_baton, revision, subpool, &db));
+ SVN_ERR(editor->open_root(edit_baton, SVN_INVALID_REVNUM, subpool, &db));
}
item->pool = subpool;
item->dir_baton = db;
@@ -238,7 +233,7 @@ svn_delta_path_driver(const svn_delta_ed
rel = apr_pstrmemdup(iterpool, pdir, piece - pdir);
/* Open the subdirectory. */
- SVN_ERR(open_dir(db_stack, editor, rel, revision, pool));
+ SVN_ERR(open_dir(db_stack, editor, rel, pool));
/* If we found a '/', advance our PIECE pointer to
character just after that '/'. Otherwise, we're
Modified: subversion/branches/compressed-pristines/subversion/libsvn_delta/svndiff.c
URL: http://svn.apache.org/viewvc/subversion/branches/compressed-pristines/subversion/libsvn_delta/svndiff.c?rev=1373783&r1=1373782&r2=1373783&view=diff
==============================================================================
--- subversion/branches/compressed-pristines/subversion/libsvn_delta/svndiff.c (original)
+++ subversion/branches/compressed-pristines/subversion/libsvn_delta/svndiff.c Thu Aug 16 10:17:48 2012
@@ -32,6 +32,7 @@
#include <zlib.h>
#include "private/svn_error_private.h"
+#include "private/svn_delta_private.h"
/* The zlib compressBound function was not exported until 1.2.0. */
#if ZLIB_VERNUM >= 0x1200
@@ -129,11 +130,12 @@ append_encoded_int(svn_stringbuf_t *head
svn_stringbuf_appendbytes(header, (const char *)buf, p - buf);
}
-/* If IN is a string that is >= MIN_COMPRESS_SIZE, zlib compress it and
- place the result in OUT, with an integer prepended specifying the
- original size. If IN is < MIN_COMPRESS_SIZE, or if the compressed
- version of IN was no smaller than the original IN, OUT will be a copy
- of IN with the size prepended as an integer. */
+/* If IN is a string that is >= MIN_COMPRESS_SIZE and the COMPRESSION_LEVEL
+ is not SVN_DELTA_COMPRESSION_LEVEL_NONE, zlib compress it and places the
+ result in OUT, with an integer prepended specifying the original size.
+ If IN is < MIN_COMPRESS_SIZE, or if the compressed version of IN was no
+ smaller than the original IN, OUT will be a copy of IN with the size
+ prepended as an integer. */
static svn_error_t *
zlib_encode(const char *data,
apr_size_t len,
@@ -143,6 +145,7 @@ zlib_encode(const char *data,
unsigned long endlen;
apr_size_t intlen;
+ svn_stringbuf_setempty(out);
append_encoded_int(out, len);
intlen = out->len;
@@ -238,7 +241,7 @@ window_handler(svn_txdelta_window_t *win
case svn_txdelta_new: *ip = (0x2 << 6); break;
}
if (op->length >> 6 == 0)
- *ip++ |= op->length;
+ *ip++ |= (unsigned char)op->length;
else
ip = encode_int(ip + 1, op->length);
if (op->action_code != svn_txdelta_new)
@@ -441,12 +444,13 @@ decode_size(apr_size_t *val,
the original size, and that if encoded size == original size, that the
remaining data is not compressed.
In that case, we will simply return pointer into IN as data pointer for
- OUT. The caller is expected not to modify the contents of OUT.
+ OUT, COPYLESS_ALLOWED has been set. The, the caller is expected not to
+ modify the contents of OUT.
An error is returned if the decoded length exceeds the given LIMIT.
*/
static svn_error_t *
zlib_decode(const unsigned char *in, apr_size_t inLen, svn_stringbuf_t *out,
- apr_size_t limit)
+ apr_size_t limit, svn_boolean_t copyless_allowed)
{
apr_size_t len;
const unsigned char *oldplace = in;
@@ -465,12 +469,22 @@ zlib_decode(const unsigned char *in, apr
inLen -= (in - oldplace);
if (inLen == len)
{
- /* "in" is no longer used but the memory remains allocated for
- * at least as long as "out" will be used by the caller.
- */
- out->data = (char *)in;
- out->len = len;
- out->blocksize = len; /* sic! */
+ if (copyless_allowed)
+ {
+ /* "in" is no longer used but the memory remains allocated for
+ * at least as long as "out" will be used by the caller.
+ */
+ out->data = (char *)in;
+ out->len = len;
+ out->blocksize = len; /* sic! */
+ }
+ else
+ {
+ svn_stringbuf_ensure(out, len);
+ memcpy(out->data, in, len);
+ out->data[len] = 0;
+ out->len = len;
+ }
return SVN_NO_ERROR;
}
@@ -647,9 +661,9 @@ decode_window(svn_txdelta_window_t *wind
/* these may in fact simply return references to insend */
SVN_ERR(zlib_decode(insend, newlen, ndout,
- SVN_DELTA_WINDOW_SIZE));
+ SVN_DELTA_WINDOW_SIZE, TRUE));
SVN_ERR(zlib_decode(data, insend - data, instout,
- MAX_INSTRUCTION_SECTION_LEN));
+ MAX_INSTRUCTION_SECTION_LEN, TRUE));
newlen = ndout->len;
data = (unsigned char *)instout->data;
@@ -987,3 +1001,22 @@ svn_txdelta_skip_svndiff_window(apr_file
offset = inslen + newlen;
return svn_io_file_seek(file, APR_CUR, &offset, pool);
}
+
+
+svn_error_t *
+svn__compress(svn_string_t *in,
+ svn_stringbuf_t *out,
+ int compression_level)
+{
+ return zlib_encode(in->data, in->len, out,
+ compression_level);
+}
+
+svn_error_t *
+svn__decompress(svn_string_t *in,
+ svn_stringbuf_t *out,
+ apr_size_t limit)
+{
+ return zlib_decode((const unsigned char*)in->data, in->len, out, limit,
+ FALSE);
+}
Modified: subversion/branches/compressed-pristines/subversion/libsvn_delta/text_delta.c
URL: http://svn.apache.org/viewvc/subversion/branches/compressed-pristines/subversion/libsvn_delta/text_delta.c?rev=1373783&r1=1373782&r2=1373783&view=diff
==============================================================================
--- subversion/branches/compressed-pristines/subversion/libsvn_delta/text_delta.c (original)
+++ subversion/branches/compressed-pristines/subversion/libsvn_delta/text_delta.c Thu Aug 16 10:17:48 2012
@@ -57,7 +57,8 @@ struct txdelta_baton {
svn_filesize_t pos; /* Offset of next read in source file. */
char *buf; /* Buffer for input data. */
- svn_checksum_ctx_t *context; /* Context for computing the checksum. */
+ svn_checksum_ctx_t *context; /* If not NULL, the context for computing
+ the checksum. */
svn_checksum_t *checksum; /* If non-NULL, the checksum of TARGET. */
apr_pool_t *result_pool; /* For results (e.g. checksum) */
@@ -405,6 +406,10 @@ txdelta_md5_digest(void *baton)
if (b->more)
return NULL;
+ /* If checksumming has not been activated, there will be no digest. */
+ if (b->context == NULL)
+ return NULL;
+
/* The checksum should be there. */
return b->checksum->digest;
}
@@ -463,10 +468,11 @@ svn_txdelta_run(svn_stream_t *source,
void
-svn_txdelta(svn_txdelta_stream_t **stream,
- svn_stream_t *source,
- svn_stream_t *target,
- apr_pool_t *pool)
+svn_txdelta2(svn_txdelta_stream_t **stream,
+ svn_stream_t *source,
+ svn_stream_t *target,
+ svn_boolean_t calculate_checksum,
+ apr_pool_t *pool)
{
struct txdelta_baton *b = apr_pcalloc(pool, sizeof(*b));
@@ -475,13 +481,24 @@ svn_txdelta(svn_txdelta_stream_t **strea
b->more_source = TRUE;
b->more = TRUE;
b->buf = apr_palloc(pool, 2 * SVN_DELTA_WINDOW_SIZE);
- b->context = svn_checksum_ctx_create(svn_checksum_md5, pool);
+ b->context = calculate_checksum
+ ? svn_checksum_ctx_create(svn_checksum_md5, pool)
+ : NULL;
b->result_pool = pool;
*stream = svn_txdelta_stream_create(b, txdelta_next_window,
txdelta_md5_digest, pool);
}
+void
+svn_txdelta(svn_txdelta_stream_t **stream,
+ svn_stream_t *source,
+ svn_stream_t *target,
+ apr_pool_t *pool)
+{
+ svn_txdelta2(stream, source, target, TRUE, pool);
+}
+
/* Functions for implementing a "target push" delta. */
@@ -904,29 +921,54 @@ svn_error_t *svn_txdelta_send_stream(svn
unsigned char *digest,
apr_pool_t *pool)
{
- svn_txdelta_stream_t *txstream;
- svn_error_t *err;
-
- /* ### this is a hack. we should simply read from the stream, construct
- ### some windows, and pass those to the handler. there isn't any reason
- ### to crank up a full "diff" algorithm just to copy a stream.
- ###
- ### will fix RSN. */
-
- /* Create a delta stream which converts an *empty* bytestream into the
- target bytestream. */
- svn_txdelta(&txstream, svn_stream_empty(pool), stream, pool);
- err = svn_txdelta_send_txstream(txstream, handler, handler_baton, pool);
-
- if (digest && (! err))
- {
- const unsigned char *result_md5;
- result_md5 = svn_txdelta_md5_digest(txstream);
- /* Since err is null, result_md5 "cannot" be null. */
- memcpy(digest, result_md5, APR_MD5_DIGESTSIZE);
+ svn_txdelta_window_t delta_window = { 0 };
+ svn_txdelta_op_t delta_op;
+ svn_string_t window_data;
+ char read_buf[SVN__STREAM_CHUNK_SIZE + 1];
+ svn_checksum_ctx_t *md5_checksum_ctx;
+
+ if (digest)
+ md5_checksum_ctx = svn_checksum_ctx_create(svn_checksum_md5, pool);
+
+ while (1)
+ {
+ apr_size_t read_len = SVN__STREAM_CHUNK_SIZE;
+
+ SVN_ERR(svn_stream_read(stream, read_buf, &read_len));
+ if (read_len == 0)
+ break;
+
+ window_data.data = read_buf;
+ window_data.len = read_len;
+
+ delta_op.action_code = svn_txdelta_new;
+ delta_op.offset = 0;
+ delta_op.length = read_len;
+
+ delta_window.tview_len = read_len;
+ delta_window.num_ops = 1;
+ delta_window.ops = &delta_op;
+ delta_window.new_data = &window_data;
+
+ SVN_ERR(handler(&delta_window, handler_baton));
+
+ if (digest)
+ SVN_ERR(svn_checksum_update(md5_checksum_ctx, read_buf, read_len));
+
+ if (read_len < SVN__STREAM_CHUNK_SIZE)
+ break;
}
+ SVN_ERR(handler(NULL, handler_baton));
+
+ if (digest)
+ {
+ svn_checksum_t *md5_checksum;
- return err;
+ SVN_ERR(svn_checksum_final(&md5_checksum, md5_checksum_ctx, pool));
+ memcpy(digest, md5_checksum->digest, APR_MD5_DIGESTSIZE);
+ }
+
+ return SVN_NO_ERROR;
}
svn_error_t *svn_txdelta_send_txstream(svn_txdelta_stream_t *txstream,
Modified: subversion/branches/compressed-pristines/subversion/libsvn_delta/xdelta.c
URL: http://svn.apache.org/viewvc/subversion/branches/compressed-pristines/subversion/libsvn_delta/xdelta.c?rev=1373783&r1=1373782&r2=1373783&view=diff
==============================================================================
--- subversion/branches/compressed-pristines/subversion/libsvn_delta/xdelta.c (original)
+++ subversion/branches/compressed-pristines/subversion/libsvn_delta/xdelta.c Thu Aug 16 10:17:48 2012
@@ -109,8 +109,13 @@ struct block
/* A hash table, using open addressing, of the blocks of the source. */
struct blocks
{
- /* The largest valid index of slots. */
- apr_size_t max;
+ /* The largest valid index of slots.
+ This value has an upper bound proportionate to the text delta
+ window size, so unless we dramatically increase the window size,
+ it's safe to make this a 32-bit value. In any case, it has to be
+ hte same width as the block position index, (struct
+ block).pos. */
+ apr_uint32_t max;
/* Source buffer that the positions in SLOTS refer to. */
const char* data;
/* The vector of blocks. A pos value of NO_POSITION represents an unused
@@ -133,7 +138,7 @@ static apr_uint32_t hash_func(apr_uint32
data into the table BLOCKS. Ignore true duplicates, i.e. blocks with
actually the same content. */
static void
-add_block(struct blocks *blocks, apr_uint32_t adlersum, apr_size_t pos)
+add_block(struct blocks *blocks, apr_uint32_t adlersum, apr_uint32_t pos)
{
apr_uint32_t h = hash_func(adlersum) & blocks->max;
@@ -176,17 +181,30 @@ init_blocks_table(const char *data,
struct blocks *blocks,
apr_pool_t *pool)
{
- apr_size_t i;
apr_size_t nblocks;
- apr_size_t nslots = 1;
+ apr_size_t wnslots = 1;
+ apr_uint32_t nslots;
+ apr_uint32_t i;
/* Be pessimistic about the block count. */
nblocks = datalen / MATCH_BLOCKSIZE + 1;
/* Find nearest larger power of two. */
- while (nslots <= nblocks)
- nslots *= 2;
+ while (wnslots <= nblocks)
+ wnslots *= 2;
/* Double the number of slots to avoid a too high load. */
- nslots *= 2;
+ wnslots *= 2;
+ /* Narrow the number of slots to 32 bits, which is the size of the
+ block position index in the hash table.
+ Sanity check: On 64-bit platforms, apr_size_t is likely to be
+ larger than apr_uint32_t. Make sure that the number of slots
+ actually fits into blocks->max. It's safe to use a hard assert
+ here, because the largest possible value for nslots is
+ proportional to the text delta window size and is therefore much
+ smaller than the range of an apr_uint32_t. If we ever happen to
+ increase the window size too much, this assertion will get
+ triggered by the test suite. */
+ nslots = (apr_uint32_t) wnslots;
+ SVN_ERR_ASSERT_NO_RETURN(wnslots == nslots);
blocks->max = nslots - 1;
blocks->data = data;
blocks->slots = apr_palloc(pool, nslots * sizeof(*(blocks->slots)));
Modified: subversion/branches/compressed-pristines/subversion/libsvn_diff/diff_file.c
URL: http://svn.apache.org/viewvc/subversion/branches/compressed-pristines/subversion/libsvn_diff/diff_file.c?rev=1373783&r1=1373782&r2=1373783&view=diff
==============================================================================
--- subversion/branches/compressed-pristines/subversion/libsvn_diff/diff_file.c (original)
+++ subversion/branches/compressed-pristines/subversion/libsvn_diff/diff_file.c Thu Aug 16 10:17:48 2012
@@ -432,15 +432,15 @@ find_identical_prefix(svn_boolean_t *rea
is_match = TRUE;
for (delta = 0; delta < max_delta && is_match; delta += sizeof(apr_uintptr_t))
{
- apr_uintptr_t chunk = *(const apr_size_t *)(file[0].curp + delta);
+ apr_uintptr_t chunk = *(const apr_uintptr_t *)(file[0].curp + delta);
if (contains_eol(chunk))
break;
for (i = 1; i < file_len; i++)
- if (chunk != *(const apr_size_t *)(file[i].curp + delta))
+ if (chunk != *(const apr_uintptr_t *)(file[i].curp + delta))
{
is_match = FALSE;
- delta -= sizeof(apr_size_t);
+ delta -= sizeof(apr_uintptr_t);
break;
}
}
@@ -1167,10 +1167,13 @@ svn_diff_file_options_parse(svn_diff_fil
apr_pool_t *pool)
{
apr_getopt_t *os;
- struct opt_parsing_error_baton_t opt_parsing_error_baton = { NULL, pool };
+ struct opt_parsing_error_baton_t opt_parsing_error_baton;
/* Make room for each option (starting at index 1) plus trailing NULL. */
const char **argv = apr_palloc(pool, sizeof(char*) * (args->nelts + 2));
+ opt_parsing_error_baton.err = NULL;
+ opt_parsing_error_baton.pool = pool;
+
argv[0] = "";
memcpy((void *) (argv + 1), args->elts, sizeof(char*) * args->nelts);
argv[args->nelts + 1] = NULL;
@@ -2043,8 +2046,7 @@ output_line(svn_diff3__file_output_baton
static svn_error_t *
output_marker_eol(svn_diff3__file_output_baton_t *btn)
{
- apr_size_t len = strlen(btn->marker_eol);
- return svn_stream_write(btn->output_stream, btn->marker_eol, &len);
+ return svn_stream_puts(btn->output_stream, btn->marker_eol);
}
static svn_error_t *
@@ -2127,7 +2129,7 @@ output_conflict_with_context(svn_diff3__
if (btn->output_stream == btn->context_saver->stream)
{
if (btn->context_saver->total_written > SVN_DIFF__UNIFIED_CONTEXT_SIZE)
- SVN_ERR(svn_stream_printf(btn->real_output_stream, btn->pool, "@@\n"));
+ SVN_ERR(svn_stream_puts(btn->real_output_stream, "@@\n"));
SVN_ERR(flush_context_saver(btn->context_saver, btn->real_output_stream));
}
@@ -2179,7 +2181,6 @@ output_conflict(void *baton,
svn_diff_t *diff)
{
svn_diff3__file_output_baton_t *file_baton = baton;
- apr_size_t len;
svn_diff_conflict_display_style_t style = file_baton->conflict_style;
@@ -2201,33 +2202,28 @@ output_conflict(void *baton,
if (style == svn_diff_conflict_display_modified_latest ||
style == svn_diff_conflict_display_modified_original_latest)
{
- len = strlen(file_baton->conflict_modified);
- SVN_ERR(svn_stream_write(file_baton->output_stream,
- file_baton->conflict_modified,
- &len));
+ SVN_ERR(svn_stream_puts(file_baton->output_stream,
+ file_baton->conflict_modified));
SVN_ERR(output_marker_eol(file_baton));
SVN_ERR(output_hunk(baton, 1, modified_start, modified_length));
if (style == svn_diff_conflict_display_modified_original_latest)
{
- len = strlen(file_baton->conflict_original);
- SVN_ERR(svn_stream_write(file_baton->output_stream,
- file_baton->conflict_original, &len));
+ SVN_ERR(svn_stream_puts(file_baton->output_stream,
+ file_baton->conflict_original));
SVN_ERR(output_marker_eol(file_baton));
SVN_ERR(output_hunk(baton, 0, original_start, original_length));
}
- len = strlen(file_baton->conflict_separator);
- SVN_ERR(svn_stream_write(file_baton->output_stream,
- file_baton->conflict_separator, &len));
+ SVN_ERR(svn_stream_puts(file_baton->output_stream,
+ file_baton->conflict_separator));
SVN_ERR(output_marker_eol(file_baton));
SVN_ERR(output_hunk(baton, 2, latest_start, latest_length));
- len = strlen(file_baton->conflict_latest);
- SVN_ERR(svn_stream_write(file_baton->output_stream,
- file_baton->conflict_latest, &len));
+ SVN_ERR(svn_stream_puts(file_baton->output_stream,
+ file_baton->conflict_latest));
SVN_ERR(output_marker_eol(file_baton));
}
else if (style == svn_diff_conflict_display_modified)
Modified: subversion/branches/compressed-pristines/subversion/libsvn_diff/diff_memory.c
URL: http://svn.apache.org/viewvc/subversion/branches/compressed-pristines/subversion/libsvn_diff/diff_memory.c?rev=1373783&r1=1373782&r2=1373783&view=diff
==============================================================================
--- subversion/branches/compressed-pristines/subversion/libsvn_diff/diff_memory.c (original)
+++ subversion/branches/compressed-pristines/subversion/libsvn_diff/diff_memory.c Thu Aug 16 10:17:48 2012
@@ -123,7 +123,7 @@ datasource_get_next_token(apr_uint32_t *
diff_mem_baton_t *mem_baton = baton;
source_tokens_t *src = &(mem_baton->sources[datasource_to_index(datasource)]);
- if (src->tokens->nelts > src->next_token)
+ if ((apr_size_t)src->tokens->nelts > src->next_token)
{
/* There are actually tokens to be returned */
char *buf = mem_baton->normalization_buf[0];
@@ -808,15 +808,13 @@ output_merge_token_range(apr_size_t *lin
static svn_error_t *
output_marker_eol(merge_output_baton_t *btn)
{
- apr_size_t len = strlen(btn->marker_eol);
- return svn_stream_write(btn->output_stream, btn->marker_eol, &len);
+ return svn_stream_puts(btn->output_stream, btn->marker_eol);
}
static svn_error_t *
output_merge_marker(merge_output_baton_t *btn, int idx)
{
- apr_size_t len = strlen(btn->markers[idx]);
- SVN_ERR(svn_stream_write(btn->output_stream, btn->markers[idx], &len));
+ SVN_ERR(svn_stream_puts(btn->output_stream, btn->markers[idx]));
return output_marker_eol(btn);
}
@@ -924,7 +922,7 @@ output_conflict_with_context(void *baton
if (btn->output_stream == btn->context_saver->stream)
{
if (btn->context_saver->total_written > SVN_DIFF__UNIFIED_CONTEXT_SIZE)
- SVN_ERR(svn_stream_printf(btn->real_output_stream, btn->pool, "@@\n"));
+ SVN_ERR(svn_stream_puts(btn->real_output_stream, "@@\n"));
SVN_ERR(flush_context_saver(btn->context_saver, btn->real_output_stream));
}
Modified: subversion/branches/compressed-pristines/subversion/libsvn_diff/parse-diff.c
URL: http://svn.apache.org/viewvc/subversion/branches/compressed-pristines/subversion/libsvn_diff/parse-diff.c?rev=1373783&r1=1373782&r2=1373783&view=diff
==============================================================================
--- subversion/branches/compressed-pristines/subversion/libsvn_diff/parse-diff.c (original)
+++ subversion/branches/compressed-pristines/subversion/libsvn_diff/parse-diff.c Thu Aug 16 10:17:48 2012
@@ -270,101 +270,6 @@ parse_hunk_header(const char *header, sv
return TRUE;
}
-/* A helper for reading a line of text from a range in the patch file.
- *
- * Allocate *STRINGBUF in RESULT_POOL, and read into it one line from FILE.
- * Reading stops either after a line-terminator was found or after MAX_LEN
- * bytes have been read. The line-terminator is not stored in *STRINGBUF.
- *
- * The line-terminator is detected automatically and stored in *EOL
- * if EOL is not NULL. If EOF is reached and FILE does not end
- * with a newline character, and EOL is not NULL, *EOL is set to NULL.
- *
- * SCRATCH_POOL is used for temporary allocations.
- */
-static svn_error_t *
-readline(apr_file_t *file,
- svn_stringbuf_t **stringbuf,
- const char **eol,
- svn_boolean_t *eof,
- apr_size_t max_len,
- apr_pool_t *result_pool,
- apr_pool_t *scratch_pool)
-{
- svn_stringbuf_t *str;
- const char *eol_str;
- apr_size_t numbytes;
- char c;
- apr_size_t len;
- svn_boolean_t found_eof;
-
- str = svn_stringbuf_create_ensure(80, result_pool);
-
- /* Read bytes into STR up to and including, but not storing,
- * the next EOL sequence. */
- eol_str = NULL;
- numbytes = 1;
- len = 0;
- found_eof = FALSE;
- while (!found_eof)
- {
- if (len < max_len)
- SVN_ERR(svn_io_file_read_full2(file, &c, sizeof(c), &numbytes,
- &found_eof, scratch_pool));
- len++;
- if (numbytes != 1 || len > max_len)
- {
- found_eof = TRUE;
- break;
- }
-
- if (c == '\n')
- {
- eol_str = "\n";
- }
- else if (c == '\r')
- {
- eol_str = "\r";
-
- if (!found_eof && len < max_len)
- {
- apr_off_t pos;
-
- /* Check for "\r\n" by peeking at the next byte. */
- pos = 0;
- SVN_ERR(svn_io_file_seek(file, APR_CUR, &pos, scratch_pool));
- SVN_ERR(svn_io_file_read_full2(file, &c, sizeof(c), &numbytes,
- &found_eof, scratch_pool));
- if (numbytes == 1 && c == '\n')
- {
- eol_str = "\r\n";
- len++;
- }
- else
- {
- /* Pretend we never peeked. */
- SVN_ERR(svn_io_file_seek(file, APR_SET, &pos, scratch_pool));
- found_eof = FALSE;
- numbytes = 1;
- }
- }
- }
- else
- svn_stringbuf_appendbyte(str, c);
-
- if (eol_str)
- break;
- }
-
- if (eol)
- *eol = eol_str;
- if (eof)
- *eof = found_eof;
- *stringbuf = str;
-
- return SVN_NO_ERROR;
-}
-
/* Read a line of original or modified hunk text from the specified
* RANGE within FILE. FILE is expected to contain unidiff text.
* Leading unidiff symbols ('+', '-', and ' ') are removed from the line,
@@ -406,8 +311,8 @@ hunk_readline_original_or_modified(apr_f
do
{
max_len = range->end - range->current;
- SVN_ERR(readline(file, &str, eol, eof, max_len,
- result_pool, scratch_pool));
+ SVN_ERR(svn_io_file_readline(file, &str, eol, eof, max_len,
+ result_pool, scratch_pool));
range->current = 0;
SVN_ERR(svn_io_file_seek(file, APR_CUR, &range->current, scratch_pool));
filtered = (str->data[0] == verboten || str->data[0] == '\\');
@@ -499,7 +404,8 @@ svn_diff_hunk_readline_diff_text(svn_dif
SVN_ERR(svn_io_file_seek(hunk->apr_file, APR_SET,
&hunk->diff_text_range.current, scratch_pool));
max_len = hunk->diff_text_range.end - hunk->diff_text_range.current;
- SVN_ERR(readline(hunk->apr_file, &line, eol, eof, max_len, result_pool,
+ SVN_ERR(svn_io_file_readline(hunk->apr_file, &line, eol, eof, max_len,
+ result_pool,
scratch_pool));
hunk->diff_text_range.current = 0;
SVN_ERR(svn_io_file_seek(hunk->apr_file, APR_CUR,
@@ -642,8 +548,8 @@ parse_next_hunk(svn_diff_hunk_t **hunk,
/* Remember the current line's offset, and read the line. */
last_line = pos;
- SVN_ERR(readline(apr_file, &line, NULL, &eof, APR_SIZE_MAX,
- iterpool, iterpool));
+ SVN_ERR(svn_io_file_readline(apr_file, &line, NULL, &eof, APR_SIZE_MAX,
+ iterpool, iterpool));
/* Update line offset for next iteration. */
pos = 0;
@@ -1364,8 +1270,8 @@ svn_diff_parse_next_patch(svn_patch_t **
/* Remember the current line's offset, and read the line. */
last_line = pos;
- SVN_ERR(readline(patch_file->apr_file, &line, NULL, &eof,
- APR_SIZE_MAX, iterpool, iterpool));
+ SVN_ERR(svn_io_file_readline(patch_file->apr_file, &line, NULL, &eof,
+ APR_SIZE_MAX, iterpool, iterpool));
if (! eof)
{
Modified: subversion/branches/compressed-pristines/subversion/libsvn_fs/fs-loader.c
URL: http://svn.apache.org/viewvc/subversion/branches/compressed-pristines/subversion/libsvn_fs/fs-loader.c?rev=1373783&r1=1373782&r2=1373783&view=diff
==============================================================================
--- subversion/branches/compressed-pristines/subversion/libsvn_fs/fs-loader.c (original)
+++ subversion/branches/compressed-pristines/subversion/libsvn_fs/fs-loader.c Thu Aug 16 10:17:48 2012
@@ -28,6 +28,7 @@
#include <apr_md5.h>
#include <apr_thread_mutex.h>
#include <apr_uuid.h>
+#include <apr_strings.h>
#include "svn_ctype.h"
#include "svn_types.h"
@@ -44,6 +45,7 @@
#include "private/svn_fs_util.h"
#include "private/svn_utf_private.h"
#include "private/svn_mutex.h"
+#include "private/svn_subr_private.h"
#include "fs-loader.h"
#include "svn_hash.h"
@@ -64,27 +66,37 @@ svn_mutex__t *common_pool_lock;
/* --- Utility functions for the loader --- */
-static const struct fs_type_defn {
+struct fs_type_defn {
const char *fs_type;
const char *fsap_name;
fs_init_func_t initfunc;
-} fs_modules[] = {
+ struct fs_type_defn *next;
+};
+
+static struct fs_type_defn base_defn =
{
SVN_FS_TYPE_BDB, "base",
#ifdef SVN_LIBSVN_FS_LINKS_FS_BASE
- svn_fs_base__init
+ svn_fs_base__init,
+#else
+ NULL,
#endif
- },
+ NULL
+ };
+static struct fs_type_defn fsfs_defn =
{
SVN_FS_TYPE_FSFS, "fs",
#ifdef SVN_LIBSVN_FS_LINKS_FS_FS
- svn_fs_fs__init
+ svn_fs_fs__init,
+#else
+ NULL,
#endif
- },
+ &base_defn
+ };
+
+static struct fs_type_defn *fs_modules = &fsfs_defn;
- { NULL }
-};
static svn_error_t *
load_module(fs_init_func_t *initfunc, const char *name, apr_pool_t *pool)
@@ -98,6 +110,15 @@ load_module(fs_init_func_t *initfunc, co
const char *libname;
const char *funcname;
apr_status_t status;
+ const char *p;
+
+ /* Demand a simple alphanumeric name so that the generated DSO
+ name is sensible. */
+ for (p = name; *p; ++p)
+ if (!svn_ctype_isalnum(*p))
+ return svn_error_createf(SVN_ERR_FS_UNKNOWN_FS_TYPE, NULL,
+ _("Invalid name for FS type '%s'"),
+ name);
libname = apr_psprintf(pool, "libsvn_fs_%s-%d.so.0",
name, SVN_VER_MAJOR);
@@ -172,21 +193,77 @@ get_library_vtable_direct(fs_library_vta
return SVN_NO_ERROR;
}
+#if defined(SVN_USE_DSO) && APR_HAS_DSO
+/* Return *FST for the third party FS_TYPE */
+static svn_error_t *
+get_or_allocate_third(struct fs_type_defn **fst,
+ const char *fs_type)
+{
+ while (*fst)
+ {
+ if (strcmp(fs_type, (*fst)->fs_type) == 0)
+ return SVN_NO_ERROR;
+ fst = &(*fst)->next;
+ }
+
+ *fst = apr_palloc(common_pool, sizeof(struct fs_type_defn));
+ (*fst)->fs_type = apr_pstrdup(common_pool, fs_type);
+ (*fst)->fsap_name = (*fst)->fs_type;
+ (*fst)->initfunc = NULL;
+ (*fst)->next = NULL;
+
+ return SVN_NO_ERROR;
+}
+#endif
+
/* Fetch a library vtable by FS type. */
static svn_error_t *
get_library_vtable(fs_library_vtable_t **vtable, const char *fs_type,
apr_pool_t *pool)
{
- const struct fs_type_defn *fst;
+ struct fs_type_defn **fst = &fs_modules;
+ svn_boolean_t known = FALSE;
- for (fst = fs_modules; fst->fs_type; fst++)
+ /* There are two FS module definitions known at compile time. We
+ want to check these without any locking overhead even when
+ dynamic third party modules are enabled. The third party modules
+ cannot be checked until the lock is held. */
+ if (strcmp(fs_type, (*fst)->fs_type) == 0)
+ known = TRUE;
+ else
{
- if (strcmp(fs_type, fst->fs_type) == 0)
- return get_library_vtable_direct(vtable, fst, pool);
+ fst = &(*fst)->next;
+ if (strcmp(fs_type, (*fst)->fs_type) == 0)
+ known = TRUE;
}
- return svn_error_createf(SVN_ERR_FS_UNKNOWN_FS_TYPE, NULL,
- _("Unknown FS type '%s'"), fs_type);
+#if defined(SVN_USE_DSO) && APR_HAS_DSO
+ /* Third party FS modules that are unknown at compile time.
+
+ A third party FS is identified by the file fs-type containing a
+ third party name, say "foo". The loader will load the DSO with
+ the name "libsvn_fs_foo" and use the entry point with the name
+ "svn_fs_foo__init".
+
+ Note: the BDB and FSFS modules don't follow this naming scheme
+ and this allows them to be used to test the third party loader.
+ Change the content of fs-type to "base" in a BDB filesystem or to
+ "fs" in an FSFS filesystem and they will be loaded as third party
+ modules. */
+ if (!known)
+ {
+ fst = &(*fst)->next;
+ if (!common_pool) /* Best-effort init, see get_library_vtable_direct. */
+ SVN_ERR(svn_fs_initialize(NULL));
+ SVN_MUTEX__WITH_LOCK(common_pool_lock,
+ get_or_allocate_third(fst, fs_type));
+ known = TRUE;
+ }
+#endif
+ if (!known)
+ return svn_error_createf(SVN_ERR_FS_UNKNOWN_FS_TYPE, NULL,
+ _("Unknown FS type '%s'"), fs_type);
+ return get_library_vtable_direct(vtable, *fst, pool);
}
svn_error_t *
@@ -199,14 +276,27 @@ svn_fs_type(const char **fs_type, const
apr_size_t len;
/* Read the fsap-name file to get the FSAP name, or assume the (old)
- default. */
+ default. For old repositories I suppose we could check some
+ other file, DB_CONFIG or strings say, but for now just check the
+ directory exists. */
filename = svn_dirent_join(path, FS_TYPE_FILENAME, pool);
err = svn_io_file_open(&file, filename, APR_READ|APR_BUFFERED, 0, pool);
if (err && APR_STATUS_IS_ENOENT(err->apr_err))
{
- svn_error_clear(err);
- *fs_type = apr_pstrdup(pool, SVN_FS_TYPE_BDB);
- return SVN_NO_ERROR;
+ svn_node_kind_t kind;
+ svn_error_t *err2 = svn_io_check_path(path, &kind, pool);
+ if (err2)
+ {
+ svn_error_clear(err2);
+ return err;
+ }
+ if (kind == svn_node_dir)
+ {
+ svn_error_clear(err);
+ *fs_type = SVN_FS_TYPE_BDB;
+ return SVN_NO_ERROR;
+ }
+ return err;
}
else if (err)
return err;
@@ -323,6 +413,7 @@ fs_new(apr_hash_t *fs_config, apr_pool_t
fs->access_ctx = NULL;
fs->vtable = NULL;
fs->fsap_data = NULL;
+ fs->uuid = NULL;
return fs;
}
@@ -579,8 +670,8 @@ svn_error_t *
svn_fs_hotcopy_berkeley(const char *src_path, const char *dest_path,
svn_boolean_t clean_logs, apr_pool_t *pool)
{
- return svn_error_trace(svn_fs_hotcopy(src_path, dest_path, clean_logs,
- pool));
+ return svn_error_trace(svn_fs_hotcopy2(src_path, dest_path, clean_logs,
+ FALSE, NULL, NULL, pool));
}
svn_error_t *
@@ -632,6 +723,7 @@ svn_error_t *
svn_fs_commit_txn(const char **conflict_p, svn_revnum_t *new_rev,
svn_fs_txn_t *txn, apr_pool_t *pool)
{
+ svn_error_t *err;
#ifdef PACK_AFTER_EVERY_COMMIT
svn_fs_root_t *txn_root;
svn_fs_t *fs;
@@ -643,11 +735,25 @@ svn_fs_commit_txn(const char **conflict_
fs_path = svn_fs_path(fs, pool);
#endif
- SVN_ERR(txn->vtable->commit(conflict_p, new_rev, txn, pool));
+ err = txn->vtable->commit(conflict_p, new_rev, txn, pool);
+
+#ifdef SVN_DEBUG
+ /* Check postconditions. */
+ if (conflict_p)
+ {
+ SVN_ERR_ASSERT_E(! (SVN_IS_VALID_REVNUM(*new_rev) && *conflict_p != NULL),
+ err);
+ SVN_ERR_ASSERT_E((*conflict_p != NULL)
+ == (err && err->apr_err == SVN_ERR_FS_CONFLICT),
+ err);
+ }
+#endif
+
+ SVN_ERR(err);
#ifdef PACK_AFTER_EVERY_COMMIT
{
- svn_error_t *err = svn_fs_pack(fs_path, NULL, NULL, NULL, NULL, pool);
+ err = svn_fs_pack(fs_path, NULL, NULL, NULL, NULL, pool);
if (err && err->apr_err == SVN_ERR_UNSUPPORTED_FEATURE)
/* Pre-1.6 filesystem. */
svn_error_clear(err);
@@ -1205,7 +1311,9 @@ svn_fs_get_file_delta_stream(svn_txdelta
svn_error_t *
svn_fs_get_uuid(svn_fs_t *fs, const char **uuid, apr_pool_t *pool)
{
- return svn_error_trace(fs->vtable->get_uuid(fs, uuid, pool));
+ /* If you change this, consider changing svn_fs__identifier(). */
+ *uuid = apr_pstrdup(pool, fs->uuid);
+ return SVN_NO_ERROR;
}
svn_error_t *
@@ -1382,11 +1490,11 @@ svn_error_t *
svn_fs_print_modules(svn_stringbuf_t *output,
apr_pool_t *pool)
{
- const struct fs_type_defn *defn;
+ const struct fs_type_defn *defn = fs_modules;
fs_library_vtable_t *vtable;
apr_pool_t *iterpool = svn_pool_create(pool);
- for (defn = fs_modules; defn->fs_type != NULL; ++defn)
+ while (defn)
{
char *line;
svn_error_t *err;
@@ -1399,6 +1507,7 @@ svn_fs_print_modules(svn_stringbuf_t *ou
if (err->apr_err == SVN_ERR_FS_UNKNOWN_FS_TYPE)
{
svn_error_clear(err);
+ defn = defn->next;
continue;
}
else
@@ -1408,6 +1517,7 @@ svn_fs_print_modules(svn_stringbuf_t *ou
line = apr_psprintf(iterpool, "* fs_%s : %s\n",
defn->fsap_name, vtable->get_description());
svn_stringbuf_appendcstr(output, line);
+ defn = defn->next;
}
svn_pool_destroy(iterpool);
Modified: subversion/branches/compressed-pristines/subversion/libsvn_fs/fs-loader.h
URL: http://svn.apache.org/viewvc/subversion/branches/compressed-pristines/subversion/libsvn_fs/fs-loader.h?rev=1373783&r1=1373782&r2=1373783&view=diff
==============================================================================
--- subversion/branches/compressed-pristines/subversion/libsvn_fs/fs-loader.h (original)
+++ subversion/branches/compressed-pristines/subversion/libsvn_fs/fs-loader.h Thu Aug 16 10:17:48 2012
@@ -172,7 +172,7 @@ typedef struct fs_vtable_t
const svn_string_t *const *old_value_p,
const svn_string_t *value,
apr_pool_t *pool);
- svn_error_t *(*get_uuid)(svn_fs_t *fs, const char **uuid, apr_pool_t *pool);
+ /* There is no get_uuid(); see svn_fs_t.uuid docstring. */
svn_error_t *(*set_uuid)(svn_fs_t *fs, const char *uuid, apr_pool_t *pool);
svn_error_t *(*revision_root)(svn_fs_root_t **root_p, svn_fs_t *fs,
svn_revnum_t rev, apr_pool_t *pool);
@@ -391,6 +391,9 @@ struct svn_fs_t
/* FSAP-specific vtable and private data */
fs_vtable_t *vtable;
void *fsap_data;
+
+ /* UUID, stored by open(), create(), and set_uuid(). */
+ const char *uuid;
};
Modified: subversion/branches/compressed-pristines/subversion/libsvn_fs_base/bdb/bdb-err.c
URL: http://svn.apache.org/viewvc/subversion/branches/compressed-pristines/subversion/libsvn_fs_base/bdb/bdb-err.c?rev=1373783&r1=1373782&r2=1373783&view=diff
==============================================================================
--- subversion/branches/compressed-pristines/subversion/libsvn_fs_base/bdb/bdb-err.c (original)
+++ subversion/branches/compressed-pristines/subversion/libsvn_fs_base/bdb/bdb-err.c Thu Aug 16 10:17:48 2012
@@ -102,5 +102,5 @@ svn_fs_bdb__wrap_db(svn_fs_t *fs, const
return svn_fs_bdb__dberrf
(bfd->bdb, db_err,
_("Berkeley DB error for filesystem '%s' while %s:\n"),
- fs->path ? fs->path : "(none)", operation);
+ fs->path ? fs->path : "(none)", _(operation));
}
Modified: subversion/branches/compressed-pristines/subversion/libsvn_fs_base/bdb/changes-table.c
URL: http://svn.apache.org/viewvc/subversion/branches/compressed-pristines/subversion/libsvn_fs_base/bdb/changes-table.c?rev=1373783&r1=1373782&r2=1373783&view=diff
==============================================================================
--- subversion/branches/compressed-pristines/subversion/libsvn_fs_base/bdb/changes-table.c (original)
+++ subversion/branches/compressed-pristines/subversion/libsvn_fs_base/bdb/changes-table.c Thu Aug 16 10:17:48 2012
@@ -90,7 +90,7 @@ svn_fs_bdb__changes_add(svn_fs_t *fs,
svn_fs_base__str_to_dbt(&query, key);
svn_fs_base__skel_to_dbt(&value, skel, pool);
svn_fs_base__trail_debug(trail, "changes", "put");
- return BDB_WRAP(fs, _("creating change"),
+ return BDB_WRAP(fs, N_("creating change"),
bfd->changes->put(bfd->changes, trail->db_txn,
&query, &value, 0));
}
@@ -114,7 +114,7 @@ svn_fs_bdb__changes_delete(svn_fs_t *fs,
error should be propagated to the caller, though. */
if ((db_err) && (db_err != DB_NOTFOUND))
{
- SVN_ERR(BDB_WRAP(fs, _("deleting changes"), db_err));
+ SVN_ERR(BDB_WRAP(fs, N_("deleting changes"), db_err));
}
return SVN_NO_ERROR;
@@ -268,7 +268,7 @@ svn_fs_bdb__changes_fetch(apr_hash_t **c
/* Get a cursor on the first record matching KEY, and then loop over
the records, adding them to the return array. */
svn_fs_base__trail_debug(trail, "changes", "cursor");
- SVN_ERR(BDB_WRAP(fs, _("creating cursor for reading changes"),
+ SVN_ERR(BDB_WRAP(fs, N_("creating cursor for reading changes"),
bfd->changes->cursor(bfd->changes, trail->db_txn,
&cursor, 0)));
@@ -352,7 +352,7 @@ svn_fs_bdb__changes_fetch(apr_hash_t **c
finished. Just return the (possibly empty) array. Any other
error, however, needs to get handled appropriately. */
if (db_err && (db_err != DB_NOTFOUND))
- err = BDB_WRAP(fs, _("fetching changes"), db_err);
+ err = BDB_WRAP(fs, N_("fetching changes"), db_err);
cleanup:
/* Close the cursor. */
@@ -365,7 +365,7 @@ svn_fs_bdb__changes_fetch(apr_hash_t **c
/* If our only error thus far was when we closed the cursor, return
that error. */
if (db_c_err)
- SVN_ERR(BDB_WRAP(fs, _("closing changes cursor"), db_c_err));
+ SVN_ERR(BDB_WRAP(fs, N_("closing changes cursor"), db_c_err));
/* Finally, set our return variable and get outta here. */
*changes_p = changes;
@@ -391,7 +391,7 @@ svn_fs_bdb__changes_fetch_raw(apr_array_
/* Get a cursor on the first record matching KEY, and then loop over
the records, adding them to the return array. */
svn_fs_base__trail_debug(trail, "changes", "cursor");
- SVN_ERR(BDB_WRAP(fs, _("creating cursor for reading changes"),
+ SVN_ERR(BDB_WRAP(fs, N_("creating cursor for reading changes"),
bfd->changes->cursor(bfd->changes, trail->db_txn,
&cursor, 0)));
@@ -435,7 +435,7 @@ svn_fs_bdb__changes_fetch_raw(apr_array_
finished. Just return the (possibly empty) array. Any other
error, however, needs to get handled appropriately. */
if (db_err && (db_err != DB_NOTFOUND))
- err = BDB_WRAP(fs, _("fetching changes"), db_err);
+ err = BDB_WRAP(fs, N_("fetching changes"), db_err);
cleanup:
/* Close the cursor. */
@@ -448,7 +448,7 @@ svn_fs_bdb__changes_fetch_raw(apr_array_
/* If our only error thus far was when we closed the cursor, return
that error. */
if (db_c_err)
- SVN_ERR(BDB_WRAP(fs, _("closing changes cursor"), db_c_err));
+ SVN_ERR(BDB_WRAP(fs, N_("closing changes cursor"), db_c_err));
/* Finally, set our return variable and get outta here. */
*changes_p = changes;
Modified: subversion/branches/compressed-pristines/subversion/libsvn_fs_base/bdb/checksum-reps-table.c
URL: http://svn.apache.org/viewvc/subversion/branches/compressed-pristines/subversion/libsvn_fs_base/bdb/checksum-reps-table.c?rev=1373783&r1=1373782&r2=1373783&view=diff
==============================================================================
--- subversion/branches/compressed-pristines/subversion/libsvn_fs_base/bdb/checksum-reps-table.c (original)
+++ subversion/branches/compressed-pristines/subversion/libsvn_fs_base/bdb/checksum-reps-table.c Thu Aug 16 10:17:48 2012
@@ -139,7 +139,7 @@ svn_error_t *svn_fs_bdb__set_checksum_re
/* Create a value from our REP_KEY, and add this record to the table. */
svn_fs_base__str_to_dbt(&value, rep_key);
svn_fs_base__trail_debug(trail, "checksum-reps", "put");
- SVN_ERR(BDB_WRAP(fs, _("storing checksum-reps record"),
+ SVN_ERR(BDB_WRAP(fs, N_("storing checksum-reps record"),
bfd->checksum_reps->put(bfd->checksum_reps, trail->db_txn,
&key, &value, 0)));
return SVN_NO_ERROR;
@@ -161,7 +161,7 @@ svn_error_t *svn_fs_bdb__delete_checksum
svn_fs_base__checksum_to_dbt(&key, checksum);
svn_fs_base__trail_debug(trail, "checksum-reps", "del");
- SVN_ERR(BDB_WRAP(fs, "deleting entry from 'checksum-reps' table",
+ SVN_ERR(BDB_WRAP(fs, N_("deleting entry from 'checksum-reps' table"),
bfd->checksum_reps->del(bfd->checksum_reps,
trail->db_txn, &key, 0)));
return SVN_NO_ERROR;
@@ -183,7 +183,7 @@ svn_error_t *svn_fs_bdb__reserve_rep_reu
/* Get the current value associated with the `next-key' key in the
`checksum-reps' table. */
svn_fs_base__trail_debug(trail, "checksum-reps", "get");
- SVN_ERR(BDB_WRAP(fs, _("allocating new representation reuse ID "
+ SVN_ERR(BDB_WRAP(fs, N_("allocating new representation reuse ID "
"(getting 'next-key')"),
bfd->checksum_reps->get(bfd->checksum_reps, trail->db_txn,
&query,
@@ -204,5 +204,5 @@ svn_error_t *svn_fs_bdb__reserve_rep_reu
svn_fs_base__str_to_dbt(&result, next_key),
0);
- return BDB_WRAP(fs, _("bumping next representation reuse ID"), db_err);
+ return BDB_WRAP(fs, N_("bumping next representation reuse ID"), db_err);
}
Modified: subversion/branches/compressed-pristines/subversion/libsvn_fs_base/bdb/copies-table.c
URL: http://svn.apache.org/viewvc/subversion/branches/compressed-pristines/subversion/libsvn_fs_base/bdb/copies-table.c?rev=1373783&r1=1373782&r2=1373783&view=diff
==============================================================================
--- subversion/branches/compressed-pristines/subversion/libsvn_fs_base/bdb/copies-table.c (original)
+++ subversion/branches/compressed-pristines/subversion/libsvn_fs_base/bdb/copies-table.c Thu Aug 16 10:17:48 2012
@@ -89,7 +89,7 @@ put_copy(svn_fs_t *fs,
svn_fs_base__str_to_dbt(&key, copy_id);
svn_fs_base__skel_to_dbt(&value, copy_skel, pool);
svn_fs_base__trail_debug(trail, "copies", "put");
- return BDB_WRAP(fs, _("storing copy record"),
+ return BDB_WRAP(fs, N_("storing copy record"),
bfd->copies->put(bfd->copies, trail->db_txn,
&key, &value, 0));
}
@@ -112,7 +112,7 @@ svn_fs_bdb__reserve_copy_id(const char *
/* Get the current value associated with the `next-key' key in the
copies table. */
svn_fs_base__trail_debug(trail, "copies", "get");
- SVN_ERR(BDB_WRAP(fs, _("allocating new copy ID (getting 'next-key')"),
+ SVN_ERR(BDB_WRAP(fs, N_("allocating new copy ID (getting 'next-key')"),
bfd->copies->get(bfd->copies, trail->db_txn, &query,
svn_fs_base__result_dbt(&result),
0)));
@@ -130,7 +130,7 @@ svn_fs_bdb__reserve_copy_id(const char *
svn_fs_base__str_to_dbt(&result, next_key),
0);
- return BDB_WRAP(fs, _("bumping next copy key"), db_err);
+ return BDB_WRAP(fs, N_("bumping next copy key"), db_err);
}
@@ -168,7 +168,7 @@ svn_fs_bdb__delete_copy(svn_fs_t *fs,
db_err = bfd->copies->del(bfd->copies, trail->db_txn, &key, 0);
if (db_err == DB_NOTFOUND)
return svn_fs_base__err_no_such_copy(fs, copy_id);
- return BDB_WRAP(fs, _("deleting entry from 'copies' table"), db_err);
+ return BDB_WRAP(fs, N_("deleting entry from 'copies' table"), db_err);
}
@@ -196,7 +196,7 @@ svn_fs_bdb__get_copy(copy_t **copy_p,
if (db_err == DB_NOTFOUND)
return svn_fs_base__err_no_such_copy(fs, copy_id);
- SVN_ERR(BDB_WRAP(fs, _("reading copy"), db_err));
+ SVN_ERR(BDB_WRAP(fs, N_("reading copy"), db_err));
/* Unparse COPY skel */
skel = svn_skel__parse(value.data, value.size, pool);
Modified: subversion/branches/compressed-pristines/subversion/libsvn_fs_base/bdb/lock-tokens-table.c
URL: http://svn.apache.org/viewvc/subversion/branches/compressed-pristines/subversion/libsvn_fs_base/bdb/lock-tokens-table.c?rev=1373783&r1=1373782&r2=1373783&view=diff
==============================================================================
--- subversion/branches/compressed-pristines/subversion/libsvn_fs_base/bdb/lock-tokens-table.c (original)
+++ subversion/branches/compressed-pristines/subversion/libsvn_fs_base/bdb/lock-tokens-table.c Thu Aug 16 10:17:48 2012
@@ -84,7 +84,7 @@ svn_fs_bdb__lock_token_add(svn_fs_t *fs,
svn_fs_base__str_to_dbt(&key, path);
svn_fs_base__str_to_dbt(&value, lock_token);
svn_fs_base__trail_debug(trail, "lock-tokens", "add");
- return BDB_WRAP(fs, "storing lock token record",
+ return BDB_WRAP(fs, N_("storing lock token record"),
bfd->lock_tokens->put(bfd->lock_tokens, trail->db_txn,
&key, &value, 0));
}
@@ -104,8 +104,8 @@ svn_fs_bdb__lock_token_delete(svn_fs_t *
svn_fs_base__trail_debug(trail, "lock-tokens", "del");
db_err = bfd->lock_tokens->del(bfd->lock_tokens, trail->db_txn, &key, 0);
if (db_err == DB_NOTFOUND)
- return SVN_FS__ERR_NO_SUCH_LOCK(fs, path, pool);
- return BDB_WRAP(fs, "deleting entry from 'lock-tokens' table", db_err);
+ return SVN_FS__ERR_NO_SUCH_LOCK(fs, path);
+ return BDB_WRAP(fs, N_("deleting entry from 'lock-tokens' table"), db_err);
}
@@ -131,8 +131,8 @@ svn_fs_bdb__lock_token_get(const char **
svn_fs_base__track_dbt(&value, pool);
if (db_err == DB_NOTFOUND)
- return SVN_FS__ERR_NO_SUCH_LOCK(fs, path, pool);
- SVN_ERR(BDB_WRAP(fs, "reading lock token", db_err));
+ return SVN_FS__ERR_NO_SUCH_LOCK(fs, path);
+ SVN_ERR(BDB_WRAP(fs, N_("reading lock token"), db_err));
lock_token = apr_pstrmemdup(pool, value.data, value.size);
Modified: subversion/branches/compressed-pristines/subversion/libsvn_fs_base/bdb/locks-table.c
URL: http://svn.apache.org/viewvc/subversion/branches/compressed-pristines/subversion/libsvn_fs_base/bdb/locks-table.c?rev=1373783&r1=1373782&r2=1373783&view=diff
==============================================================================
--- subversion/branches/compressed-pristines/subversion/libsvn_fs_base/bdb/locks-table.c (original)
+++ subversion/branches/compressed-pristines/subversion/libsvn_fs_base/bdb/locks-table.c Thu Aug 16 10:17:48 2012
@@ -89,7 +89,7 @@ svn_fs_bdb__lock_add(svn_fs_t *fs,
svn_fs_base__str_to_dbt(&key, lock_token);
svn_fs_base__skel_to_dbt(&value, lock_skel, pool);
svn_fs_base__trail_debug(trail, "lock", "add");
- return BDB_WRAP(fs, "storing lock record",
+ return BDB_WRAP(fs, N_("storing lock record"),
bfd->locks->put(bfd->locks, trail->db_txn,
&key, &value, 0));
}
@@ -112,7 +112,7 @@ svn_fs_bdb__lock_delete(svn_fs_t *fs,
if (db_err == DB_NOTFOUND)
return svn_fs_base__err_bad_lock_token(fs, lock_token);
- return BDB_WRAP(fs, "deleting lock from 'locks' table", db_err);
+ return BDB_WRAP(fs, N_("deleting lock from 'locks' table"), db_err);
}
@@ -139,7 +139,7 @@ svn_fs_bdb__lock_get(svn_lock_t **lock_p
if (db_err == DB_NOTFOUND)
return svn_fs_base__err_bad_lock_token(fs, lock_token);
- SVN_ERR(BDB_WRAP(fs, "reading lock", db_err));
+ SVN_ERR(BDB_WRAP(fs, N_("reading lock"), db_err));
/* Parse TRANSACTION skel */
skel = svn_skel__parse(value.data, value.size, pool);
@@ -153,7 +153,7 @@ svn_fs_bdb__lock_get(svn_lock_t **lock_p
if (lock->expiration_date && (apr_time_now() > lock->expiration_date))
{
SVN_ERR(svn_fs_bdb__lock_delete(fs, lock_token, trail, pool));
- return SVN_FS__ERR_LOCK_EXPIRED(fs, lock_token, pool);
+ return SVN_FS__ERR_LOCK_EXPIRED(fs, lock_token);
}
*lock_p = lock;
@@ -242,7 +242,8 @@ svn_fs_bdb__locks_get(svn_fs_t *fs,
svn_fs_base__trail_debug(trail, "lock-tokens", "cursor");
db_err = bfd->lock_tokens->cursor(bfd->lock_tokens, trail->db_txn,
&cursor, 0);
- SVN_ERR(BDB_WRAP(fs, "creating cursor for reading lock tokens", db_err));
+ SVN_ERR(BDB_WRAP(fs, N_("creating cursor for reading lock tokens"),
+ db_err));
/* Since the key is going to be returned as well as the value make
sure BDB malloc's the returned key. */
@@ -316,9 +317,10 @@ svn_fs_bdb__locks_get(svn_fs_t *fs,
db_c_err = svn_bdb_dbc_close(cursor);
if (db_err && (db_err != DB_NOTFOUND))
- SVN_ERR(BDB_WRAP(fs, "fetching lock tokens", db_err));
+ SVN_ERR(BDB_WRAP(fs, N_("fetching lock tokens"), db_err));
if (db_c_err)
- SVN_ERR(BDB_WRAP(fs, "fetching lock tokens (closing cursor)", db_c_err));
+ SVN_ERR(BDB_WRAP(fs, N_("fetching lock tokens (closing cursor)"),
+ db_c_err));
return SVN_NO_ERROR;
}
Modified: subversion/branches/compressed-pristines/subversion/libsvn_fs_base/bdb/miscellaneous-table.c
URL: http://svn.apache.org/viewvc/subversion/branches/compressed-pristines/subversion/libsvn_fs_base/bdb/miscellaneous-table.c?rev=1373783&r1=1373782&r2=1373783&view=diff
==============================================================================
--- subversion/branches/compressed-pristines/subversion/libsvn_fs_base/bdb/miscellaneous-table.c (original)
+++ subversion/branches/compressed-pristines/subversion/libsvn_fs_base/bdb/miscellaneous-table.c Thu Aug 16 10:17:48 2012
@@ -92,7 +92,7 @@ svn_fs_bdb__miscellaneous_set(svn_fs_t *
if (val == NULL)
{
svn_fs_base__trail_debug(trail, "miscellaneous", "del");
- return BDB_WRAP(fs, "deleting record from 'miscellaneous' table",
+ return BDB_WRAP(fs, N_("deleting record from 'miscellaneous' table"),
bfd->miscellaneous->del(bfd->miscellaneous,
trail->db_txn, &key, 0));
}
@@ -100,7 +100,7 @@ svn_fs_bdb__miscellaneous_set(svn_fs_t *
{
svn_fs_base__str_to_dbt(&value, val);
svn_fs_base__trail_debug(trail, "miscellaneous", "add");
- return BDB_WRAP(fs, "storing miscellaneous record",
+ return BDB_WRAP(fs, N_("storing miscellaneous record"),
bfd->miscellaneous->put(bfd->miscellaneous,
trail->db_txn,
&key, &value, 0));
@@ -128,7 +128,7 @@ svn_fs_bdb__miscellaneous_get(const char
if (db_err != DB_NOTFOUND)
{
- SVN_ERR(BDB_WRAP(fs, "fetching miscellaneous record", db_err));
+ SVN_ERR(BDB_WRAP(fs, N_("fetching miscellaneous record"), db_err));
*val = apr_pstrmemdup(pool, value.data, value.size);
}
return SVN_NO_ERROR;
Modified: subversion/branches/compressed-pristines/subversion/libsvn_fs_base/bdb/node-origins-table.c
URL: http://svn.apache.org/viewvc/subversion/branches/compressed-pristines/subversion/libsvn_fs_base/bdb/node-origins-table.c?rev=1373783&r1=1373782&r2=1373783&view=diff
==============================================================================
--- subversion/branches/compressed-pristines/subversion/libsvn_fs_base/bdb/node-origins-table.c (original)
+++ subversion/branches/compressed-pristines/subversion/libsvn_fs_base/bdb/node-origins-table.c Thu Aug 16 10:17:48 2012
@@ -124,7 +124,7 @@ svn_error_t *svn_fs_bdb__set_node_origin
/* Create a value from our ORIGIN_ID, and add this record to the table. */
svn_fs_base__id_to_dbt(&value, origin_id, pool);
svn_fs_base__trail_debug(trail, "node-origins", "put");
- return BDB_WRAP(fs, _("storing node-origins record"),
+ return BDB_WRAP(fs, N_("storing node-origins record"),
bfd->node_origins->put(bfd->node_origins, trail->db_txn,
&key, &value, 0));
}
@@ -139,7 +139,7 @@ svn_error_t *svn_fs_bdb__delete_node_ori
svn_fs_base__str_to_dbt(&key, node_id);
svn_fs_base__trail_debug(trail, "node-origins", "del");
- return BDB_WRAP(fs, "deleting entry from 'node-origins' table",
+ return BDB_WRAP(fs, N_("deleting entry from 'node-origins' table"),
bfd->node_origins->del(bfd->node_origins,
trail->db_txn, &key, 0));
}
Modified: subversion/branches/compressed-pristines/subversion/libsvn_fs_base/bdb/nodes-table.c
URL: http://svn.apache.org/viewvc/subversion/branches/compressed-pristines/subversion/libsvn_fs_base/bdb/nodes-table.c?rev=1373783&r1=1373782&r2=1373783&view=diff
==============================================================================
--- subversion/branches/compressed-pristines/subversion/libsvn_fs_base/bdb/nodes-table.c (original)
+++ subversion/branches/compressed-pristines/subversion/libsvn_fs_base/bdb/nodes-table.c Thu Aug 16 10:17:48 2012
@@ -99,7 +99,7 @@ svn_fs_bdb__new_node_id(svn_fs_id_t **id
/* Get the current value associated with the `next-key' key in the table. */
svn_fs_base__str_to_dbt(&query, NEXT_KEY_KEY);
svn_fs_base__trail_debug(trail, "nodes", "get");
- SVN_ERR(BDB_WRAP(fs, _("allocating new node ID (getting 'next-key')"),
+ SVN_ERR(BDB_WRAP(fs, N_("allocating new node ID (getting 'next-key')"),
bfd->nodes->get(bfd->nodes, trail->db_txn,
&query,
svn_fs_base__result_dbt(&result),
@@ -117,7 +117,7 @@ svn_fs_bdb__new_node_id(svn_fs_id_t **id
svn_fs_base__str_to_dbt(&query, NEXT_KEY_KEY),
svn_fs_base__str_to_dbt(&result, next_key),
0);
- SVN_ERR(BDB_WRAP(fs, _("bumping next node ID key"), db_err));
+ SVN_ERR(BDB_WRAP(fs, N_("bumping next node ID key"), db_err));
/* Create and return the new node id. */
*id_p = svn_fs_base__id_create(next_node_id, copy_id, txn_id, pool);
@@ -179,7 +179,7 @@ svn_fs_bdb__delete_nodes_entry(svn_fs_t
DBT key;
svn_fs_base__trail_debug(trail, "nodes", "del");
- return BDB_WRAP(fs, _("deleting entry from 'nodes' table"),
+ return BDB_WRAP(fs, N_("deleting entry from 'nodes' table"),
bfd->nodes->del(bfd->nodes,
trail->db_txn,
svn_fs_base__id_to_dbt(&key, id, pool),
@@ -217,7 +217,7 @@ svn_fs_bdb__get_node_revision(node_revis
return svn_fs_base__err_dangling_id(fs, id);
/* Handle any other error conditions. */
- SVN_ERR(BDB_WRAP(fs, _("reading node revision"), db_err));
+ SVN_ERR(BDB_WRAP(fs, N_("reading node revision"), db_err));
/* If our caller doesn't really care about the return value here,
just return successfully. */
@@ -250,7 +250,7 @@ svn_fs_bdb__put_node_revision(svn_fs_t *
SVN_ERR(svn_fs_base__unparse_node_revision_skel(&skel, noderev,
bfd->format, pool));
svn_fs_base__trail_debug(trail, "nodes", "put");
- return BDB_WRAP(fs, _("storing node revision"),
+ return BDB_WRAP(fs, N_("storing node revision"),
bfd->nodes->put(bfd->nodes, db_txn,
svn_fs_base__id_to_dbt(&key, id, pool),
svn_fs_base__skel_to_dbt(&value, skel,
Modified: subversion/branches/compressed-pristines/subversion/libsvn_fs_base/bdb/reps-table.c
URL: http://svn.apache.org/viewvc/subversion/branches/compressed-pristines/subversion/libsvn_fs_base/bdb/reps-table.c?rev=1373783&r1=1373782&r2=1373783&view=diff
==============================================================================
--- subversion/branches/compressed-pristines/subversion/libsvn_fs_base/bdb/reps-table.c (original)
+++ subversion/branches/compressed-pristines/subversion/libsvn_fs_base/bdb/reps-table.c Thu Aug 16 10:17:48 2012
@@ -98,7 +98,7 @@ svn_fs_bdb__read_rep(representation_t **
_("No such representation '%s'"), key);
/* Handle any other error conditions. */
- SVN_ERR(BDB_WRAP(fs, _("reading representation"), db_err));
+ SVN_ERR(BDB_WRAP(fs, N_("reading representation"), db_err));
/* Parse the REPRESENTATION skel. */
skel = svn_skel__parse(result.data, result.size, pool);
@@ -125,7 +125,7 @@ svn_fs_bdb__write_rep(svn_fs_t *fs,
/* Now write the record. */
svn_fs_base__trail_debug(trail, "representations", "put");
- return BDB_WRAP(fs, _("storing representation"),
+ return BDB_WRAP(fs, N_("storing representation"),
bfd->representations->put
(bfd->representations, trail->db_txn,
svn_fs_base__str_to_dbt(&query, key),
@@ -153,7 +153,7 @@ svn_fs_bdb__write_new_rep(const char **k
/* Get the current value associated with `next-key'. */
svn_fs_base__str_to_dbt(&query, NEXT_KEY_KEY);
svn_fs_base__trail_debug(trail, "representations", "get");
- SVN_ERR(BDB_WRAP(fs, _("allocating new representation (getting next-key)"),
+ SVN_ERR(BDB_WRAP(fs, N_("allocating new representation (getting next-key)"),
bfd->representations->get
(bfd->representations, trail->db_txn, &query,
svn_fs_base__result_dbt(&result), 0)));
@@ -174,7 +174,7 @@ svn_fs_bdb__write_new_rep(const char **k
svn_fs_base__str_to_dbt(&result, next_key),
0);
- return BDB_WRAP(fs, _("bumping next representation key"), db_err);
+ return BDB_WRAP(fs, N_("bumping next representation key"), db_err);
}
@@ -200,5 +200,5 @@ svn_fs_bdb__delete_rep(svn_fs_t *fs,
_("No such representation '%s'"), key);
/* Handle any other error conditions. */
- return BDB_WRAP(fs, _("deleting representation"), db_err);
+ return BDB_WRAP(fs, N_("deleting representation"), db_err);
}
Modified: subversion/branches/compressed-pristines/subversion/libsvn_fs_base/bdb/rev-table.c
URL: http://svn.apache.org/viewvc/subversion/branches/compressed-pristines/subversion/libsvn_fs_base/bdb/rev-table.c?rev=1373783&r1=1373782&r2=1373783&view=diff
==============================================================================
--- subversion/branches/compressed-pristines/subversion/libsvn_fs_base/bdb/rev-table.c (original)
+++ subversion/branches/compressed-pristines/subversion/libsvn_fs_base/bdb/rev-table.c Thu Aug 16 10:17:48 2012
@@ -92,7 +92,7 @@ svn_fs_bdb__get_rev(revision_t **revisio
return svn_fs_base__err_dangling_rev(fs, rev);
/* Handle any other error conditions. */
- SVN_ERR(BDB_WRAP(fs, _("reading filesystem revision"), db_err));
+ SVN_ERR(BDB_WRAP(fs, N_("reading filesystem revision"), db_err));
/* Parse REVISION skel. */
skel = svn_skel__parse(value.data, value.size, pool);
@@ -138,7 +138,7 @@ svn_fs_bdb__put_rev(svn_revnum_t *rev,
(bfd->revisions, trail->db_txn,
svn_fs_base__set_dbt(&query, &recno, sizeof(recno)),
svn_fs_base__skel_to_dbt(&result, skel, pool), 0);
- return BDB_WRAP(fs, "updating filesystem revision", db_err);
+ return BDB_WRAP(fs, N_("updating filesystem revision"), db_err);
}
svn_fs_base__trail_debug(trail, "revisions", "put");
@@ -146,7 +146,7 @@ svn_fs_bdb__put_rev(svn_revnum_t *rev,
svn_fs_base__recno_dbt(&key, &recno),
svn_fs_base__skel_to_dbt(&value, skel, pool),
DB_APPEND);
- SVN_ERR(BDB_WRAP(fs, "storing filesystem revision", db_err));
+ SVN_ERR(BDB_WRAP(fs, N_("storing filesystem revision"), db_err));
/* Turn the record number into a Subversion revision number.
Revisions are numbered starting with zero; Berkeley DB record
@@ -176,7 +176,7 @@ svn_fs_bdb__youngest_rev(svn_revnum_t *y
/* Create a database cursor. */
svn_fs_base__trail_debug(trail, "revisions", "cursor");
- SVN_ERR(BDB_WRAP(fs, "getting youngest revision (creating cursor)",
+ SVN_ERR(BDB_WRAP(fs, N_("getting youngest revision (creating cursor)"),
bfd->revisions->cursor(bfd->revisions, trail->db_txn,
&cursor, 0)));
@@ -200,7 +200,7 @@ svn_fs_bdb__youngest_rev(svn_revnum_t *y
"Corrupt DB: revision 0 missing from 'revisions' table, in "
"filesystem '%s'", fs->path);
- SVN_ERR(BDB_WRAP(fs, "getting youngest revision (finding last entry)",
+ SVN_ERR(BDB_WRAP(fs, N_("getting youngest revision (finding last entry)"),
db_err));
}
@@ -210,7 +210,7 @@ svn_fs_bdb__youngest_rev(svn_revnum_t *y
reasons, and txn_commit shouldn't fail that way, and
2) using a cursor after committing its transaction can cause
undetectable database corruption. */
- SVN_ERR(BDB_WRAP(fs, "getting youngest revision (closing cursor)",
+ SVN_ERR(BDB_WRAP(fs, N_("getting youngest revision (closing cursor)"),
svn_bdb_dbc_close(cursor)));
/* Turn the record number into a Subversion revision number.
Modified: subversion/branches/compressed-pristines/subversion/libsvn_fs_base/bdb/strings-table.c
URL: http://svn.apache.org/viewvc/subversion/branches/compressed-pristines/subversion/libsvn_fs_base/bdb/strings-table.c?rev=1373783&r1=1373782&r2=1373783&view=diff
==============================================================================
--- subversion/branches/compressed-pristines/subversion/libsvn_fs_base/bdb/strings-table.c (original)
+++ subversion/branches/compressed-pristines/subversion/libsvn_fs_base/bdb/strings-table.c Thu Aug 16 10:17:48 2012
@@ -91,7 +91,7 @@ locate_key(apr_size_t *length,
DBT result;
svn_fs_base__trail_debug(trail, "strings", "cursor");
- SVN_ERR(BDB_WRAP(fs, _("creating cursor for reading a string"),
+ SVN_ERR(BDB_WRAP(fs, N_("creating cursor for reading a string"),
bfd->strings->cursor(bfd->strings, trail->db_txn,
cursor, 0)));
@@ -121,7 +121,7 @@ locate_key(apr_size_t *length,
if (db_err != SVN_BDB_DB_BUFFER_SMALL)
{
svn_bdb_dbc_close(*cursor);
- return BDB_WRAP(fs, "moving cursor", db_err);
+ return BDB_WRAP(fs, N_("moving cursor"), db_err);
}
/* We got an SVN_BDB_DB_BUFFER_SMALL (typical since we have a
@@ -133,7 +133,7 @@ locate_key(apr_size_t *length,
if (db_err)
{
svn_bdb_dbc_close(*cursor);
- return BDB_WRAP(fs, "rerunning cursor move", db_err);
+ return BDB_WRAP(fs, N_("rerunning cursor move"), db_err);
}
}
@@ -225,7 +225,7 @@ svn_fs_bdb__string_read(svn_fs_t *fs,
return SVN_NO_ERROR;
}
if (db_err)
- return BDB_WRAP(fs, "reading string", db_err);
+ return BDB_WRAP(fs, N_("reading string"), db_err);
}
/* The current record contains OFFSET. Fetch the contents now. Note that
@@ -244,14 +244,14 @@ svn_fs_bdb__string_read(svn_fs_t *fs,
if (db_err)
{
svn_bdb_dbc_close(cursor);
- return BDB_WRAP(fs, "reading string", db_err);
+ return BDB_WRAP(fs, N_("reading string"), db_err);
}
bytes_read += result.size;
if (bytes_read == *len)
{
/* Done with the cursor. */
- SVN_ERR(BDB_WRAP(fs, "closing string-reading cursor",
+ SVN_ERR(BDB_WRAP(fs, N_("closing string-reading cursor"),
svn_bdb_dbc_close(cursor)));
break;
}
@@ -262,7 +262,7 @@ svn_fs_bdb__string_read(svn_fs_t *fs,
if (db_err == DB_NOTFOUND)
break;
if (db_err)
- return BDB_WRAP(fs, "reading string", db_err);
+ return BDB_WRAP(fs, N_("reading string"), db_err);
/* We'll be reading from the beginning of the next record */
offset = 0;
@@ -297,7 +297,7 @@ get_key_and_bump(svn_fs_t *fs,
write the new value -- that would append, not overwrite. */
svn_fs_base__trail_debug(trail, "strings", "cursor");
- SVN_ERR(BDB_WRAP(fs, "creating cursor for reading a string",
+ SVN_ERR(BDB_WRAP(fs, N_("creating cursor for reading a string"),
bfd->strings->cursor(bfd->strings, trail->db_txn,
&cursor, 0)));
@@ -310,7 +310,7 @@ get_key_and_bump(svn_fs_t *fs,
if (db_err)
{
svn_bdb_dbc_close(cursor);
- return BDB_WRAP(fs, "getting next-key value", db_err);
+ return BDB_WRAP(fs, N_("getting next-key value"), db_err);
}
svn_fs_base__track_dbt(&result, pool);
@@ -328,10 +328,10 @@ get_key_and_bump(svn_fs_t *fs,
{
svn_bdb_dbc_close(cursor); /* ignore the error, the original is
more important. */
- return BDB_WRAP(fs, "bumping next string key", db_err);
+ return BDB_WRAP(fs, N_("bumping next string key"), db_err);
}
- return BDB_WRAP(fs, "closing string-reading cursor",
+ return BDB_WRAP(fs, N_("closing string-reading cursor"),
svn_bdb_dbc_close(cursor));
}
@@ -355,7 +355,7 @@ svn_fs_bdb__string_append(svn_fs_t *fs,
/* Store a new record into the database. */
svn_fs_base__trail_debug(trail, "strings", "put");
- return BDB_WRAP(fs, "appending string",
+ return BDB_WRAP(fs, N_("appending string"),
bfd->strings->put
(bfd->strings, trail->db_txn,
svn_fs_base__str_to_dbt(&query, *key),
@@ -387,7 +387,7 @@ svn_fs_bdb__string_clear(svn_fs_t *fs,
"No such string '%s'", key);
/* Handle any other error conditions. */
- SVN_ERR(BDB_WRAP(fs, "clearing string", db_err));
+ SVN_ERR(BDB_WRAP(fs, N_("clearing string"), db_err));
/* Shove empty data back in for this key. */
svn_fs_base__clear_dbt(&result);
@@ -396,7 +396,7 @@ svn_fs_bdb__string_clear(svn_fs_t *fs,
result.flags |= DB_DBT_USERMEM;
svn_fs_base__trail_debug(trail, "strings", "put");
- return BDB_WRAP(fs, "storing empty contents",
+ return BDB_WRAP(fs, N_("storing empty contents"),
bfd->strings->put(bfd->strings, trail->db_txn,
&query, &result, 0));
}
@@ -433,7 +433,7 @@ svn_fs_bdb__string_size(svn_filesize_t *
return SVN_NO_ERROR;
}
if (db_err)
- return BDB_WRAP(fs, "fetching string length", db_err);
+ return BDB_WRAP(fs, N_("fetching string length"), db_err);
total += length;
}
@@ -463,7 +463,7 @@ svn_fs_bdb__string_delete(svn_fs_t *fs,
"No such string '%s'", key);
/* Handle any other error conditions. */
- return BDB_WRAP(fs, "deleting string", db_err);
+ return BDB_WRAP(fs, N_("deleting string"), db_err);
}
@@ -488,7 +488,7 @@ svn_fs_bdb__string_copy(svn_fs_t *fs,
SVN_ERR(get_key_and_bump(fs, new_key, trail, pool));
svn_fs_base__trail_debug(trail, "strings", "cursor");
- SVN_ERR(BDB_WRAP(fs, "creating cursor for reading a string",
+ SVN_ERR(BDB_WRAP(fs, N_("creating cursor for reading a string"),
bfd->strings->cursor(bfd->strings, trail->db_txn,
&cursor, 0)));
@@ -502,7 +502,7 @@ svn_fs_bdb__string_copy(svn_fs_t *fs,
if (db_err)
{
svn_bdb_dbc_close(cursor);
- return BDB_WRAP(fs, "getting next-key value", db_err);
+ return BDB_WRAP(fs, N_("getting next-key value"), db_err);
}
while (1)
@@ -521,7 +521,7 @@ svn_fs_bdb__string_copy(svn_fs_t *fs,
if (db_err)
{
svn_bdb_dbc_close(cursor);
- return BDB_WRAP(fs, "writing copied data", db_err);
+ return BDB_WRAP(fs, N_("writing copied data"), db_err);
}
/* Read the next chunk. Terminate loop if we're done. */
@@ -532,10 +532,10 @@ svn_fs_bdb__string_copy(svn_fs_t *fs,
if (db_err)
{
svn_bdb_dbc_close(cursor);
- return BDB_WRAP(fs, "fetching string data for a copy", db_err);
+ return BDB_WRAP(fs, N_("fetching string data for a copy"), db_err);
}
}
- return BDB_WRAP(fs, "closing string-reading cursor",
+ return BDB_WRAP(fs, N_("closing string-reading cursor"),
svn_bdb_dbc_close(cursor));
}