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

Re: svn commit: r28708 - branches/issue-2897/subversion/libsvn_fs_util

From: David Glasser <glasser_at_davidglasser.net>
Date: Fri, 4 Jan 2008 17:41:48 -0500

On Dec 31, 2007 6:10 AM, <kameshj_at_tigris.org> wrote:
> Author: kameshj
> Date: Mon Dec 31 03:10:38 2007
> New Revision: 28708
>
> Log:
> On the issue-2897 branch:
>
> Make 'commit_and_merge_ranges' to return appropriate mergeinfo
> when inherit == svn_mergeinfo_nearest_ancestor.
>
> * subversion/libsvn_fs_util/mergeinfo-sqlite-index.c
> (construct_rooted_path_segments): Accept 'inherit' and return
> applicable paths.
> (get_commit_and_merge_ranges): Update calls to
> 'construct_rooted_path_segments' as per new signature.
> Remove code that ensures returned records are the ancestors to
> merge_source and merge_target as we already only retrieve the
> relevant ancestor records.
>
> Found by: glasser
>
>
> Modified:
> branches/issue-2897/subversion/libsvn_fs_util/mergeinfo-sqlite-index.c
>
> Modified: branches/issue-2897/subversion/libsvn_fs_util/mergeinfo-sqlite-index.c
> URL: http://svn.collab.net/viewvc/svn/branches/issue-2897/subversion/libsvn_fs_util/mergeinfo-sqlite-index.c?pathrev=28708&r1=28707&r2=28708
> ==============================================================================
> --- branches/issue-2897/subversion/libsvn_fs_util/mergeinfo-sqlite-index.c (original)
> +++ branches/issue-2897/subversion/libsvn_fs_util/mergeinfo-sqlite-index.c Mon Dec 31 03:10:38 2007
> @@ -848,28 +848,47 @@
> }
>
> /*It builds comma seperated paths originating from path which are ancestors of
> - * PATH and PATH itself. Perform all allocations in POOL.
> - * for PATH='/a/b/c/d.html, it generated *ROOTED_PATH_SEGMENTS as
> + * PATH and PATH itself based on INHERIT. Perform all allocations in POOL.
> + * For PATH='/a/b/c/d.html, it generates *ROOTED_PATH_SEGMENTS as follows
> + * based on INHERIT.
> + * If INHERIT == svn_mergeinfo_explicit,
> + * ('/a/b/c/d.html').
> + * If INHERIT == svn_mergeinfo_inherited,
> * ('/a/b/c/d.html', '/a/b/c', '/a/b', '/a', '/').
> + * If INHERIT == svn_mergeinfo_nearest_ancestor,
> + * ('/a/b/c', '/a/b', '/a', '/').
> */
> static void
> construct_rooted_path_segments(svn_stringbuf_t **rooted_path_segments,
> const char *path,
> + svn_mergeinfo_inheritance_t inherit,
> apr_pool_t *pool)
> {
> - svn_stringbuf_t *path_str = svn_stringbuf_create(path, pool);
> *rooted_path_segments = svn_stringbuf_create("(", pool);
> - while (path_str->len > 1)
> - {
> - svn_stringbuf_appendcstr(*rooted_path_segments, "'");
> - svn_stringbuf_appendcstr(*rooted_path_segments, path_str->data);
> - svn_stringbuf_appendcstr(*rooted_path_segments, "',");
> - svn_path_remove_component(path_str);
> - }
> - if (path_str->len)
> + if (inherit == svn_mergeinfo_inherited
> + || inherit == svn_mergeinfo_nearest_ancestor)
> + {
> + svn_stringbuf_t *path_str = svn_stringbuf_create(path, pool);

I wouldn't name a *stringbuf* _str; I'd name it _buf or something.

> + if (inherit == svn_mergeinfo_nearest_ancestor)
> + svn_path_remove_component(path_str);
> + while (path_str->len > 1)
> + {
> + svn_stringbuf_appendcstr(*rooted_path_segments, "'");
> + svn_stringbuf_appendcstr(*rooted_path_segments, path_str->data);
> + svn_stringbuf_appendcstr(*rooted_path_segments, "',");
> + svn_path_remove_component(path_str);
> + }
> + if (path_str->len)
> + {
> + svn_stringbuf_appendcstr(*rooted_path_segments, "'");
> + svn_stringbuf_appendcstr(*rooted_path_segments, path_str->data);
> + svn_stringbuf_appendcstr(*rooted_path_segments, "'");
> + }

Does this if() block do anything?

> + }
> + else if (inherit == svn_mergeinfo_explicit)
> {
> svn_stringbuf_appendcstr(*rooted_path_segments, "'");
> - svn_stringbuf_appendcstr(*rooted_path_segments, path_str->data);
> + svn_stringbuf_appendcstr(*rooted_path_segments, path);
> svn_stringbuf_appendcstr(*rooted_path_segments, "'");
> }
> svn_stringbuf_appendcstr(*rooted_path_segments, ")");
> @@ -928,9 +947,9 @@
> merge_rangelist = apr_array_make(pool, 0, sizeof(svn_merge_range_t *));
>
> construct_rooted_path_segments(&merge_source_where_clause,
> - merge_source, pool);
> + merge_source, inherit, pool);
> construct_rooted_path_segments(&merge_target_where_clause,
> - merge_target, pool);
> + merge_target, inherit, pool);
> query = apr_psprintf(pool, "SELECT revision, mergedrevstart, "
> "mergedrevend, inheritable, mergedfrom, "
> "mergedto FROM mergeinfo_changed "
> @@ -961,21 +980,6 @@
> inheritable = svn_fs__sqlite_column_boolean(stmt, 3);
> mergedfrom = svn_fs__sqlite_column_text(stmt, 4);
> mergedto = svn_fs__sqlite_column_text(stmt, 5);
> - if (get_inherited_mergeinfo)
> - {
> - if ((svn_path_is_ancestor(mergedto, merge_target) == FALSE)
> - || (svn_path_is_ancestor(mergedfrom, merge_source) == FALSE))
> - {
> - SVN_ERR(svn_fs__sqlite_step(&got_row, stmt));
> - continue;
> - }
> - }
> - else if ((strcmp(mergedto, merge_target) != 0)
> - || strcmp(mergedfrom, merge_source) != 0)
> - {
> - SVN_ERR(svn_fs__sqlite_step(&got_row, stmt));
> - continue;
> - }
>
> cur_parent_path = apr_hash_get(rev_target_hash, commit_rev_ptr,
> sizeof(*commit_rev_ptr));
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: svn-unsubscribe_at_subversion.tigris.org
> For additional commands, e-mail: svn-help_at_subversion.tigris.org
>
>

-- 
David Glasser | glasser@davidglasser.net | http://www.davidglasser.net/
---------------------------------------------------------------------
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-04 23:41:59 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.