You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by ju...@apache.org on 2017/08/29 16:12:32 UTC

svn commit: r1806617 - in /subversion/branches/shelve/subversion: include/svn_client.h libsvn_client/shelve.c libsvn_wc/wcroot_anchor.c svn/shelve-cmd.c

Author: julianfoad
Date: Tue Aug 29 16:12:31 2017
New Revision: 1806617

URL: http://svn.apache.org/viewvc?rev=1806617&view=rev
Log:
On the 'shelve' branch: Rename some function arguments and variables for
clarity. In particular, drop the term 'shelf name'.

Modified:
    subversion/branches/shelve/subversion/include/svn_client.h
    subversion/branches/shelve/subversion/libsvn_client/shelve.c
    subversion/branches/shelve/subversion/libsvn_wc/wcroot_anchor.c
    subversion/branches/shelve/subversion/svn/shelve-cmd.c

Modified: subversion/branches/shelve/subversion/include/svn_client.h
URL: http://svn.apache.org/viewvc/subversion/branches/shelve/subversion/include/svn_client.h?rev=1806617&r1=1806616&r2=1806617&view=diff
==============================================================================
--- subversion/branches/shelve/subversion/include/svn_client.h (original)
+++ subversion/branches/shelve/subversion/include/svn_client.h Tue Aug 29 16:12:31 2017
@@ -6726,7 +6726,7 @@ svn_client_cat(svn_stream_t *out,
  * @since New in 1.11.
  */
 svn_error_t *
-svn_client_shelve(const char *shelf_name,
+svn_client_shelve(const char *name,
                   const apr_array_header_t *paths,
                   svn_depth_t depth,
                   const apr_array_header_t *changelists,
@@ -6740,7 +6740,7 @@ svn_client_shelve(const char *shelf_name
  * @since New in 1.11.
  */
 svn_error_t *
-svn_client_unshelve(const char *shelf_name,
+svn_client_unshelve(const char *name,
                     const char *local_abspath,
                     svn_boolean_t keep,
                     svn_boolean_t dry_run,
@@ -6752,7 +6752,7 @@ svn_client_unshelve(const char *shelf_na
  * @since New in 1.11.
  */
 svn_error_t *
-svn_client_shelves_delete(const char *shelf_name,
+svn_client_shelves_delete(const char *name,
                           const char *local_abspath,
                           svn_boolean_t dry_run,
                           svn_client_ctx_t *ctx,
@@ -6769,14 +6769,14 @@ svn_client_shelves_list(apr_hash_t **dir
                         apr_pool_t *result_pool,
                         apr_pool_t *scratch_pool);
 
-/** Write local changes to a patch file at @a shelf_name.
+/** Write local changes to a patch file at @a name.
  *
  * @a wc_root_abspath: The WC root dir.
  * @a overwrite_existing: If a file at @a patch_abspath exists, overwrite it.
  * @a paths, @a depth, @a changelists: The selection of local paths to diff.
  */
 svn_error_t *
-svn_client_shelf_write_patch(const char *shelf_name,
+svn_client_shelf_write_patch(const char *name,
                              const char *message,
                              const char *wc_root_abspath,
                              svn_boolean_t overwrite_existing,
@@ -6786,26 +6786,26 @@ svn_client_shelf_write_patch(const char
                              svn_client_ctx_t *ctx,
                              apr_pool_t *scratch_pool);
 
-/** Apply the patch file at @a shelf_name to the WC.
+/** Apply the patch file at @a name to the WC.
  *
  * @a wc_root_abspath: The WC root dir.
  * @a reverse: Apply the patch in reverse.
  * @a dry_run: Don't really apply the changes, just notify what would be done.
  */
 svn_error_t *
-svn_client_shelf_apply_patch(const char *shelf_name,
+svn_client_shelf_apply_patch(const char *name,
                              const char *wc_root_abspath,
                              svn_boolean_t reverse,
                              svn_boolean_t dry_run,
                              svn_client_ctx_t *ctx,
                              apr_pool_t *scratch_pool);
 
-/** Delete the patch file at @a shelf_name.
+/** Delete the patch file at @a name.
  *
  * @a wc_root_abspath: The WC root dir.
  */
 svn_error_t *
-svn_client_shelf_delete_patch(const char *shelf_name,
+svn_client_shelf_delete_patch(const char *name,
                               const char *wc_root_abspath,
                               svn_client_ctx_t *ctx,
                               apr_pool_t *scratch_pool);

Modified: subversion/branches/shelve/subversion/libsvn_client/shelve.c
URL: http://svn.apache.org/viewvc/subversion/branches/shelve/subversion/libsvn_client/shelve.c?rev=1806617&r1=1806616&r2=1806617&view=diff
==============================================================================
--- subversion/branches/shelve/subversion/libsvn_client/shelve.c (original)
+++ subversion/branches/shelve/subversion/libsvn_client/shelve.c Tue Aug 29 16:12:31 2017
@@ -42,12 +42,12 @@
 
 /*  */
 static svn_error_t *
-validate_shelf_name(const char *shelf_name,
-                    apr_pool_t *scratch_pool)
+validate_name(const char *name,
+              apr_pool_t *scratch_pool)
 {
-  if (shelf_name[0] == '\0' || strchr(shelf_name, '/'))
+  if (name[0] == '\0' || strchr(name, '/'))
     return svn_error_createf(SVN_ERR_BAD_CHANGELIST_NAME, NULL,
-                             _("Shelve: Bad name '%s'"), shelf_name);
+                             _("Shelve: Bad name '%s'"), name);
 
   return SVN_NO_ERROR;
 }
@@ -55,7 +55,7 @@ validate_shelf_name(const char *shelf_na
 /*  */
 static svn_error_t *
 get_patch_abspath(char **patch_abspath,
-                  const char *shelf_name,
+                  const char *name,
                   const char *wc_root_abspath,
                   svn_client_ctx_t *ctx,
                   apr_pool_t *result_pool,
@@ -66,13 +66,13 @@ get_patch_abspath(char **patch_abspath,
 
   SVN_ERR(svn_wc__get_shelves_dir(&dir, ctx->wc_ctx, wc_root_abspath,
                                   scratch_pool, scratch_pool));
-  filename = apr_pstrcat(scratch_pool, shelf_name, ".patch", SVN_VA_NULL);
+  filename = apr_pstrcat(scratch_pool, name, ".patch", SVN_VA_NULL);
   *patch_abspath = svn_dirent_join(dir, filename, result_pool);
   return SVN_NO_ERROR;
 }
 
 svn_error_t *
-svn_client_shelf_write_patch(const char *shelf_name,
+svn_client_shelf_write_patch(const char *name,
                              const char *message,
                              const char *wc_root_abspath,
                              svn_boolean_t overwrite_existing,
@@ -93,9 +93,9 @@ svn_client_shelf_write_patch(const char
   svn_opt_revision_t start_revision = {svn_opt_revision_base, {0}};
   svn_opt_revision_t end_revision = {svn_opt_revision_working, {0}};
 
-  printf("writing '%s.patch'\n", shelf_name);
+  printf("writing '%s.patch'\n", name);
 
-  SVN_ERR(get_patch_abspath(&patch_abspath, shelf_name, wc_root_abspath,
+  SVN_ERR(get_patch_abspath(&patch_abspath, name, wc_root_abspath,
                             ctx, scratch_pool, scratch_pool));
 
   /* Get streams for the output and any error output of the diff. */
@@ -158,7 +158,7 @@ svn_client_shelf_write_patch(const char
 }
 
 svn_error_t *
-svn_client_shelf_apply_patch(const char *shelf_name,
+svn_client_shelf_apply_patch(const char *name,
                              const char *wc_root_abspath,
                              svn_boolean_t reverse,
                              svn_boolean_t dry_run,
@@ -167,7 +167,7 @@ svn_client_shelf_apply_patch(const char
 {
   char *patch_abspath;
 
-  SVN_ERR(get_patch_abspath(&patch_abspath, shelf_name, wc_root_abspath,
+  SVN_ERR(get_patch_abspath(&patch_abspath, name, wc_root_abspath,
                             ctx, scratch_pool, scratch_pool));
   SVN_ERR(svn_client_patch(patch_abspath, wc_root_abspath,
                            dry_run, 0 /*strip*/,
@@ -180,14 +180,14 @@ svn_client_shelf_apply_patch(const char
 }
 
 svn_error_t *
-svn_client_shelf_delete_patch(const char *shelf_name,
+svn_client_shelf_delete_patch(const char *name,
                               const char *wc_root_abspath,
                               svn_client_ctx_t *ctx,
                               apr_pool_t *scratch_pool)
 {
   char *patch_abspath, *to_abspath;
 
-  SVN_ERR(get_patch_abspath(&patch_abspath, shelf_name, wc_root_abspath,
+  SVN_ERR(get_patch_abspath(&patch_abspath, name, wc_root_abspath,
                             ctx, scratch_pool, scratch_pool));
   to_abspath = apr_pstrcat(scratch_pool, patch_abspath, ".bak", SVN_VA_NULL);
 
@@ -196,14 +196,14 @@ svn_client_shelf_delete_patch(const char
                               scratch_pool));
 
   /* move the patch to a backup file */
-  printf("moving '%s.patch' to '%s.patch.bak'\n", shelf_name, shelf_name);
+  printf("moving '%s.patch' to '%s.patch.bak'\n", name, name);
   SVN_ERR(svn_io_file_rename2(patch_abspath, to_abspath, FALSE /*flush_to_disk*/,
                               scratch_pool));
   return SVN_NO_ERROR;
 }
 
 svn_error_t *
-svn_client_shelve(const char *shelf_name,
+svn_client_shelve(const char *name,
                   const apr_array_header_t *paths,
                   svn_depth_t depth,
                   const apr_array_header_t *changelists,
@@ -217,7 +217,7 @@ svn_client_shelve(const char *shelf_name
   const char *message = "";
   svn_error_t *err;
 
-  SVN_ERR(validate_shelf_name(shelf_name, pool));
+  SVN_ERR(validate_name(name, pool));
 
   /* ### TODO: check all paths are in same WC; for now use first path */
   SVN_ERR(svn_dirent_get_absolute(&local_abspath,
@@ -237,7 +237,7 @@ svn_client_shelve(const char *shelf_name
         return SVN_NO_ERROR;
     }
 
-  err = svn_client_shelf_write_patch(shelf_name, message, wc_root_abspath,
+  err = svn_client_shelf_write_patch(name, message, wc_root_abspath,
                                      FALSE /*overwrite_existing*/,
                                      paths, depth, changelists,
                                      ctx, pool);
@@ -245,7 +245,7 @@ svn_client_shelve(const char *shelf_name
     {
       return svn_error_quick_wrapf(err,
                                    "Shelved change '%s' already exists",
-                                   shelf_name);
+                                   name);
     }
   else
     SVN_ERR(err);
@@ -254,14 +254,14 @@ svn_client_shelve(const char *shelf_name
     {
       /* Reverse-apply the patch. This should be a safer way to remove those
          changes from the WC than running a 'revert' operation. */
-      SVN_ERR(svn_client_shelf_apply_patch(shelf_name, wc_root_abspath,
+      SVN_ERR(svn_client_shelf_apply_patch(name, wc_root_abspath,
                                            TRUE /*reverse*/, dry_run,
                                            ctx, pool));
     }
 
   if (dry_run)
     {
-      SVN_ERR(svn_client_shelf_delete_patch(shelf_name, wc_root_abspath,
+      SVN_ERR(svn_client_shelf_delete_patch(name, wc_root_abspath,
                                             ctx, pool));
     }
 
@@ -269,7 +269,7 @@ svn_client_shelve(const char *shelf_name
 }
 
 svn_error_t *
-svn_client_unshelve(const char *shelf_name,
+svn_client_unshelve(const char *name,
                     const char *local_abspath,
                     svn_boolean_t keep,
                     svn_boolean_t dry_run,
@@ -279,20 +279,20 @@ svn_client_unshelve(const char *shelf_na
   const char *wc_root_abspath;
   svn_error_t *err;
 
-  SVN_ERR(validate_shelf_name(shelf_name, pool));
+  SVN_ERR(validate_name(name, pool));
 
   SVN_ERR(svn_client_get_wc_root(&wc_root_abspath,
                                  local_abspath, ctx, pool, pool));
 
   /* Apply the patch. */
-  err = svn_client_shelf_apply_patch(shelf_name, wc_root_abspath,
+  err = svn_client_shelf_apply_patch(name, wc_root_abspath,
                                      FALSE /*reverse*/, dry_run,
                                      ctx, pool);
   if (err && err->apr_err == SVN_ERR_ILLEGAL_TARGET)
     {
       return svn_error_quick_wrapf(err,
                                    "Shelved change '%s' not found",
-                                   shelf_name);
+                                   name);
     }
   else
     SVN_ERR(err);
@@ -300,7 +300,7 @@ svn_client_unshelve(const char *shelf_na
   /* Remove the patch. */
   if (! keep && ! dry_run)
     {
-      SVN_ERR(svn_client_shelf_delete_patch(shelf_name, wc_root_abspath,
+      SVN_ERR(svn_client_shelf_delete_patch(name, wc_root_abspath,
                                             ctx, pool));
     }
 
@@ -308,7 +308,7 @@ svn_client_unshelve(const char *shelf_na
 }
 
 svn_error_t *
-svn_client_shelves_delete(const char *shelf_name,
+svn_client_shelves_delete(const char *name,
                           const char *local_abspath,
                           svn_boolean_t dry_run,
                           svn_client_ctx_t *ctx,
@@ -316,7 +316,7 @@ svn_client_shelves_delete(const char *sh
 {
   const char *wc_root_abspath;
 
-  SVN_ERR(validate_shelf_name(shelf_name, pool));
+  SVN_ERR(validate_name(name, pool));
 
   SVN_ERR(svn_client_get_wc_root(&wc_root_abspath,
                                  local_abspath, ctx, pool, pool));
@@ -326,13 +326,13 @@ svn_client_shelves_delete(const char *sh
     {
       svn_error_t *err;
 
-      err = svn_client_shelf_delete_patch(shelf_name, wc_root_abspath,
+      err = svn_client_shelf_delete_patch(name, wc_root_abspath,
                                           ctx, pool);
       if (err && APR_STATUS_IS_ENOENT(err->apr_err))
         {
           return svn_error_quick_wrapf(err,
                                        "Shelved change '%s' not found",
-                                       shelf_name);
+                                       name);
         }
       else
         SVN_ERR(err);

Modified: subversion/branches/shelve/subversion/libsvn_wc/wcroot_anchor.c
URL: http://svn.apache.org/viewvc/subversion/branches/shelve/subversion/libsvn_wc/wcroot_anchor.c?rev=1806617&r1=1806616&r2=1806617&view=diff
==============================================================================
--- subversion/branches/shelve/subversion/libsvn_wc/wcroot_anchor.c (original)
+++ subversion/branches/shelve/subversion/libsvn_wc/wcroot_anchor.c Tue Aug 29 16:12:31 2017
@@ -189,11 +189,11 @@ svn_wc__get_shelves_dir(char **dir,
                         apr_pool_t *result_pool,
                         apr_pool_t *scratch_pool)
 {
-  const char *wc_adm_dir;
+  const char *wcroot_abspath;
 
-  SVN_ERR(svn_wc__get_wcroot(&wc_adm_dir, wc_ctx, local_abspath,
+  SVN_ERR(svn_wc__get_wcroot(&wcroot_abspath, wc_ctx, local_abspath,
                              scratch_pool, scratch_pool));
-  *dir = svn_dirent_join(wc_adm_dir, ".svn/shelves", result_pool);
+  *dir = svn_dirent_join(wcroot_abspath, ".svn/shelves", result_pool);
   
   /* Ensure the directory exists. (Other versions of svn don't create it.) */
   SVN_ERR(svn_io_make_dir_recursively(*dir, scratch_pool));

Modified: subversion/branches/shelve/subversion/svn/shelve-cmd.c
URL: http://svn.apache.org/viewvc/subversion/branches/shelve/subversion/svn/shelve-cmd.c?rev=1806617&r1=1806616&r2=1806617&view=diff
==============================================================================
--- subversion/branches/shelve/subversion/svn/shelve-cmd.c (original)
+++ subversion/branches/shelve/subversion/svn/shelve-cmd.c Tue Aug 29 16:12:31 2017
@@ -32,17 +32,17 @@
 #include "svn_private_config.h"
 
 
-/* First argument should be the name of a shelve. */
+/* First argument should be the name of a shelved change. */
 static svn_error_t *
-get_shelf_name(const char **shelf_name,
-               apr_getopt_t *os,
-               apr_pool_t *result_pool,
-               apr_pool_t *scratch_pool)
+get_name(const char **name,
+         apr_getopt_t *os,
+         apr_pool_t *result_pool,
+         apr_pool_t *scratch_pool)
 {
   apr_array_header_t *args;
 
   SVN_ERR(svn_opt_parse_num_args(&args, os, 1, scratch_pool));
-  SVN_ERR(svn_utf_cstring_to_utf8(shelf_name,
+  SVN_ERR(svn_utf_cstring_to_utf8(name,
                                   APR_ARRAY_IDX(args, 0, const char *),
                                   result_pool));
   return SVN_NO_ERROR;
@@ -127,7 +127,7 @@ svn_cl__shelve(apr_getopt_t *os,
   svn_cl__opt_state_t *opt_state = ((svn_cl__cmd_baton_t *) baton)->opt_state;
   svn_client_ctx_t *ctx = ((svn_cl__cmd_baton_t *) baton)->ctx;
   const char *local_abspath;
-  const char *shelf_name;
+  const char *name;
   apr_array_header_t *targets;
 
   if (opt_state->quiet)
@@ -146,18 +146,18 @@ svn_cl__shelve(apr_getopt_t *os,
       return SVN_NO_ERROR;
     }
 
-  SVN_ERR(get_shelf_name(&shelf_name, os, pool, pool));
+  SVN_ERR(get_name(&name, os, pool, pool));
 
   if (opt_state->remove)
     {
       if (os->ind < os->argc)
         return svn_error_create(SVN_ERR_CL_ARG_PARSING_ERROR, 0, NULL);
 
-      SVN_ERR(svn_client_shelves_delete(shelf_name, local_abspath,
+      SVN_ERR(svn_client_shelves_delete(name, local_abspath,
                                         opt_state->dry_run,
                                         ctx, pool));
       if (! opt_state->quiet)
-        SVN_ERR(svn_cmdline_printf(pool, "deleted '%s'\n", shelf_name));
+        SVN_ERR(svn_cmdline_printf(pool, "deleted '%s'\n", name));
       return SVN_NO_ERROR;
     }
 
@@ -187,7 +187,7 @@ svn_cl__shelve(apr_getopt_t *os,
         SVN_ERR(svn_cl__make_log_msg_baton(&ctx->log_msg_baton3,
                                            opt_state, NULL, ctx->config,
                                            pool));
-      err = svn_client_shelve(shelf_name,
+      err = svn_client_shelve(name,
                               targets, depth, opt_state->changelists,
                               opt_state->keep_local, opt_state->dry_run,
                               ctx, pool);
@@ -198,7 +198,7 @@ svn_cl__shelve(apr_getopt_t *os,
         SVN_ERR(err);
 
       if (! opt_state->quiet)
-        SVN_ERR(svn_cmdline_printf(pool, "shelved '%s'\n", shelf_name));
+        SVN_ERR(svn_cmdline_printf(pool, "shelved '%s'\n", name));
   }
 
   return SVN_NO_ERROR;
@@ -213,7 +213,7 @@ svn_cl__unshelve(apr_getopt_t *os,
   svn_cl__opt_state_t *opt_state = ((svn_cl__cmd_baton_t *) baton)->opt_state;
   svn_client_ctx_t *ctx = ((svn_cl__cmd_baton_t *) baton)->ctx;
   const char *local_abspath;
-  const char *shelf_name;
+  const char *name;
   apr_array_header_t *targets;
 
   SVN_ERR(svn_dirent_get_absolute(&local_abspath, "", pool));
@@ -229,7 +229,7 @@ svn_cl__unshelve(apr_getopt_t *os,
       return SVN_NO_ERROR;
     }
 
-  SVN_ERR(get_shelf_name(&shelf_name, os, pool, pool));
+  SVN_ERR(get_name(&name, os, pool, pool));
 
   /* There should be no remaining arguments. */
   SVN_ERR(svn_cl__args_to_target_array_print_reserved(&targets, os,
@@ -241,11 +241,11 @@ svn_cl__unshelve(apr_getopt_t *os,
   if (opt_state->quiet)
     ctx->notify_func2 = NULL; /* Easy out: avoid unneeded work */
 
-  SVN_ERR(svn_client_unshelve(shelf_name, local_abspath,
+  SVN_ERR(svn_client_unshelve(name, local_abspath,
                               opt_state->keep_local, opt_state->dry_run,
                               ctx, pool));
   if (! opt_state->quiet)
-    SVN_ERR(svn_cmdline_printf(pool, "unshelved '%s'\n", shelf_name));
+    SVN_ERR(svn_cmdline_printf(pool, "unshelved '%s'\n", name));
 
   return SVN_NO_ERROR;
 }