Author: julianfoad
Date: Tue Apr 27 09:22:26 2010
New Revision: 938371
URL: http://svn.apache.org/viewvc?rev=938371&view=rev
Log:
Propagate the pristine text's SHA-1 checksum as well as its MD-5 checksum
through the client commit code path. The idea is that
- old APIs will always pass the MD5 (& NULL for the SHA1);
- transitional code passes the SHA1 and MD5;
- new WC-NG code will pass the SHA1 only
(the corresponding MD5 is stored in the pristine text table).
The current state is that everything is using MD5 and the transitional code
is starting to supply SHA1 as well. The SHA1 is not yet (even with this
commit) propagated as far as the WC DB, except in the pristine text store
table.
* subversion/include/svn_wc.h
(svn_wc_queue_committed3): Add a SHA-1 checksum as well as the MD-5.
(svn_wc_queue_committed2): Adjust the doc string.
* subversion/libsvn_client/client.h
(svn_client__do_commit): Rename 'checksums' to 'md5_checksums' and add
'sha1_checksums'.
* subversion/libsvn_client/commit.c
(post_process_commit_item): Add a SHA-1 checksum as well as the MD-5.
(svn_client_commit4): Rename 'checksums' to 'md5_checksums' and add
'sha1_checksums'.
* subversion/libsvn_client/commit_util.c
(svn_client__do_commit): Rename 'checksums' to 'md5_checksums' and add
'sha1_checksums'.
* subversion/libsvn_client/copy.c
(wc_to_repos_copy): Adjust a caller.
* subversion/libsvn_wc/adm_ops.c
(committed_queue_item_t, svn_wc__process_committed_internal,
svn_wc_queue_committed3, svn_wc_process_committed_queue2): Add a SHA-1
checksum as well as the MD-5. (However, the SHA-1 checksum is not yet
passed further down to be installed in the WC DB.)
* subversion/libsvn_wc/deprecated.c
(svn_wc_process_committed4, svn_wc_queue_committed2): Adjust callers.
* subversion/libsvn_wc/wc.h
(svn_wc__process_committed_internal): Add a SHA-1 checksum as well as the
MD-5.
Modified:
subversion/trunk/subversion/include/svn_wc.h
subversion/trunk/subversion/libsvn_client/client.h
subversion/trunk/subversion/libsvn_client/commit.c
subversion/trunk/subversion/libsvn_client/commit_util.c
subversion/trunk/subversion/libsvn_client/copy.c
subversion/trunk/subversion/libsvn_wc/adm_ops.c
subversion/trunk/subversion/libsvn_wc/deprecated.c
subversion/trunk/subversion/libsvn_wc/wc.h
Modified: subversion/trunk/subversion/include/svn_wc.h
URL:
http://svn.apache.org/viewvc/subversion/trunk/subversion/include/svn_wc.h?rev=938371&r1=938370&r2=938371&view=diff
==============================================================================
--- subversion/trunk/subversion/include/svn_wc.h (original)
+++ subversion/trunk/subversion/include/svn_wc.h Tue Apr 27 09:22:26 2010
@@ -4920,6 +4920,10 @@ svn_wc_committed_queue_create(apr_pool_t
* ### [JAF] No, it doesn't calculate the checksum, it stores null in wc.db:
* ### see svn_wc__process_committed_internal().
*
+ * If @a sha1_checksum is non-NULL, use it instead of @a md5_checksum to
+ * identify the node's pristine text.
+ * ### NOT YET IMPLEMENTED.
+ *
* If @a recurse is TRUE and @a local_abspath is a directory, then bump every
* versioned object at or under @a local_abspath. This is usually done for
* copied trees.
@@ -4943,7 +4947,7 @@ svn_wc_committed_queue_create(apr_pool_t
* actual inclusion in the new revision.
*
* All pointer data passed to this function (@a local_abspath,
- * @a wcprop_changes and @a md5_checksum) should remain valid until the
+ * @a wcprop_changes and the checksums) should remain valid until the
* queue has been processed by svn_wc_process_committed_queue2().
*
* Temporary allocations will be performed in @a scratch_pool, and persistent
@@ -4959,10 +4963,12 @@ svn_wc_queue_committed3(svn_wc_committed
svn_boolean_t remove_lock,
svn_boolean_t remove_changelist,
const svn_checksum_t *md5_checksum,
+ const svn_checksum_t *sha1_checksum,
apr_pool_t *scratch_pool);
/** Same as svn_wc_queue_committed3() except @a path doesn't have to be an
- * abspath and @a adm_access is unused.
+ * abspath and @a adm_access is unused and a SHA-1 checksum cannot be
+ * specified.
*
* @since New in 1.6.
*
Modified: subversion/trunk/subversion/libsvn_client/client.h
URL:
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/client.h?rev=938371&r1=938370&r2=938371&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/client.h (original)
+++ subversion/trunk/subversion/libsvn_client/client.h Tue Apr 27 09:22:26 2010
@@ -924,9 +924,10 @@ svn_client__condense_commit_items(const
*NEW_TEXT_BASE_ABSPATHS to a hash that maps (const char *) paths (from
the items' paths) to the (const char *) abspaths of these files.
- If CHECKSUMS is not NULL, set *CHECKSUMS to a hash containing, for each
- file transmitted, a mapping from the commit-item's (const char *) path
- to the (const svn_checksum_t *) MD5 checksum of its new text base.
+ If MD5_CHECKSUMS is not NULL, set *MD5_CHECKSUMS to a hash containing,
+ for each file transmitted, a mapping from the commit-item's (const
+ char *) path to the (const svn_checksum_t *) MD5 checksum of its new text
+ base. Similarly for SHA1_CHECKSUMS.
Use POOL for all allocations.
*/
@@ -937,7 +938,8 @@ svn_client__do_commit(const char *base_u
void *edit_baton,
const char *notify_path_prefix,
apr_hash_t **new_text_base_abspaths,
- apr_hash_t **checksums,
+ apr_hash_t **md5_checksums,
+ apr_hash_t **sha1_checksums,
svn_client_ctx_t *ctx,
apr_pool_t *pool);
Modified: subversion/trunk/subversion/libsvn_client/commit.c
URL:
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/commit.c?rev=938371&r1=938370&r2=938371&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/commit.c (original)
+++ subversion/trunk/subversion/libsvn_client/commit.c Tue Apr 27 09:22:26 2010
@@ -933,7 +933,8 @@ collect_lock_tokens(apr_hash_t **result,
return SVN_NO_ERROR;
}
-/* Put ITEM onto QUEUE, allocating it in QUEUE's pool... */
+/* Put ITEM onto QUEUE, allocating it in QUEUE's pool...
+ * If a checksum is provided, it can be the MD5 and/or the SHA1. */
static svn_error_t *
post_process_commit_item(svn_wc_committed_queue_t *queue,
const svn_client_commit_item3_t *item,
@@ -941,6 +942,7 @@ post_process_commit_item(svn_wc_committe
svn_boolean_t keep_changelists,
svn_boolean_t keep_locks,
const svn_checksum_t *md5_checksum,
+ const svn_checksum_t *sha1_checksum,
apr_pool_t *scratch_pool)
{
svn_boolean_t loop_recurse = FALSE;
@@ -974,7 +976,7 @@ post_process_commit_item(svn_wc_committe
return svn_wc_queue_committed3(queue, item->path,
loop_recurse, item->incoming_prop_changes,
remove_lock, !keep_changelists,
- md5_checksum, scratch_pool);
+ md5_checksum, sha1_checksum, scratch_pool);
}
@@ -1070,7 +1072,8 @@ svn_client_commit4(svn_commit_info_t **c
apr_hash_t *committables;
apr_hash_t *lock_tokens;
apr_hash_t *tempfiles = NULL;
- apr_hash_t *checksums;
+ apr_hash_t *md5_checksums;
+ apr_hash_t *sha1_checksums;
apr_array_header_t *commit_items;
svn_error_t *cmt_err = SVN_NO_ERROR, *unlock_err = SVN_NO_ERROR;
svn_error_t *bump_err = SVN_NO_ERROR, *cleanup_err = SVN_NO_ERROR;
@@ -1225,8 +1228,8 @@ svn_client_commit4(svn_commit_info_t **c
/* Perform the commit. */
cmt_err = svn_client__do_commit(base_url, commit_items, editor, edit_baton,
- notify_prefix, &tempfiles, &checksums, ctx,
- pool);
+ notify_prefix, &tempfiles, &md5_checksums,
+ &sha1_checksums, ctx, pool);
/* Handle a successful commit. */
if ((! cmt_err)
@@ -1246,7 +1249,10 @@ svn_client_commit4(svn_commit_info_t **c
svn_pool_clear(iterpool);
bump_err = post_process_commit_item(queue, item, ctx->wc_ctx,
keep_changelists, keep_locks,
- apr_hash_get(checksums,
+ apr_hash_get(md5_checksums,
+ item->path,
+
APR_HASH_KEY_STRING),
+ apr_hash_get(sha1_checksums,
item->path,
APR_HASH_KEY_STRING),
iterpool);
Modified: subversion/trunk/subversion/libsvn_client/commit_util.c
URL:
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/commit_util.c?rev=938371&r1=938370&r2=938371&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/commit_util.c (original)
+++ subversion/trunk/subversion/libsvn_client/commit_util.c Tue Apr 27 09:22:26
2010
@@ -1583,7 +1583,8 @@ svn_client__do_commit(const char *base_u
void *edit_baton,
const char *notify_path_prefix,
apr_hash_t **new_text_base_abspaths,
- apr_hash_t **checksums,
+ apr_hash_t **md5_checksums,
+ apr_hash_t **sha1_checksums,
svn_client_ctx_t *ctx,
apr_pool_t *pool)
{
@@ -1609,9 +1610,11 @@ svn_client__do_commit(const char *base_u
if (new_text_base_abspaths)
*new_text_base_abspaths = apr_hash_make(pool);
- /* Ditto for the md5 checksums. */
- if (checksums)
- *checksums = apr_hash_make(pool);
+ /* Ditto for the checksums. */
+ if (md5_checksums)
+ *md5_checksums = apr_hash_make(pool);
+ if (sha1_checksums)
+ *sha1_checksums = apr_hash_make(pool);
/* Build a hash from our COMMIT_ITEMS array, keyed on the
URI-decoded relative paths (which come from the item URLs). And
@@ -1644,6 +1647,7 @@ svn_client__do_commit(const char *base_u
const svn_client_commit_item3_t *item = mod->item;
const char *tempfile;
const svn_checksum_t *new_text_base_md5_checksum;
+ const svn_checksum_t *new_text_base_sha1_checksum;
svn_boolean_t fulltext = FALSE;
const char *item_abspath;
@@ -1671,16 +1675,20 @@ svn_client__do_commit(const char *base_u
SVN_ERR(svn_wc_transmit_text_deltas3(new_text_base_abspaths ? &tempfile
: NULL,
- &new_text_base_md5_checksum, NULL,
+ &new_text_base_md5_checksum,
+ &new_text_base_sha1_checksum,
ctx->wc_ctx, item_abspath,
fulltext, editor, mod->file_baton,
pool, iterpool));
if (new_text_base_abspaths && tempfile)
apr_hash_set(*new_text_base_abspaths, item->path, APR_HASH_KEY_STRING,
tempfile);
- if (checksums)
- apr_hash_set(*checksums, item->path, APR_HASH_KEY_STRING,
+ if (md5_checksums)
+ apr_hash_set(*md5_checksums, item->path, APR_HASH_KEY_STRING,
new_text_base_md5_checksum);
+ if (sha1_checksums)
+ apr_hash_set(*sha1_checksums, item->path, APR_HASH_KEY_STRING,
+ new_text_base_sha1_checksum);
}
svn_pool_destroy(iterpool);
Modified: subversion/trunk/subversion/libsvn_client/copy.c
URL:
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/copy.c?rev=938371&r1=938370&r2=938371&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/copy.c (original)
+++ subversion/trunk/subversion/libsvn_client/copy.c Tue Apr 27 09:22:26 2010
@@ -1391,7 +1391,7 @@ wc_to_repos_copy(svn_commit_info_t **com
SVN_ERR_W(svn_client__do_commit(top_dst_url, commit_items,
editor, edit_baton,
0, /* ### any notify_path_offset needed? */
- NULL, NULL, ctx, pool),
+ NULL, NULL, NULL, ctx, pool),
_("Commit failed (details follow):"));
/* Sleep to ensure timestamp integrity. */
Modified: subversion/trunk/subversion/libsvn_wc/adm_ops.c
URL:
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/adm_ops.c?rev=938371&r1=938370&r2=938371&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/adm_ops.c (original)
+++ subversion/trunk/subversion/libsvn_wc/adm_ops.c Tue Apr 27 09:22:26 2010
@@ -83,7 +83,11 @@ typedef struct
svn_boolean_t recurse;
svn_boolean_t no_unlock;
svn_boolean_t keep_changelist;
+
+ /* The pristine text checksum(s). Either or both may be present. */
const svn_checksum_t *md5_checksum;
+ const svn_checksum_t *sha1_checksum;
+
apr_hash_t *new_dav_cache;
} committed_queue_item_t;
@@ -445,6 +449,7 @@ svn_wc__process_committed_internal(svn_w
svn_boolean_t no_unlock,
svn_boolean_t keep_changelist,
const svn_checksum_t *md5_checksum,
+ const svn_checksum_t *sha1_checksum,
const svn_wc_committed_queue_t *queue,
apr_pool_t *scratch_pool)
{
@@ -456,7 +461,8 @@ svn_wc__process_committed_internal(svn_w
new_revnum, new_date, rev_author,
new_dav_cache,
no_unlock, keep_changelist,
- md5_checksum, scratch_pool));
+ md5_checksum, /* ### not yet: sha1_checksum,
*/
+ scratch_pool));
if (recurse && kind == svn_wc__db_kind_dir)
{
@@ -503,6 +509,7 @@ svn_wc__process_committed_internal(svn_w
continue;
md5_checksum = NULL;
+ sha1_checksum = NULL;
if (kind != svn_wc__db_kind_dir)
{
/* Suppress log creation for deleted entries in a replaced
@@ -529,7 +536,10 @@ svn_wc__process_committed_internal(svn_w
APR_HASH_KEY_STRING);
if (cqi != NULL)
- md5_checksum = cqi->md5_checksum;
+ {
+ md5_checksum = cqi->md5_checksum;
+ sha1_checksum = cqi->sha1_checksum;
+ }
}
}
@@ -544,6 +554,7 @@ svn_wc__process_committed_internal(svn_w
TRUE /* no_unlock */,
keep_changelist,
md5_checksum,
+ sha1_checksum,
queue, iterpool));
if (kind == svn_wc__db_kind_dir)
@@ -601,6 +612,7 @@ svn_wc_queue_committed3(svn_wc_committed
svn_boolean_t remove_lock,
svn_boolean_t remove_changelist,
const svn_checksum_t *md5_checksum,
+ const svn_checksum_t *sha1_checksum,
apr_pool_t *scratch_pool)
{
committed_queue_item_t *cqi;
@@ -620,6 +632,7 @@ svn_wc_queue_committed3(svn_wc_committed
cqi->no_unlock = !remove_lock;
cqi->keep_changelist = !remove_changelist;
cqi->md5_checksum = md5_checksum;
+ cqi->sha1_checksum = md5_checksum;
cqi->new_dav_cache = svn_wc__prop_array_to_hash(wcprop_changes, queue->pool);
apr_hash_set(queue->queue, local_abspath, APR_HASH_KEY_STRING, cqi);
@@ -699,7 +712,8 @@ svn_wc_process_committed_queue2(svn_wc_c
cqi->new_dav_cache,
cqi->no_unlock,
cqi->keep_changelist,
- cqi->md5_checksum, queue,
+ cqi->md5_checksum,
+ cqi->sha1_checksum, queue,
iterpool));
SVN_ERR(svn_wc__wq_run(wc_ctx->db, cqi->local_abspath, NULL, NULL,
Modified: subversion/trunk/subversion/libsvn_wc/deprecated.c
URL:
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/deprecated.c?rev=938371&r1=938370&r2=938371&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/deprecated.c (original)
+++ subversion/trunk/subversion/libsvn_wc/deprecated.c Tue Apr 27 09:22:26 2010
@@ -593,7 +593,7 @@ svn_wc_process_committed4(const char *pa
new_revnum, new_date, rev_author,
wcprop_changes_hash,
!remove_lock, !remove_changelist,
- checksum, NULL, pool));
+ checksum, NULL, NULL, pool));
/* Run the log file(s) we just created. */
return svn_error_return(svn_wc__wq_run(db, local_abspath, NULL, NULL, pool));
@@ -3764,7 +3764,7 @@ svn_wc_queue_committed2(svn_wc_committed
SVN_ERR(svn_dirent_get_absolute(&local_abspath, path, scratch_pool));
return svn_wc_queue_committed3(queue, local_abspath, recurse, wcprop_changes,
remove_lock, remove_changelist, md5_checksum,
- scratch_pool);
+ NULL /* sha1_checksum */, scratch_pool);
}
svn_error_t *
Modified: subversion/trunk/subversion/libsvn_wc/wc.h
URL:
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/wc.h?rev=938371&r1=938370&r2=938371&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wc.h (original)
+++ subversion/trunk/subversion/libsvn_wc/wc.h Tue Apr 27 09:22:26 2010
@@ -212,13 +212,17 @@ svn_wc__get_committed_queue_pool(const s
* If @a no_unlock is set, don't release any user locks on @a
* local_abspath; otherwise release them as part of this processing.
*
- * If @keep_changelist is set, don't remove any changeset assignments
+ * If @a keep_changelist is set, don't remove any changeset assignments
* from @a local_abspath; otherwise, clear it of such assignments.
*
* If @a local_abspath is a file and @a md5_checksum is non-NULL, use
* @a md5_checksum as the checksum for the new text base. Otherwise,
* calculate the checksum if needed.
* ### [JAF] No, it doesn't calculate the checksum, it stores null in wc.db.
+ *
+ * If @a sha1_checksum is non-NULL, use it instead of @a md5_checksum to
+ * identify the node's pristine text.
+ * ### NOT YET IMPLEMENTED.
*/
svn_error_t *
svn_wc__process_committed_internal(svn_wc__db_t *db,
@@ -231,6 +235,7 @@ svn_wc__process_committed_internal(svn_w
svn_boolean_t no_unlock,
svn_boolean_t keep_changelist,
const svn_checksum_t *md5_checksum,
+ const svn_checksum_t *sha1_checksum,
const svn_wc_committed_queue_t *queue,
apr_pool_t *scratch_pool);