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 2018/01/22 14:00:03 UTC
svn commit: r1821865 - in /subversion/branches/shelve-checkpoint: ./
subversion/include/svn_client.h subversion/libsvn_client/shelf.c
subversion/svn/shelf-cmd.c subversion/svn/svn.c
tools/client-side/bash_completion
Author: julianfoad
Date: Mon Jan 22 14:00:03 2018
New Revision: 1821865
URL: http://svn.apache.org/viewvc?rev=1821865&view=rev
Log:
On the 'shelve-checkpoint' branch: Catch up with trunk@1821863.
Modified:
subversion/branches/shelve-checkpoint/ (props changed)
subversion/branches/shelve-checkpoint/subversion/include/svn_client.h
subversion/branches/shelve-checkpoint/subversion/libsvn_client/shelf.c
subversion/branches/shelve-checkpoint/subversion/svn/shelf-cmd.c
subversion/branches/shelve-checkpoint/subversion/svn/svn.c
subversion/branches/shelve-checkpoint/tools/client-side/bash_completion
Propchange: subversion/branches/shelve-checkpoint/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Mon Jan 22 14:00:03 2018
@@ -98,4 +98,4 @@
/subversion/branches/verify-at-commit:1462039-1462408
/subversion/branches/verify-keep-going:1439280-1546110
/subversion/branches/wc-collate-path:1402685-1480384
-/subversion/trunk:1801593-1821680
+/subversion/trunk:1801593-1821863
Modified: subversion/branches/shelve-checkpoint/subversion/include/svn_client.h
URL: http://svn.apache.org/viewvc/subversion/branches/shelve-checkpoint/subversion/include/svn_client.h?rev=1821865&r1=1821864&r2=1821865&view=diff
==============================================================================
--- subversion/branches/shelve-checkpoint/subversion/include/svn_client.h (original)
+++ subversion/branches/shelve-checkpoint/subversion/include/svn_client.h Mon Jan 22 14:00:03 2018
@@ -6715,9 +6715,9 @@ svn_client_cat(svn_stream_t *out,
-/** Shelves and checkpoints
+/** Shelving v2, with checkpoints
*
- * @defgroup svn_client_shelve_checkpoint Shelves and checkpoints
+ * @defgroup svn_client_shelves_checkpoints Shelves and checkpoints
* @{
*/
@@ -6869,7 +6869,7 @@ svn_client_shelf_unapply(svn_client_shel
*/
SVN_EXPERIMENTAL
svn_error_t *
-svn_client_shelf_get_patch_abspath(char **patch_abspath,
+svn_client_shelf_get_patch_abspath(const char **patch_abspath,
svn_client_shelf_version_t *shelf_version,
apr_pool_t *scratch_pool);
@@ -6952,19 +6952,157 @@ svn_client_shelf_list(apr_hash_t **shelf
/** @} */
-/** Changelist commands
+/** Shelving v1
*
- * @defgroup svn_client_changelist_funcs Client Changelist Functions
+ * @defgroup svn_client_shelve_funcs Client Shelving Functions
* @{
*/
-/** Implementation note:
+/** Shelve a change.
+ *
+ * Shelve as @a name the local modifications found by @a paths, @a depth,
+ * @a changelists. Revert the shelved change from the WC unless @a keep_local
+ * is true.
+ *
+ * If @a dry_run is true, don't actually do it.
+ *
+ * @since New in 1.10.
+ * @warning EXPERIMENTAL.
+ */
+SVN_EXPERIMENTAL
+svn_error_t *
+svn_client_shelve(const char *name,
+ const apr_array_header_t *paths,
+ svn_depth_t depth,
+ const apr_array_header_t *changelists,
+ svn_boolean_t keep_local,
+ svn_boolean_t dry_run,
+ svn_client_ctx_t *ctx,
+ apr_pool_t *pool);
+
+/** Unshelve the shelved change @a name.
+ *
+ * @a local_abspath is any path in the WC and is used to find the WC root.
+ * Rename the shelved patch to add a '.bak' extension unless @a keep is true.
+ *
+ * If @a dry_run is true, don't actually do it.
+ *
+ * @since New in 1.10.
+ * @warning EXPERIMENTAL.
+ */
+SVN_EXPERIMENTAL
+svn_error_t *
+svn_client_unshelve(const char *name,
+ const char *local_abspath,
+ svn_boolean_t keep,
+ svn_boolean_t dry_run,
+ svn_client_ctx_t *ctx,
+ apr_pool_t *pool);
+
+/** Delete the shelved patch @a name.
+ *
+ * @a local_abspath is any path in the WC and is used to find the WC root.
+ *
+ * If @a dry_run is true, don't actually do it.
+ *
+ * @since New in 1.10.
+ * @warning EXPERIMENTAL.
+ */
+SVN_EXPERIMENTAL
+svn_error_t *
+svn_client_shelves_delete(const char *name,
+ const char *local_abspath,
+ svn_boolean_t dry_run,
+ svn_client_ctx_t *ctx,
+ apr_pool_t *pool);
+
+/** Information about a shelved patch.
*
- * For now, changelists are implemented by scattering the
- * associations across multiple .svn/entries files in a working copy.
- * However, this client API was written so that we have the option of
- * changing the underlying implementation -- we may someday want to
- * store changelist definitions in a centralized database.
+ * @since New in 1.10.
+ * @warning EXPERIMENTAL.
+ */
+typedef struct svn_client_shelved_patch_info_t
+{
+ const char *message; /* first line of log message */
+ const char *patch_path; /* abspath of the patch file */
+ svn_io_dirent2_t *dirent; /* info about the patch file */
+ apr_time_t mtime; /* a copy of dirent->mtime */
+} svn_client_shelved_patch_info_t;
+
+/** Set @a *shelved_patch_infos to a hash, keyed by patch name, of pointers to
+ * @c svn_client_shelved_patch_info_t structures.
+ *
+ * @a local_abspath is any path in the WC and is used to find the WC root.
+ *
+ * @since New in 1.10.
+ * @warning EXPERIMENTAL.
+ */
+SVN_EXPERIMENTAL
+svn_error_t *
+svn_client_shelves_list(apr_hash_t **shelved_patch_infos,
+ const char *local_abspath,
+ svn_client_ctx_t *ctx,
+ apr_pool_t *result_pool,
+ apr_pool_t *scratch_pool);
+
+/** Set @a *any_shelved to indicate if there are any shelved changes in this WC.
+ *
+ * This shall provide the answer fast, regardless of how many changes
+ * are stored, unlike svn_client_shelves_list().
+ *
+ * ### Initial implementation isn't O(1) fast -- it just calls
+ * svn_client_shelves_list().
+ *
+ * @a local_abspath is any path in the WC and is used to find the WC root.
+ *
+ * @since New in 1.10.
+ * @warning EXPERIMENTAL.
+ */
+SVN_EXPERIMENTAL
+svn_error_t *
+svn_client_shelves_any(svn_boolean_t *any_shelved,
+ const char *local_abspath,
+ svn_client_ctx_t *ctx,
+ apr_pool_t *scratch_pool);
+
+/** Set @a *affected_paths to a hash with one entry for each path affected
+ * by the shelf @a name. The hash key is the old path and value is
+ * the new path, both relative to the WC root. The key and value are the
+ * same except when a path is moved or copied.
+ *
+ * @since New in 1.10.
+ * @warning EXPERIMENTAL.
+ */
+SVN_EXPERIMENTAL
+svn_error_t *
+svn_client_shelf_get_paths(apr_hash_t **affected_paths,
+ const char *name,
+ const char *local_abspath,
+ svn_client_ctx_t *ctx,
+ apr_pool_t *result_pool,
+ apr_pool_t *scratch_pool);
+
+/** Set @a *has_changes to indicate whether the shelf @a name
+ * contains any modifications, in other words if svn_client_shelf_get_paths()
+ * would return a non-empty set of paths.
+ *
+ * @since New in 1.10.
+ * @warning EXPERIMENTAL.
+ */
+SVN_EXPERIMENTAL
+svn_error_t *
+svn_client_shelf_has_changes(svn_boolean_t *has_changes,
+ const char *name,
+ const char *local_abspath,
+ svn_client_ctx_t *ctx,
+ apr_pool_t *scratch_pool);
+
+/** @} */
+
+/** Changelist commands
+ *
+ * @defgroup svn_client_changelist_funcs Client Changelist Functions
+ * @{
*/
/**
Modified: subversion/branches/shelve-checkpoint/subversion/libsvn_client/shelf.c
URL: http://svn.apache.org/viewvc/subversion/branches/shelve-checkpoint/subversion/libsvn_client/shelf.c?rev=1821865&r1=1821864&r2=1821865&view=diff
==============================================================================
--- subversion/branches/shelve-checkpoint/subversion/libsvn_client/shelf.c (original)
+++ subversion/branches/shelve-checkpoint/subversion/libsvn_client/shelf.c Mon Jan 22 14:00:03 2018
@@ -541,7 +541,7 @@ svn_client_shelf_set_current_version(svn
}
svn_error_t *
-svn_client_shelf_get_patch_abspath(char **patch_abspath,
+svn_client_shelf_get_patch_abspath(const char **patch_abspath,
svn_client_shelf_version_t *shelf_version,
apr_pool_t *scratch_pool)
{
Modified: subversion/branches/shelve-checkpoint/subversion/svn/shelf-cmd.c
URL: http://svn.apache.org/viewvc/subversion/branches/shelve-checkpoint/subversion/svn/shelf-cmd.c?rev=1821865&r1=1821864&r2=1821865&view=diff
==============================================================================
--- subversion/branches/shelve-checkpoint/subversion/svn/shelf-cmd.c (original)
+++ subversion/branches/shelve-checkpoint/subversion/svn/shelf-cmd.c Mon Jan 22 14:00:03 2018
@@ -78,7 +78,7 @@ show_diffstat(svn_client_shelf_version_t
apr_pool_t *scratch_pool)
{
#ifndef WIN32
- char *patch_abspath;
+ const char *patch_abspath;
int result;
SVN_ERR(svn_client_shelf_get_patch_abspath(&patch_abspath, shelf_version,
@@ -299,8 +299,8 @@ run_status_on_wc_paths(const char *paths
for (i = 0; i < paths->nelts; i++)
{
const char *path = APR_ARRAY_IDX(paths, i, const char *);
- const char *abspath = svn_path_join(paths_base_abspath, path,
- scratch_pool);
+ const char *abspath = svn_dirent_join(paths_base_abspath, path,
+ scratch_pool);
SVN_ERR(svn_client_status6(NULL /*result_rev*/,
ctx, abspath,
@@ -517,8 +517,8 @@ check_no_modified_paths(const char *path
for (hi = apr_hash_first(scratch_pool, paths); hi; hi = apr_hash_next(hi))
{
const char *path = apr_hash_this_key(hi);
- const char *abspath = svn_path_join(paths_base_abspath, path,
- scratch_pool);
+ const char *abspath = svn_dirent_join(paths_base_abspath, path,
+ scratch_pool);
SVN_ERR(svn_client_status6(NULL /*result_rev*/,
ctx, abspath,
Modified: subversion/branches/shelve-checkpoint/subversion/svn/svn.c
URL: http://svn.apache.org/viewvc/subversion/branches/shelve-checkpoint/subversion/svn/svn.c?rev=1821865&r1=1821864&r2=1821865&view=diff
==============================================================================
--- subversion/branches/shelve-checkpoint/subversion/svn/svn.c (original)
+++ subversion/branches/shelve-checkpoint/subversion/svn/svn.c Mon Jan 22 14:00:03 2018
@@ -61,6 +61,8 @@
#include "svn_private_config.h"
+/*#define WITH_SHELVE_V1*/
+
/*** Option Processing ***/
/* Add an identifier here for long options that don't have a short
@@ -145,7 +147,10 @@ typedef enum svn_cl__longopt_t {
opt_pin_externals,
opt_show_item,
opt_adds_as_modification,
- opt_vacuum_pristines
+ opt_vacuum_pristines,
+ opt_delete,
+ opt_keep_shelved,
+ opt_list
} svn_cl__longopt_t;
@@ -471,6 +476,12 @@ const apr_getopt_option_t svn_cl__option
{"vacuum-pristines", opt_vacuum_pristines, 0,
N_("remove unreferenced pristines from .svn directory")},
+#ifdef WITH_SHELVE_V1
+ {"list", opt_list, 0, N_("list shelved patches")},
+ {"keep-shelved", opt_keep_shelved, 0, N_("do not delete the shelved patch")},
+ {"delete", opt_delete, 0, N_("delete the shelved patch")},
+#endif
+
/* Long-opt Aliases
*
* These have NULL desriptions, but an option code that matches some
@@ -1683,6 +1694,7 @@ const svn_opt_subcommand_desc2_t svn_cl_
" the output of 'svn help merge' for 'undo'.\n"),
{opt_targets, 'R', opt_depth, 'q', opt_changelist} },
+#ifndef WITH_SHELVE_V1
{ "shelf-diff", svn_cl__shelf_diff, {0}, N_
("Show shelved changes as a diff.\n"
"usage: shelf-diff NAME [VERSION]\n"
@@ -1794,6 +1806,75 @@ const svn_opt_subcommand_desc2_t svn_cl_
" in the next release, and there is no promise of backward compatibility.\n"
),
{'q', opt_dry_run} },
+#else
+ { "shelve", svn_cl__shelve, {0}, N_
+ ("Put a local change aside, as if putting it on a shelf.\n"
+ "usage: 1. shelve [--keep-local] NAME [PATH...]\n"
+ " 2. shelve --delete NAME\n"
+ " 3. shelve --list\n"
+ "\n"
+ " 1. Save the local change in the given PATHs to a patch file, and\n"
+ " revert that change from the WC unless '--keep-local' is given.\n"
+ " If a log message is given with '-m' or '-F', include it at the\n"
+ " beginning of the patch file.\n"
+ "\n"
+ " 2. Delete the shelved change NAME.\n"
+ " (A backup is kept, named with a '.bak' extension.)\n"
+ "\n"
+ " 3. List shelved changes. Include the first line of any log message\n"
+ " and some details about the contents of the change, unless '-q' is\n"
+ " given.\n"
+ "\n"
+ " The kinds of change you can shelve are those supported by 'svn diff'\n"
+ " and 'svn patch'. The following are currently NOT supported:\n"
+ " mergeinfo changes, copies, moves, mkdir, rmdir,\n"
+ " 'binary' content, uncommittable states\n"
+ "\n"
+ " To bring back a shelved change, use 'svn unshelve NAME'.\n"
+ "\n"
+ " A shelved change is stored as a patch file, .svn/shelves/NAME.patch\n"
+ "\n"
+ " The shelving feature is EXPERIMENTAL. This command is likely to change\n"
+ " in the next release, and there is no promise of backward compatibility.\n"
+ ),
+ {opt_delete, opt_list, 'q', opt_dry_run, opt_keep_local,
+ opt_depth, opt_targets, opt_changelist,
+ /* almost SVN_CL__LOG_MSG_OPTIONS but not currently opt_with_revprop: */
+ 'm', 'F', opt_force_log, opt_editor_cmd, opt_encoding,
+ } },
+
+ { "unshelve", svn_cl__unshelve, {0}, N_
+ ("Bring a shelved change back to a local change in the WC.\n"
+ "usage: 1. unshelve [--keep-shelved] [NAME]\n"
+ " 2. unshelve --list\n"
+ "\n"
+ " 1. Apply the shelved change NAME to the working copy.\n"
+ " Delete the patch unless the '--keep-shelved' option is given.\n"
+ " (A backup is kept, named with a '.bak' extension.)\n"
+ " NAME defaults to the most recent shelved change.\n"
+ "\n"
+ " 2. List shelved changes. Include the first line of any log message\n"
+ " and some details about the contents of the change, unless '-q' is\n"
+ " given.\n"
+ "\n"
+ " Any conflict between the change being unshelved and a change\n"
+ " already in the WC is handled the same way as by 'svn patch',\n"
+ " creating a 'reject' file.\n"
+ "\n"
+ " The shelving feature is EXPERIMENTAL. This command is likely to change\n"
+ " in the next release, and there is no promise of backward compatibility.\n"
+ ),
+ {opt_keep_shelved, opt_list, 'q', opt_dry_run} },
+
+ { "shelves", svn_cl__shelves, {0}, N_
+ ("List shelved changes.\n"
+ "usage: shelves\n"
+ "\n"
+ " The shelving feature is EXPERIMENTAL. This command is likely to change\n"
+ " in the next release, and there is no promise of backward compatibility.\n"
+ ),
+ {'q'} },
+#endif
{ "status", svn_cl__status, {"stat", "st"}, N_
("Print the status of working copy files and directories.\n"
@@ -2345,6 +2426,9 @@ sub_main(int *exit_code, int argc, const
case opt_dry_run:
opt_state.dry_run = TRUE;
break;
+ case opt_list:
+ opt_state.list = TRUE;
+ break;
case opt_revprop:
opt_state.revprop = TRUE;
break;
@@ -2528,6 +2612,7 @@ sub_main(int *exit_code, int argc, const
opt_state.diff.summarize = TRUE;
break;
case opt_remove:
+ case opt_delete:
opt_state.remove = TRUE;
break;
case opt_changelist:
@@ -2543,6 +2628,7 @@ sub_main(int *exit_code, int argc, const
opt_state.keep_changelists = TRUE;
break;
case opt_keep_local:
+ case opt_keep_shelved:
opt_state.keep_local = TRUE;
break;
case opt_with_all_revprops:
@@ -3056,8 +3142,13 @@ sub_main(int *exit_code, int argc, const
|| subcommand->cmd_func == svn_cl__move
|| subcommand->cmd_func == svn_cl__lock
|| subcommand->cmd_func == svn_cl__propedit
+#ifndef WITH_SHELVE_V1
|| subcommand->cmd_func == svn_cl__shelf_save
- || subcommand->cmd_func == svn_cl__shelf_shelve))
+ || subcommand->cmd_func == svn_cl__shelf_shelve
+#else
+ || subcommand->cmd_func == svn_cl__shelve
+#endif
+ ))
{
/* If the -F argument is a file that's under revision control,
that's probably not what the user intended. */
Modified: subversion/branches/shelve-checkpoint/tools/client-side/bash_completion
URL: http://svn.apache.org/viewvc/subversion/branches/shelve-checkpoint/tools/client-side/bash_completion?rev=1821865&r1=1821864&r2=1821865&view=diff
==============================================================================
--- subversion/branches/shelve-checkpoint/tools/client-side/bash_completion (original)
+++ subversion/branches/shelve-checkpoint/tools/client-side/bash_completion Mon Jan 22 14:00:03 2018
@@ -248,8 +248,8 @@ _svn()
cmds="$cmds patch propdel pdel propedit pedit propget pget proplist"
cmds="$cmds plist propset pset relocate resolve resolved revert status"
cmds="$cmds switch unlock update upgrade"
- cmds="$cmds shelf-diff shelf-drop shelf-list shelf-log"
- cmds="$cmds shelf-save shelve shelves unshelve"
+ cmds="$cmds shelf-diff shelf-drop shelf-list shelf-log shelf-save"
+ cmds="$cmds shelve shelves unshelve"
# help options have a strange command status...
local helpOpts='--help -h'