You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by rh...@apache.org on 2013/02/05 16:44:30 UTC

svn commit: r1442630 - in /subversion/trunk/subversion: include/private/ libsvn_client/ libsvn_wc/ tests/libsvn_wc/

Author: rhuijben
Date: Tue Feb  5 15:44:29 2013
New Revision: 1442630

URL: http://svn.apache.org/viewvc?rev=1442630&view=rev
Log:
Roll svn_wc__node_get_lock_info() into svn_wc__node_get_base(), to avoid
having to do double work in its single caller in a later patch.

* subversion/include/private/svn_wc_private.h
  (svn_wc__node_get_base): Add lock_token argument.

* subversion/libsvn_client/commit_util.c
  (harvest_status_callback): Update caller.

* subversion/libsvn_client/locking_commands.c
  (organize_lock_targets): Update caller.

* subversion/libsvn_client/merge.c
  (calculate_remaining_ranges): Update caller.

* subversion/libsvn_client/mergeinfo.c
  (svn_client__get_wc_mergeinfo): Update caller.

* subversion/libsvn_client/util.c
  (svn_client__wc_node_get_base): Update caller.

* subversion/libsvn_wc/node.c
  (svn_wc__node_get_base): Handle lock_token.
  (svn_wc__node_get_lock_info): Remove function.

* subversion/tests/libsvn_wc/wc-test.c
  (test_node_get_base): Update caller.

Modified:
    subversion/trunk/subversion/include/private/svn_wc_private.h
    subversion/trunk/subversion/libsvn_client/commit_util.c
    subversion/trunk/subversion/libsvn_client/locking_commands.c
    subversion/trunk/subversion/libsvn_client/merge.c
    subversion/trunk/subversion/libsvn_client/mergeinfo.c
    subversion/trunk/subversion/libsvn_client/util.c
    subversion/trunk/subversion/libsvn_wc/node.c
    subversion/trunk/subversion/tests/libsvn_wc/wc-test.c

Modified: subversion/trunk/subversion/include/private/svn_wc_private.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/include/private/svn_wc_private.h?rev=1442630&r1=1442629&r2=1442630&view=diff
==============================================================================
--- subversion/trunk/subversion/include/private/svn_wc_private.h (original)
+++ subversion/trunk/subversion/include/private/svn_wc_private.h Tue Feb  5 15:44:29 2013
@@ -608,14 +608,14 @@ svn_wc__node_has_working(svn_boolean_t *
 /**
  * Get the repository location of the base node at @a local_abspath.
  *
- * Set *REVISION, *REPOS_RELPATH, *REPOS_ROOT_URL and *REPOS_UUID to the
- * location that this node was checked out at or last updated/switched to,
- * regardless of any uncommitted changes (delete, replace and/or
- * copy-here/move-here).
+ * Set *REVISION, *REPOS_RELPATH, *REPOS_ROOT_URL *REPOS_UUID and *LOCK_TOKEN
+ * to the location that this node was checked out at or last updated/switched
+ * to, regardless of any uncommitted changes (delete, replace and/or copy-here/
+ * move-here).
  *
  * If there is no base node at @a local_abspath (such as when there is a
  * locally added/copied/moved-here node that is not part of a replace),
- * return @c SVN_INVALID_REVNUM/NULL/NULL/NULL.
+ * return @c SVN_INVALID_REVNUM/NULL/NULL/NULL/NULL.
  *
  * All output arguments may be NULL.
  *
@@ -627,6 +627,7 @@ svn_wc__node_get_base(svn_revnum_t *revi
                       const char **repos_relpath,
                       const char **repos_root_url,
                       const char **repos_uuid,
+                      const char **lock_token,
                       svn_wc_context_t *wc_ctx,
                       const char *local_abspath,
                       apr_pool_t *result_pool,
@@ -667,30 +668,6 @@ svn_wc__node_get_pre_ng_status_data(svn_
                                     apr_pool_t *scratch_pool);
 
 /**
- * Fetch lock information (if any) for @a local_abspath using @a wc_ctx:
- *
- *   Set @a *lock_token to the lock token (or NULL)
- *   Set @a *lock_owner to the owner of the lock (or NULL)
- *   Set @a *lock_comment to the comment associated with the lock (or NULL)
- *   Set @a *lock_date to the timestamp of the lock (or 0)
- *
- * Any of the aforementioned return values may be NULL to indicate
- * that the caller doesn't care about those values.
- *
- * If @a local_abspath is not in the working copy, return @c
- * SVN_ERR_WC_PATH_NOT_FOUND.
- */
-svn_error_t *
-svn_wc__node_get_lock_info(const char **lock_token,
-                           const char **lock_owner,
-                           const char **lock_comment,
-                           apr_time_t *lock_date,
-                           svn_wc_context_t *wc_ctx,
-                           const char *local_abspath,
-                           apr_pool_t *result_pool,
-                           apr_pool_t *scratch_pool);
-
-/**
  * Acquire a recursive write lock for @a local_abspath.  If @a lock_anchor
  * is true, determine if @a local_abspath has an anchor that should be locked
  * instead; otherwise, @a local_abspath must be a versioned directory.

Modified: subversion/trunk/subversion/libsvn_client/commit_util.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/commit_util.c?rev=1442630&r1=1442629&r2=1442630&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/commit_util.c (original)
+++ subversion/trunk/subversion/libsvn_client/commit_util.c Tue Feb  5 15:44:29 2013
@@ -765,7 +765,7 @@ harvest_status_callback(void *status_bat
       svn_revnum_t dir_rev;
 
       if (!copy_mode_root && !status->switched)
-        SVN_ERR(svn_wc__node_get_base(&dir_rev, NULL, NULL, NULL, wc_ctx,
+        SVN_ERR(svn_wc__node_get_base(&dir_rev, NULL, NULL, NULL, NULL, wc_ctx,
                                       svn_dirent_dirname(local_abspath,
                                                          scratch_pool),
                                       scratch_pool, scratch_pool));

Modified: subversion/trunk/subversion/libsvn_client/locking_commands.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/locking_commands.c?rev=1442630&r1=1442629&r2=1442630&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/locking_commands.c (original)
+++ subversion/trunk/subversion/libsvn_client/locking_commands.c Tue Feb  5 15:44:29 2013
@@ -342,7 +342,7 @@ organize_lock_targets(const char **commo
             {
               svn_revnum_t *revnum;
               revnum = apr_palloc(result_pool, sizeof(* revnum));
-              SVN_ERR(svn_wc__node_get_base(revnum, NULL, NULL, NULL,
+              SVN_ERR(svn_wc__node_get_base(revnum, NULL, NULL, NULL, NULL,
                                             ctx->wc_ctx, abs_path,
                                             result_pool, iterpool));
               apr_hash_set(rel_targets_ret, rel_url,
@@ -355,10 +355,10 @@ organize_lock_targets(const char **commo
               /* If not forcing the unlock, get the lock token. */
               if (! force)
                 {
-                  SVN_ERR(svn_wc__node_get_lock_info(&lock_token, NULL, NULL,
-                                                     NULL, ctx->wc_ctx,
-                                                     abs_path, result_pool,
-                                                     iterpool));
+                  SVN_ERR(svn_wc__node_get_base(NULL, NULL, NULL, NULL,
+                                                &lock_token,
+                                                ctx->wc_ctx, abs_path,
+                                                result_pool, iterpool));
                   if (! lock_token)
                     return svn_error_createf(
                                SVN_ERR_CLIENT_MISSING_LOCK_TOKEN, NULL,

Modified: subversion/trunk/subversion/libsvn_client/merge.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/merge.c?rev=1442630&r1=1442629&r2=1442630&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/merge.c (original)
+++ subversion/trunk/subversion/libsvn_client/merge.c Tue Feb  5 15:44:29 2013
@@ -4431,7 +4431,7 @@ calculate_remaining_ranges(svn_client__m
      So in the name of user friendliness, return an error suggesting a helpful
      course of action.
   */
-  SVN_ERR(svn_wc__node_get_base(&child_base_revision, NULL, NULL, NULL,
+  SVN_ERR(svn_wc__node_get_base(&child_base_revision, NULL, NULL, NULL, NULL,
                                 ctx->wc_ctx, child->abspath,
                                 scratch_pool, scratch_pool));
   /* If CHILD has no base revision then it hasn't been committed yet, so it

Modified: subversion/trunk/subversion/libsvn_client/mergeinfo.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/mergeinfo.c?rev=1442630&r1=1442629&r2=1442630&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/mergeinfo.c (original)
+++ subversion/trunk/subversion/libsvn_client/mergeinfo.c Tue Feb  5 15:44:29 2013
@@ -217,8 +217,8 @@ 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(&base_revision, NULL, NULL, NULL, ctx->wc_ctx,
-                                local_abspath,
+  SVN_ERR(svn_wc__node_get_base(&base_revision, NULL, NULL, NULL, NULL,
+                                ctx->wc_ctx, local_abspath,
                                 scratch_pool, scratch_pool));
 
   iterpool = svn_pool_create(scratch_pool);
@@ -287,7 +287,7 @@ svn_client__get_wc_mergeinfo(svn_mergein
           local_abspath = svn_dirent_dirname(local_abspath, scratch_pool);
 
           SVN_ERR(svn_wc__node_get_base(&parent_base_rev, NULL, NULL, NULL,
-                                        ctx->wc_ctx, local_abspath,
+                                        NULL, ctx->wc_ctx, local_abspath,
                                         scratch_pool, scratch_pool));
           SVN_ERR(svn_wc__node_get_changed_info(&parent_changed_rev,
                                                 NULL, NULL,

Modified: subversion/trunk/subversion/libsvn_client/util.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/util.c?rev=1442630&r1=1442629&r2=1442630&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/util.c (original)
+++ subversion/trunk/subversion/libsvn_client/util.c Tue Feb  5 15:44:29 2013
@@ -183,6 +183,7 @@ svn_client__wc_node_get_base(svn_client_
                                 &relpath,
                                 &(*base_p)->repos_root_url,
                                 &(*base_p)->repos_uuid,
+                                NULL,
                                 wc_ctx, wc_abspath,
                                 result_pool, scratch_pool));
   if ((*base_p)->repos_root_url && relpath)

Modified: subversion/trunk/subversion/libsvn_wc/node.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/node.c?rev=1442630&r1=1442629&r2=1442630&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/node.c (original)
+++ subversion/trunk/subversion/libsvn_wc/node.c Tue Feb  5 15:44:29 2013
@@ -661,16 +661,19 @@ svn_wc__node_get_base(svn_revnum_t *revi
                       const char **repos_relpath,
                       const char **repos_root_url,
                       const char **repos_uuid,
+                      const char **lock_token,
                       svn_wc_context_t *wc_ctx,
                       const char *local_abspath,
                       apr_pool_t *result_pool,
                       apr_pool_t *scratch_pool)
 {
   svn_error_t *err;
+  svn_wc__db_lock_t *lock;
 
   err = svn_wc__db_base_get_info(NULL, NULL, revision, repos_relpath,
                                  repos_root_url, repos_uuid, NULL,
-                                 NULL, NULL, NULL, NULL, NULL, NULL,
+                                 NULL, NULL, NULL, NULL, NULL,
+                                 lock_token ? &lock : NULL,
                                  NULL, NULL, NULL,
                                  wc_ctx->db, local_abspath,
                                  result_pool, scratch_pool);
@@ -685,10 +688,15 @@ svn_wc__node_get_base(svn_revnum_t *revi
         *repos_root_url = NULL;
       if (repos_uuid)
         *repos_uuid = NULL;
+      if (lock_token)
+        *lock_token = NULL;
       return SVN_NO_ERROR;
     }
   SVN_ERR(err);
 
+  if (lock_token)
+    *lock_token = lock ? lock->token : NULL;
+
   SVN_ERR_ASSERT(!revision || SVN_IS_VALID_REVNUM(*revision));
   SVN_ERR_ASSERT(!repos_relpath || *repos_relpath);
   SVN_ERR_ASSERT(!repos_root_url || *repos_root_url);
@@ -745,45 +753,6 @@ svn_wc__node_get_pre_ng_status_data(svn_
 }
 
 svn_error_t *
-svn_wc__node_get_lock_info(const char **lock_token,
-                           const char **lock_owner,
-                           const char **lock_comment,
-                           apr_time_t *lock_date,
-                           svn_wc_context_t *wc_ctx,
-                           const char *local_abspath,
-                           apr_pool_t *result_pool,
-                           apr_pool_t *scratch_pool)
-{
-  svn_wc__db_lock_t *lock;
-  svn_error_t *err;
-
-  err = svn_wc__db_base_get_info(NULL, NULL, NULL, NULL, NULL, NULL, NULL,
-                                 NULL, NULL, NULL, NULL, NULL, &lock, NULL,
-                                 NULL, NULL,
-                                 wc_ctx->db, local_abspath,
-                                 result_pool, scratch_pool);
-
-  if (err)
-    {
-      if (err->apr_err != SVN_ERR_WC_PATH_NOT_FOUND)
-        return svn_error_trace(err);
-
-      svn_error_clear(err);
-      lock = NULL;
-    }
-  if (lock_token)
-    *lock_token = lock ? lock->token : NULL;
-  if (lock_owner)
-    *lock_owner = lock ? lock->owner : NULL;
-  if (lock_comment)
-    *lock_comment = lock ? lock->comment : NULL;
-  if (lock_date)
-    *lock_date = lock ? lock->date : 0;
-
-  return SVN_NO_ERROR;
-}
-
-svn_error_t *
 svn_wc__internal_node_get_schedule(svn_wc_schedule_t *schedule,
                                    svn_boolean_t *copied,
                                    svn_wc__db_t *db,

Modified: subversion/trunk/subversion/tests/libsvn_wc/wc-test.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/libsvn_wc/wc-test.c?rev=1442630&r1=1442629&r2=1442630&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/libsvn_wc/wc-test.c (original)
+++ subversion/trunk/subversion/tests/libsvn_wc/wc-test.c Tue Feb  5 15:44:29 2013
@@ -135,6 +135,7 @@ test_node_get_base(const svn_test_opts_t
 
         SVN_ERR(svn_wc__node_get_base(&revision, &repos_relpath,
                                       &repos_root_url, &repos_uuid,
+                                      NULL,
                                       b->wc_ctx, local_abspath,
                                       b->pool, b->pool));
         SVN_TEST_ASSERT(revision == subtest->base_rev);