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

Fix svn_wc__node_get_base_rev() -- don't report the working revision

From: Julian Foad <julianfoad_at_btopenworld.com>
Date: Thu, 12 Apr 2012 14:56:16 +0100 (BST)

This is an obvious fix, right?  But the adjustments needed to a couple of callers are not obvious.

[[[
Fix svn_wc__node_get_base_rev() -- don't report the working revision.
A follow-up to r1088832.

* subversion/libsvn_wc/node.c
  (get_base_rev): If there is no base version, don't report the working
    revision instead, just fail.

* subversion/libsvn_client/copy.c
  (wc_to_repos_copy): If copying from the base rev, query the base rev,
    else ...?
### Unfinished.

* subversion/libsvn_client/mergeinfo.c
  (svn_client__get_wc_mergeinfo): If querying the base rev fails, set the
    local variable to SVN_INVALID_REVNUM.
### This is a behaviour change, in cases where there's no base node but
    there is a working node that has a rev num.--This line, and those below, will be ignored--

Index: subversion/libsvn_wc/node.c
===================================================================
--- subversion/libsvn_wc/node.c    (revision 1325242)
+++ subversion/libsvn_wc/node.c    (working copy)
@@ -879,34 +879,17 @@ svn_wc__node_has_working(svn_boolean_t *
 static svn_error_t *
 get_base_rev(svn_revnum_t *base_revision,
              svn_wc__db_t *db,
              const char *local_abspath,
              apr_pool_t *scratch_pool)
 {
-  svn_boolean_t have_base;
-  svn_error_t *err;
-
-  err = svn_wc__db_base_get_info(NULL, NULL, base_revision, NULL,
-                                 NULL, NULL, NULL, NULL, NULL, NULL, NULL,
-                                 NULL, NULL, NULL, NULL,
-                                 db, local_abspath,
-                                 scratch_pool, scratch_pool);
-
-  if (!err || err->apr_err != SVN_ERR_WC_PATH_NOT_FOUND)
-    return svn_error_trace(err);
-
-  svn_error_clear(err);
-
-  SVN_ERR(svn_wc__db_read_info(NULL, NULL, base_revision,
-                               NULL, NULL, NULL, NULL, NULL, NULL, NULL,
-                               NULL, NULL, NULL, NULL, NULL, NULL, NULL,
-                               NULL, NULL, NULL, &have_base, NULL,
-                               NULL, NULL, NULL, NULL, NULL,
-                               db, local_abspath,
-                               scratch_pool, scratch_pool));
-
+  SVN_ERR(svn_wc__db_base_get_info(NULL, NULL, base_revision, NULL,
+                                   NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+                                   NULL, NULL, NULL, NULL,
+                                   db, local_abspath,
+                                   scratch_pool, scratch_pool));
   return SVN_NO_ERROR;
 }
 
 svn_error_t *
 svn_wc__node_get_base_rev(svn_revnum_t *base_revision,
                           svn_wc_context_t *wc_ctx,

Index: subversion/libsvn_client/copy.c
===================================================================
--- subversion/libsvn_client/copy.c     (revision 1325253)
+++ subversion/libsvn_client/copy.c     (working copy)
@@ -1205,7 +1205,7 @@ wc_to_repos_copy(const apr_array_header_
   iterpool = svn_pool_create(pool);

   /* Verify that all the source paths exist, are versioned, etc.
-     We'll do so by querying the base revisions of those things (which
+     We'll do so by querying the revisions of those things (which
      we'll need to know later anyway). */
   for (i = 0; i < copy_pairs->nelts; i++)
     {
@@ -1213,8 +1213,11 @@ wc_to_repos_copy(const apr_array_header_
                                                     svn_client__copy_pair_t *);
       svn_pool_clear(iterpool);

-      SVN_ERR(svn_wc__node_get_base_rev(&pair->src_revnum, ctx->wc_ctx,
-                                        pair->src_abspath_or_url, iterpool));
+      if (pair->src_peg_revision.kind == svn_opt_revision_base)
+        SVN_ERR(svn_wc__node_get_base_rev(&pair->src_revnum, ctx->wc_ctx,
+                                          pair->src_abspath_or_url, iterpool));
+      else /*if (pair->src_peg_revision.kind == svn_opt_revision_working)*/
+        { SVN_DBG(("%d,%d\n", pair->src_peg_revision.kind, pair->src_op_revision.kind)); }
     }

   /* Determine the longest common ancestor for the destinations, and open an RA
Index: subversion/libsvn_client/mergeinfo.c
===================================================================
--- subversion/libsvn_client/mergeinfo.c        (revision 1325253)
+++ subversion/libsvn_client/mergeinfo.c        (working copy)
@@ -217,8 +217,15 @@ svn_client__get_wc_mergeinfo(svn_mergein
   if (limit_abspath)
     SVN_ERR_ASSERT(svn_dirent_is_absolute(limit_abspath));

-  SVN_ERR(svn_wc__node_get_base_rev(&base_revision, ctx->wc_ctx,
-                                    local_abspath, scratch_pool));
+  {
+    svn_error_t *err = svn_wc__node_get_base_rev(&base_revision, ctx->wc_ctx,
+                                                 local_abspath, scratch_pool);
+    if (err && err->apr_err != SVN_ERR_WC_PATH_NOT_FOUND)
+      SVN_ERR(err);
+
+    svn_error_clear(err);
+    base_revision = SVN_INVALID_REVNUM;
+  }

   iterpool = svn_pool_create(scratch_pool);
   while (TRUE)

(Tests still running.)

- Julian
Received on 2012-04-12 15:56:53 CEST

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.