Author: rhuijben
Date: Tue Apr 19 15:40:06 2011
New Revision: 1095118
URL: http://svn.apache.org/viewvc?rev=1095118&view=rev
Log:
Implement collecting externals definitions that should be updated at commit
time. This in preparation for fixing issue #3351.
* subversion/libsvn_wc/adm_ops.c
(process_committed_leaf): Add old_externals argument to store to be removed
externals definitions. Store the old externals definitions of committed
(not shadowed) directories.
(svn_wc__process_committed_internal): Pass old_externals hash.
(svn_wc_process_committed_queue2): When we queued the wq operations, provide
the file externals changes to interested callers.
* subversion/libsvn_wc/deprecated.c
(svn_wc__process_committed_internal): Pass NULL for new argument.
* subversion/libsvn_wc/wc.h
(svn_wc__process_committed_internal): Add argument.
Modified:
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/libsvn_wc/adm_ops.c
URL:
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/adm_ops.c?rev=1095118&r1=1095117&r2=1095118&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/adm_ops.c (original)
+++ subversion/trunk/subversion/libsvn_wc/adm_ops.c Tue Apr 19 15:40:06 2011
@@ -122,14 +122,15 @@ process_committed_leaf(svn_wc__db_t *db,
svn_boolean_t no_unlock,
svn_boolean_t keep_changelist,
const svn_checksum_t *checksum,
+ apr_hash_t *old_externals,
apr_pool_t *scratch_pool)
{
svn_wc__db_status_t status;
svn_wc__db_kind_t kind;
const svn_checksum_t *copied_checksum;
svn_revnum_t new_changed_rev = new_revnum;
- svn_boolean_t have_base;
- svn_boolean_t prop_mods;
+ svn_boolean_t have_base, have_work;
+ svn_boolean_t had_props, prop_mods;
svn_skel_t *work_item = NULL;
SVN_ERR_ASSERT(svn_dirent_is_absolute(local_abspath));
@@ -137,8 +138,8 @@ process_committed_leaf(svn_wc__db_t *db,
SVN_ERR(svn_wc__db_read_info(&status, &kind, NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL, &copied_checksum,
NULL, NULL, NULL, NULL, NULL, NULL, NULL,
- NULL, NULL, NULL, NULL, NULL, &prop_mods,
- &have_base, NULL, NULL,
+ NULL, NULL, NULL, NULL, &had_props, &prop_mods,
+ &have_base, NULL, &have_work,
db, local_abspath,
scratch_pool, scratch_pool));
@@ -212,6 +213,36 @@ process_committed_leaf(svn_wc__db_t *db,
/* ### If we can determine that nothing below this node was changed
### via this commit, we should keep new_changed_rev at its old
### value, like how we handle files. */
+ if (have_base && !have_work
+ && prop_mods && had_props
+ && old_externals)
+ {
+ apr_hash_t *props;
+ const svn_string_t *val;
+
+ /* We are committing a property modification to a not-shadoweded
+ directory, which might be an svn:externals change.
+
+ BH: I think this is the only kind of change we have to capture.
+ (If the node is shadowed it's definition wasn't currently in
+ used anyway) */
+ SVN_ERR(svn_wc__db_base_get_props(&props, db, local_abspath,
+ scratch_pool, scratch_pool));
+
+ val = props ? apr_hash_get(props, SVN_PROP_EXTERNALS,
+ APR_HASH_KEY_STRING)
+ : NULL;
+
+ if (val)
+ {
+ apr_pool_t *hash_pool = apr_hash_pool_get(old_externals);
+
+ apr_hash_set(old_externals, apr_pstrdup(hash_pool,
+ local_abspath),
+ APR_HASH_KEY_STRING,
+ svn_string_dup(val, hash_pool));
+ }
+ }
}
/* The new text base will be found in the pristine store by its checksum. */
@@ -243,6 +274,7 @@ svn_wc__process_committed_internal(svn_w
svn_boolean_t keep_changelist,
const svn_checksum_t *sha1_checksum,
const svn_wc_committed_queue_t *queue,
+ apr_hash_t *old_externals,
apr_pool_t *scratch_pool)
{
svn_wc__db_kind_t kind;
@@ -251,7 +283,7 @@ svn_wc__process_committed_internal(svn_w
new_revnum, new_date, rev_author,
new_dav_cache,
no_unlock, keep_changelist,
- sha1_checksum,
+ sha1_checksum, old_externals,
scratch_pool));
/* Only check kind after processing the node itself. The node might
@@ -321,7 +353,9 @@ svn_wc__process_committed_internal(svn_w
TRUE /* no_unlock */,
keep_changelist,
sha1_checksum,
- queue, iterpool));
+ queue,
+ old_externals,
+ iterpool));
}
svn_pool_destroy(iterpool);
}
@@ -448,6 +482,10 @@ svn_wc_process_committed_queue2(svn_wc_c
apr_time_t new_date;
apr_hash_t *run_wqs = apr_hash_make(scratch_pool);
apr_hash_index_t *hi;
+ apr_hash_t *old_externals = NULL;
+
+ if (external_func)
+ old_externals = apr_hash_make(scratch_pool);
if (rev_date)
SVN_ERR(svn_time_from_cstring(&new_date, rev_date, iterpool));
@@ -481,6 +519,7 @@ svn_wc_process_committed_queue2(svn_wc_c
cqi->no_unlock,
cqi->keep_changelist,
cqi->sha1_checksum, queue,
+ old_externals,
iterpool));
/* Don't run the wq now, but remember that we must call it for this
@@ -499,6 +538,37 @@ svn_wc_process_committed_queue2(svn_wc_c
SVN_ERR(svn_hash__clear(queue->queue, iterpool));
+ /* Ok; everything is committed now. Now we can start calling callbacks */
+
+ /* Are there changed externals definitions that we should report? */
+ if (old_externals != NULL && apr_hash_count(old_externals) > 0)
+ {
+ for (hi = apr_hash_first(scratch_pool, old_externals);
+ hi;
+ hi = apr_hash_next(hi))
+ {
+ apr_hash_t *node_props;
+ const char *local_abspath = svn__apr_hash_index_key(hi);
+ const svn_string_t *old_val = svn__apr_hash_index_val(hi);
+ const svn_string_t *new_val = NULL;
+
+ svn_pool_clear(iterpool);
+
+ SVN_ERR(svn_wc__db_base_get_props(&node_props, wc_ctx->db,
+ local_abspath,
+ iterpool, iterpool));
+
+ if (node_props)
+ new_val = apr_hash_get(node_props, SVN_PROP_EXTERNALS,
+ APR_HASH_KEY_STRING);
+
+ SVN_ERR(external_func(external_baton, local_abspath,
+ old_val, new_val, svn_depth_unknown,
+ iterpool));
+
+ }
+ }
+
for (hi = apr_hash_first(scratch_pool, run_wqs);
hi;
hi = apr_hash_next(hi))
Modified: subversion/trunk/subversion/libsvn_wc/deprecated.c
URL:
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/deprecated.c?rev=1095118&r1=1095117&r2=1095118&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/deprecated.c (original)
+++ subversion/trunk/subversion/libsvn_wc/deprecated.c Tue Apr 19 15:40:06 2011
@@ -707,7 +707,7 @@ svn_wc_process_committed4(const char *pa
new_revnum, new_date, rev_author,
wcprop_changes_hash,
!remove_lock, !remove_changelist,
- sha1_checksum, NULL, pool));
+ sha1_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));
Modified: subversion/trunk/subversion/libsvn_wc/wc.h
URL:
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/wc.h?rev=1095118&r1=1095117&r2=1095118&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wc.h (original)
+++ subversion/trunk/subversion/libsvn_wc/wc.h Tue Apr 19 15:40:06 2011
@@ -261,6 +261,9 @@ svn_wc__get_committed_queue_pool(const s
* If @a sha1_checksum is non-NULL, use it to identify the node's pristine
* text.
*
+ * If @a old_externals is non-NULL, store the old version of just removed
+ * svn:externals definitions on unshadowed directories in @a old_externals.
+ *
* Set TOP_OF_RECURSE to TRUE to show that this the top of a possibly
* recursive commit operation.
*/
@@ -277,6 +280,7 @@ svn_wc__process_committed_internal(svn_w
svn_boolean_t keep_changelist,
const svn_checksum_t *sha1_checksum,
const svn_wc_committed_queue_t *queue,
+ apr_hash_t *old_externals,
apr_pool_t *scratch_pool);