[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: [PATCH] Fix issue #3020

From: Kamesh Jayachandran <kamesh_at_collab.net>
Date: Mon, 21 Jan 2008 21:02:28 +0530

Hi Senthil,

Patch looks fine.

Recently(Since this patch) 'SVN_PROP_MERGE_INFO' has been renamed to 'SVN_PROP_MERGEINFO'.

Have that incorporated and commit.

My +1 to commit.

With regards
Kamesh Jayachandran

Senthil Kumaran S wrote:
> Hi,
>
> I am attaching a patch along with this email in order to fix issue
> #3020. This patch is based on r27845 since we need almost the same
> functionality in 'svnadmin load'.
>
> [[[
> Fix issue #3020.
>
> Reflect dropped/renumbered revisions in svn:mergeinfo data during
> svnadmin load
>
> * subversion/tests/cmdline/svnadmin_tests.py
> (load_with_parent_dir): Modify test case expectation for svn:mergeinfo
>
> * subversion/libsvn_repos/load.c
> (): include private/svn_mergeinfo_private.h
> (renumber_mergeinfo_revs): New function to renumber svn:mergeinfo
> (set_node_property): If we have svn:mergeinfo then renumber revs in
> svn:mergeinfo as appropriate
>
> Patch by: Senthil Kumaran <senthil_at_collab.net>
> ]]]
>
> ------------------------------------------------------------------------
>
> Index: subversion/tests/cmdline/svnadmin_tests.py
> ===================================================================
> --- subversion/tests/cmdline/svnadmin_tests.py (revision 28113)
> +++ subversion/tests/cmdline/svnadmin_tests.py (working copy)
> @@ -481,13 +481,13 @@
> # Verify the svn:mergeinfo properties for '--parent-dir'
> svntest.actions.run_and_verify_svn(None,
> [sbox.repo_url +
> - "/sample/branch - /sample/trunk:4-6\n"],
> + "/sample/branch - /sample/trunk:5-7\n"],
> [], 'propget', 'svn:mergeinfo', '-R',
> sbox.repo_url + '/sample/branch')
> svntest.actions.run_and_verify_svn(None,
> [sbox.repo_url +
> "/sample/branch1 - " +
> - "/sample/branch:5-8\n"],
> + "/sample/branch:6-9\n"],
> [], 'propget', 'svn:mergeinfo', '-R',
> sbox.repo_url + '/sample/branch1')
>
> Index: subversion/libsvn_repos/load.c
> ===================================================================
> --- subversion/libsvn_repos/load.c (revision 28113)
> +++ subversion/libsvn_repos/load.c (working copy)
> @@ -31,6 +31,7 @@
>
> #include <apr_lib.h>
>
> +#include "private/svn_mergeinfo_private.h"
>
> /*----------------------------------------------------------------------*/
>
> @@ -263,6 +264,63 @@
> return SVN_NO_ERROR;
> }
>
> +/* Examine the mergeinfo in INITIAL_VAL, renumber revisions in rangelists
> + as appropriate, and return the (possibly new) mergeinfo in *FINAL_VAL
> + (allocated from POOL). */
> +static svn_error_t *
> +renumber_mergeinfo_revs(svn_string_t **final_val,
> + const svn_string_t *initial_val,
> + struct revision_baton *rb,
> + apr_pool_t *pool)
> +{
> + apr_hash_t *mergeinfo;
> + apr_hash_t *final_mergeinfo = apr_hash_make(pool);
> + apr_hash_index_t *hi;
> + apr_pool_t *subpool = svn_pool_create(pool);
> +
> + SVN_ERR(svn_mergeinfo_parse(&mergeinfo, initial_val->data, subpool));
> + for (hi = apr_hash_first(NULL, mergeinfo); hi; hi = apr_hash_next(hi))
> + {
> + const char *merge_source;
> + apr_array_header_t *rangelist;
> + struct parse_baton *pb = rb->pb;
> + int i;
> + const void *key;
> + void *val;
> +
> + apr_hash_this(hi, &key, NULL, &val);
> + merge_source = (const char *) key;
> + rangelist = (apr_array_header_t *) val;
> +
> + /* Possibly renumber revisions in merge source's rangelist. */
> + for (i = 0; i < rangelist->nelts; i++)
> + {
> + svn_revnum_t *rev_from_map;
> + svn_merge_range_t *range = APR_ARRAY_IDX(rangelist, i,
> + svn_merge_range_t *);
> +
> + if ((rev_from_map = apr_hash_get(pb->rev_map, &range->start,
> + sizeof(svn_revnum_t))))
> + if (SVN_IS_VALID_REVNUM(*rev_from_map))
> + range->start = *rev_from_map;;
> +
> + if ((rev_from_map = apr_hash_get(pb->rev_map, &range->end,
> + sizeof(svn_revnum_t))))
> + if (SVN_IS_VALID_REVNUM(*rev_from_map))
> + range->end = *rev_from_map;
> + }
> + apr_hash_set(final_mergeinfo, merge_source,
> + APR_HASH_KEY_STRING, rangelist);
> + }
> +
> + SVN_ERR(svn_mergeinfo_sort(final_mergeinfo, subpool));
> + SVN_ERR(svn_mergeinfo__to_string(final_val, final_mergeinfo, pool));
> + svn_pool_destroy(subpool);
> +
> + return SVN_NO_ERROR;
> +}
> +
> +
> /* Read CONTENT_LENGTH bytes from STREAM, parsing the bytes as an
> encoded Subversion properties hash, and making multiple calls to
> PARSE_FNS->set_*_property on RECORD_BATON (depending on the value
> @@ -1134,14 +1192,22 @@
> struct revision_baton *rb = nb->rb;
> const char *parent_dir = rb->pb->parent_dir;
>
> - if (parent_dir && strcmp(name, SVN_PROP_MERGE_INFO) == 0)
> + if (strcmp(name, SVN_PROP_MERGE_INFO) == 0)
> {
> - /* Prefix the merge source paths with PARENT_DIR. */
> - /* ASSUMPTION: All source paths are included in the dump stream. */
> - const char *mergeinfo_val;
> - SVN_ERR(prefix_mergeinfo_paths(&mergeinfo_val, value->data,
> - parent_dir, nb->pool));
> - value = svn_string_create(mergeinfo_val, nb->pool);
> + /* Renumber mergeinfo as appropriate. */
> + svn_string_t *renumbered_mergeinfo;
> + SVN_ERR(renumber_mergeinfo_revs(&renumbered_mergeinfo, value, rb,
> + nb->pool));
> + value = renumbered_mergeinfo;
> + if (parent_dir)
> + {
> + /* Prefix the merge source paths with PARENT_DIR. */
> + /* ASSUMPTION: All source paths are included in the dump stream. */
> + const char *mergeinfo_val;
> + SVN_ERR(prefix_mergeinfo_paths(&mergeinfo_val, value->data,
> + parent_dir, nb->pool));
> + value = svn_string_create(mergeinfo_val, nb->pool);
> + }
> }
>
> SVN_ERR(svn_fs_change_node_prop(rb->txn_root, nb->path,
>
>
> ------------------------------------------------------------------------
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe_at_subversion.tigris.org
> For additional commands, e-mail: dev-help_at_subversion.tigris.org

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe_at_subversion.tigris.org
For additional commands, e-mail: dev-help_at_subversion.tigris.org
Received on 2008-01-21 16:33:01 CET

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.