You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by cm...@apache.org on 2009/12/17 19:22:19 UTC
svn commit: r891821 - in /subversion/branches/issue-3550-dev/subversion:
libsvn_fs_base/revs-txns.c libsvn_fs_base/revs-txns.h libsvn_fs_base/tree.c
tests/libsvn_fs_base/changes-test.c
Author: cmpilato
Date: Thu Dec 17 18:22:19 2009
New Revision: 891821
URL: http://svn.apache.org/viewvc?rev=891821&view=rev
Log:
On the 'issue-3550-dev' branch, make transactions use their stored
changes_id (if any) for path change records (instead of their txn_ids).
* subversion/libsvn_fs_base/revs-txns.h,
* subversion/libsvn_fs_base/revs-txns.c
(svn_fs_base__txn_get_changes_id): New function.
* subversion/libsvn_fs_base/tree.c
(add_change): Use svn_fs_base__txn_get_changes_id() to fetch the
correct key via which changes for the transaction should be added,
and then use that key to do exactly that.
* subversion/tests/libsvn_fs_base/changes-test.c
(txn_body_changes_fetch_by_txn_id): New helper trail body function.
(changes_fetch_ordering): Use txn_body_changes_fetch_by_txn_id()
instead of txn_body_changes_fetch().
Modified:
subversion/branches/issue-3550-dev/subversion/libsvn_fs_base/revs-txns.c
subversion/branches/issue-3550-dev/subversion/libsvn_fs_base/revs-txns.h
subversion/branches/issue-3550-dev/subversion/libsvn_fs_base/tree.c
subversion/branches/issue-3550-dev/subversion/tests/libsvn_fs_base/changes-test.c
Modified: subversion/branches/issue-3550-dev/subversion/libsvn_fs_base/revs-txns.c
URL: http://svn.apache.org/viewvc/subversion/branches/issue-3550-dev/subversion/libsvn_fs_base/revs-txns.c?rev=891821&r1=891820&r2=891821&view=diff
==============================================================================
--- subversion/branches/issue-3550-dev/subversion/libsvn_fs_base/revs-txns.c (original)
+++ subversion/branches/issue-3550-dev/subversion/libsvn_fs_base/revs-txns.c Thu Dec 17 18:22:19 2009
@@ -345,6 +345,21 @@
svn_error_t *
+svn_fs_base__txn_get_changes_id(const char **changes_id,
+ svn_fs_t *fs,
+ const char *txn_name,
+ trail_t *trail,
+ apr_pool_t *pool)
+{
+ transaction_t *txn;
+ SVN_ERR(get_txn(&txn, fs, txn_name, FALSE, trail, pool));
+ *changes_id = txn->changes_id ? txn->changes_id
+ : apr_pstrdup(pool, txn_name);
+ return SVN_NO_ERROR;
+}
+
+
+svn_error_t *
svn_fs_base__get_txn_ids(const svn_fs_id_t **root_id_p,
const svn_fs_id_t **base_root_id_p,
svn_fs_t *fs,
Modified: subversion/branches/issue-3550-dev/subversion/libsvn_fs_base/revs-txns.h
URL: http://svn.apache.org/viewvc/subversion/branches/issue-3550-dev/subversion/libsvn_fs_base/revs-txns.h?rev=891821&r1=891820&r2=891821&view=diff
==============================================================================
--- subversion/branches/issue-3550-dev/subversion/libsvn_fs_base/revs-txns.h (original)
+++ subversion/branches/issue-3550-dev/subversion/libsvn_fs_base/revs-txns.h Thu Dec 17 18:22:19 2009
@@ -91,6 +91,16 @@
apr_pool_t *pool);
+/* Set *CHANGES_ID to the key into the `changes' table (allocated from
+ POOL) by which changed path records associated with FS transaction
+ TXN_NAME are found. Do all of this as part of TRAIL. */
+svn_error_t *svn_fs_base__txn_get_changes_id(const char **changes_id,
+ svn_fs_t *fs,
+ const char *txn_name,
+ trail_t *trail,
+ apr_pool_t *pool);
+
+
/* Retrieve information about the Subversion transaction TXN_NAME from
the `transactions' table of FS, as part of TRAIL.
Set *ROOT_ID_P to the ID of the transaction's root directory.
Modified: subversion/branches/issue-3550-dev/subversion/libsvn_fs_base/tree.c
URL: http://svn.apache.org/viewvc/subversion/branches/issue-3550-dev/subversion/libsvn_fs_base/tree.c?rev=891821&r1=891820&r2=891821&view=diff
==============================================================================
--- subversion/branches/issue-3550-dev/subversion/libsvn_fs_base/tree.c (original)
+++ subversion/branches/issue-3550-dev/subversion/libsvn_fs_base/tree.c Thu Dec 17 18:22:19 2009
@@ -944,11 +944,11 @@
/* Populating the `changes' table. */
-/* Add a change to the changes table in FS, keyed on transaction id
- TXN_ID, and indicated that a change of kind CHANGE_KIND occurred on
- PATH (whose node revision id is--or was, in the case of a
- deletion--NODEREV_ID), and optionally that TEXT_MODs or PROP_MODs
- occurred. Do all this as part of TRAIL. */
+/* Add a change to the changes table in FS associated with the
+ transaction whose id is TXN_ID, indicating that a change of kind
+ CHANGE_KIND occurred on PATH (whose node revision id is--or was, in
+ the case of a deletion--NODEREV_ID), and (optionally) that
+ TEXT_MODs or PROP_MODs occurred. Do all this as part of TRAIL. */
static svn_error_t *
add_change(svn_fs_t *fs,
const char *txn_id,
@@ -961,12 +961,15 @@
apr_pool_t *pool)
{
change_t change;
+ const char *changes_id;
change.path = svn_fs__canonicalize_abspath(path, pool);
change.noderev_id = noderev_id;
change.kind = change_kind;
change.text_mod = text_mod;
change.prop_mod = prop_mod;
- return svn_fs_bdb__changes_add(fs, txn_id, &change, trail, pool);
+ SVN_ERR(svn_fs_base__txn_get_changes_id(&changes_id, fs, txn_id,
+ trail, pool));
+ return svn_fs_bdb__changes_add(fs, changes_id, &change, trail, pool);
}
Modified: subversion/branches/issue-3550-dev/subversion/tests/libsvn_fs_base/changes-test.c
URL: http://svn.apache.org/viewvc/subversion/branches/issue-3550-dev/subversion/tests/libsvn_fs_base/changes-test.c?rev=891821&r1=891820&r2=891821&view=diff
==============================================================================
--- subversion/branches/issue-3550-dev/subversion/tests/libsvn_fs_base/changes-test.c (original)
+++ subversion/branches/issue-3550-dev/subversion/tests/libsvn_fs_base/changes-test.c Thu Dec 17 18:22:19 2009
@@ -34,6 +34,7 @@
#include "private/svn_skel.h"
#include "../svn_test_fs.h"
+#include "../../libsvn_fs_base/revs-txns.h"
#include "../../libsvn_fs_base/util/fs_skels.h"
#include "../../libsvn_fs_base/bdb/changes-table.h"
@@ -155,6 +156,17 @@
static svn_error_t *
+txn_body_changes_fetch_by_txn_id(void *baton, trail_t *trail)
+{
+ struct changes_args *b = baton;
+ const char *changes_id;
+ SVN_ERR(svn_fs_base__txn_get_changes_id(&changes_id, trail->fs, b->key,
+ trail, trail->pool));
+ return svn_fs_bdb__changes_fetch(&(b->changes), b->fs, changes_id,
+ trail, trail->pool);
+}
+
+static svn_error_t *
txn_body_changes_delete(void *baton, trail_t *trail)
{
struct changes_args *b = baton;
@@ -627,7 +639,7 @@
the deletion of 'dir1', and the addition of 'dir3'. ***/
args.fs = fs;
args.key = txn_name;
- SVN_ERR(svn_fs_base__retry_txn(fs, txn_body_changes_fetch, &args,
+ SVN_ERR(svn_fs_base__retry_txn(fs, txn_body_changes_fetch_by_txn_id, &args,
FALSE, subpool));
if ((! args.changes) || (apr_hash_count(args.changes) != 3))
return svn_error_create(SVN_ERR_TEST_FAILED, NULL,
@@ -699,7 +711,7 @@
the replacement of 'dir1', and the addition of 'dir4'. ***/
args.fs = fs;
args.key = txn_name;
- SVN_ERR(svn_fs_base__retry_txn(fs, txn_body_changes_fetch, &args,
+ SVN_ERR(svn_fs_base__retry_txn(fs, txn_body_changes_fetch_by_txn_id, &args,
FALSE, subpool));
if ((! args.changes) || (apr_hash_count(args.changes) != 3))
return svn_error_create(SVN_ERR_TEST_FAILED, NULL,