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

[PATCH] [merge-tracking-branch] Use appropriate path value for svn_ra_get_merge_info()

From: Madan U Sreenivasan <madan_at_collab.net>
Date: 2006-07-24 15:35:19 CEST

Hi,

    Pl. find attached a follow-up to r20808. This code calculates the
relative path to the target dir, from the repos root and uses that as
input (the 'paths' parameter) to the svn_ra_get_merge_info() call.

    Pl. note that I removed the following comment.
- /* ### TODO: Add target_wcpath to the list. Later, we may need to
- ### list all child paths as well. */

     The first stated goal has been accomplished by this patch. The second
sentence, IMHO is not correct, as there can be only one target path. Pl.
correct me if am wrong.

    Pl. find log and patch attached.

Regards,
Madan.

Index: subversion/libsvn_client/diff.c
===================================================================
--- subversion/libsvn_client/diff.c (revision 20836)
+++ subversion/libsvn_client/diff.c (working copy)
@@ -1948,6 +1948,7 @@
   const char *URL1, *URL2, *path1, *path2, *rel_path;
   svn_opt_revision_t *revision1, *revision2;
   int i;
+ const char *target_url, *repos_root, *relative_path;
 
   ENSURE_VALID_REVISION_KINDS(initial_revision1->kind,
                               initial_revision2->kind);
@@ -2010,10 +2011,24 @@
   /* Retrieve any inherited or direct merge info for the target from
      both the repos and the WC's merge info prop. Combine these two
      sets of merge info to determine what's already been merged into
- the target. */
- mergeinfo_paths = apr_array_make(pool, 1, sizeof(target_wcpath));
- /* ### TODO: Add target_wcpath to the list. Later, we may need to
- ### list all child paths as well. */
+ the target.
+
+ But first, get the relative path of the working copy
+ wrt repos root */
+ SVN_ERR(svn_client_url_from_path(&target_url, target_wcpath, pool));
+ if (! target_url)
+ return svn_error_createf(SVN_ERR_ENTRY_MISSING_URL, NULL,
+ _("'%s' has no URL"),
+ svn_path_local_style(target_wcpath, pool));
+ SVN_ERR(svn_ra_get_repos_root(ra_session, &repos_root, pool));
+ if(strlen(repos_root) < strlen(target_url))
+ relative_path = target_url + strlen(repos_root);
+
+ relative_path = svn_path_canonicalize(relative_path, pool);
+
+ mergeinfo_paths = apr_array_make(pool, 1, sizeof(char *));
+ APR_ARRAY_PUSH(mergeinfo_paths, const char *) = relative_path;
+
   SVN_ERR(svn_ra_get_merge_info(ra_session, &repos_mergeinfo, mergeinfo_paths,
                                 SVN_INVALID_REVNUM, TRUE, pool));
   SVN_ERR(parse_merge_info(&target_mergeinfo, target_wcpath, adm_access, ctx,
@@ -2153,6 +2168,7 @@
   svn_boolean_t is_revert;
   apr_hash_t *target_mergeinfo, *repos_mergeinfo;
   int i;
+ const char *target_url, *repos_root, *relative_path;
 
   ENSURE_VALID_REVISION_KINDS(initial_revision1->kind,
                               initial_revision2->kind);
@@ -2208,10 +2224,24 @@
   /* Retrieve any inherited or direct merge info for the target from
      both the repos and the WC's merge info prop. Combine these two
      sets of merge info to determine what's already been merged into
- the target. */
- mergeinfo_paths = apr_array_make(pool, 1, sizeof(target_wcpath));
- /* ### TODO: Add target_wcpath to the list. Later, we may need to
- ### list all child paths as well. */
+ the target.
+
+ But first, get the relative path of the working copy
+ wrt repos root */
+ SVN_ERR(svn_client_url_from_path(&target_url, target_wcpath, pool));
+ if (! target_url)
+ return svn_error_createf(SVN_ERR_ENTRY_MISSING_URL, NULL,
+ _("'%s' has no URL"),
+ svn_path_local_style(target_wcpath, pool));
+ SVN_ERR(svn_ra_get_repos_root(ra_session1, &repos_root, pool));
+ if(strlen(repos_root) < strlen(target_url))
+ relative_path = target_url + strlen(repos_root);
+
+ relative_path = svn_path_canonicalize(relative_path, pool);
+
+ mergeinfo_paths = apr_array_make(pool, 1, sizeof(char *));
+ APR_ARRAY_PUSH(mergeinfo_paths, const char *) = relative_path;
+
   SVN_ERR(svn_ra_get_merge_info(ra_session1, &repos_mergeinfo, mergeinfo_paths,
                                 SVN_INVALID_REVNUM, TRUE, pool));
   SVN_ERR(parse_merge_info(&target_mergeinfo, target_wcpath, adm_access, ctx,

Use appropriate input path for svn_ra_get_merge_info().

On the merge-tracking branch:

* subversion/libsvn_client/diff.c
  (do_single_file_merge, do_merge): Fill the target path, relative to the
   repos root into the mergeinfo_path variable before calling
   svn_ra_get_merge_info.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Mon Jul 24 15:05:21 2006

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.