Author: julianfoad
Date: Tue Nov 14 16:03:34 2017
New Revision: 1815228
URL: http://svn.apache.org/viewvc?rev=1815228&view=rev
Log:
Merge the 'shelve' branch to trunk (dropping BRANCH-README).
Added:
subversion/trunk/subversion/libsvn_client/shelve.c
- copied unchanged from r1815226,
subversion/branches/shelve/subversion/libsvn_client/shelve.c
subversion/trunk/subversion/svn/shelve-cmd.c
- copied unchanged from r1815226,
subversion/branches/shelve/subversion/svn/shelve-cmd.c
Modified:
subversion/trunk/ (props changed)
subversion/trunk/subversion/include/private/svn_wc_private.h
subversion/trunk/subversion/include/svn_client.h
subversion/trunk/subversion/libsvn_subr/utf8proc/ (props changed)
subversion/trunk/subversion/libsvn_wc/wcroot_anchor.c
subversion/trunk/subversion/svn/cl.h
subversion/trunk/subversion/svn/svn.c
subversion/trunk/subversion/tests/cmdline/getopt_tests_data/svn--help_stdout
subversion/trunk/subversion/tests/cmdline/getopt_tests_data/svn_help_stdout
subversion/trunk/tools/client-side/bash_completion
Propchange: subversion/trunk/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Nov 14 16:03:34 2017
@@ -75,6 +75,8 @@
/subversion/branches/revprop-cache:1298521-1326293
/subversion/branches/revprop-caching-ng:1620597,1620599
/subversion/branches/revprop-packing:1143907,1143971,1143997,1144017,1144499,1144568,1146145
+/subversion/branches/shelve:1802592-1815226
+/subversion/branches/shelve-checkpoint:1801593-1801923,1801970
/subversion/branches/subtree-mergeinfo:876734-878766
/subversion/branches/svn-auth-x509:1603509-1655900
/subversion/branches/svn-info-detail:1660035-1662618
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=1815228&r1=1815227&r2=1815228&view=diff
==============================================================================
--- subversion/trunk/subversion/include/private/svn_wc_private.h (original)
+++ subversion/trunk/subversion/include/private/svn_wc_private.h Tue Nov 14
16:03:34 2017
@@ -348,6 +348,19 @@ svn_wc__get_wcroot(const char **wcroot_a
apr_pool_t *result_pool,
apr_pool_t *scratch_pool);
+/** Set @a *dir to the abspath of the directory in which shelved patches
+ * are stored, which is inside the WC's administrative directory, and ensure
+ * the directory exists.
+ *
+ * @a local_abspath is any path in the WC, and is used to find the WC root.
+ */
+svn_error_t *
+svn_wc__get_shelves_dir(char **dir,
+ svn_wc_context_t *wc_ctx,
+ const char *local_abspath,
+ apr_pool_t *result_pool,
+ apr_pool_t *scratch_pool);
+
/**
* The following are temporary APIs to aid in the transition from wc-1 to
* wc-ng. Use them for new development now, but they may be disappearing
Modified: subversion/trunk/subversion/include/svn_client.h
URL:
http://svn.apache.org/viewvc/subversion/trunk/subversion/include/svn_client.h?rev=1815228&r1=1815227&r2=1815228&view=diff
==============================================================================
--- subversion/trunk/subversion/include/svn_client.h (original)
+++ subversion/trunk/subversion/include/svn_client.h Tue Nov 14 16:03:34 2017
@@ -6715,6 +6715,152 @@ svn_client_cat(svn_stream_t *out,
+/** Shelving commands
+ *
+ * @defgroup svn_client_shelve_funcs Client Shelving Functions
+ * @{
+ */
+
+/** 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.11.
+ */
+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.11.
+ */
+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.11.
+ */
+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.
+ *
+ * @since New in 1.11.
+ */
+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 *shelved_patches 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.11.
+ */
+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.11.
+ */
+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);
+
+/** Write local changes to a patch file for shelved change @a name.
+ *
+ * @a message: An optional log message.
+ * @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 *name,
+ const char *message,
+ const char *wc_root_abspath,
+ svn_boolean_t overwrite_existing,
+ const apr_array_header_t *paths,
+ svn_depth_t depth,
+ const apr_array_header_t *changelists,
+ svn_client_ctx_t *ctx,
+ apr_pool_t *scratch_pool);
+
+/** Apply the patch file for shelved change @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 *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 for shelved change @a name.
+ *
+ * @a wc_root_abspath: The WC root dir.
+ */
+svn_error_t *
+svn_client_shelf_delete_patch(const char *name,
+ const char *wc_root_abspath,
+ svn_client_ctx_t *ctx,
+ apr_pool_t *scratch_pool);
+
+/** @} */
+
/** Changelist commands
*
* @defgroup svn_client_changelist_funcs Client Changelist Functions
Propchange: subversion/trunk/subversion/libsvn_subr/utf8proc/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Nov 14 16:03:34 2017
@@ -75,6 +75,8 @@
/subversion/branches/revprop-cache/subversion/libsvn_subr/utf8proc:1298521-1326293
/subversion/branches/revprop-caching-ng/subversion/libsvn_subr/utf8proc:1620597,1620599
/subversion/branches/revprop-packing/subversion/libsvn_subr/utf8proc:1143907,1143971,1143997,1144017,1144499,1144568,1146145
+/subversion/branches/shelve/subversion/libsvn_subr/utf8proc:1802592-1815226
+/subversion/branches/shelve-checkpoint/subversion/libsvn_subr/utf8proc:1801593-1801923,1801970
/subversion/branches/subtree-mergeinfo/subversion/libsvn_subr/utf8proc:876734-878766
/subversion/branches/svn-auth-x509/subversion/libsvn_subr/utf8proc:1603509-1655900
/subversion/branches/svn-info-detail/subversion/libsvn_subr/utf8proc:1660035-1662618
@@ -96,5 +98,5 @@
/subversion/branches/uris-as-urls/subversion/libsvn_subr/utf8proc:1060426-1064427
/subversion/branches/verify-at-commit/subversion/libsvn_subr/utf8proc:1462039-1462408
/subversion/branches/verify-keep-going/subversion/libsvn_subr/utf8proc:1439280-1546110
-/subversion/branches/wc-collate-path/subversion/libsvn_subr/utf8proc:1402685-1480384
+/subversion/branches/wc-collate-path/subversion/libsvn_subr/utf8proc:1402685-1405765
/subversion/upstream/utf8proc:1405750-1809082
Modified: subversion/trunk/subversion/libsvn_wc/wcroot_anchor.c
URL:
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/wcroot_anchor.c?rev=1815228&r1=1815227&r2=1815228&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wcroot_anchor.c (original)
+++ subversion/trunk/subversion/libsvn_wc/wcroot_anchor.c Tue Nov 14 16:03:34
2017
@@ -183,6 +183,26 @@ svn_wc__get_wcroot(const char **wcroot_a
svn_error_t *
+svn_wc__get_shelves_dir(char **dir,
+ svn_wc_context_t *wc_ctx,
+ const char *local_abspath,
+ apr_pool_t *result_pool,
+ apr_pool_t *scratch_pool)
+{
+ const char *wcroot_abspath;
+
+ SVN_ERR(svn_wc__get_wcroot(&wcroot_abspath, wc_ctx, local_abspath,
+ scratch_pool, scratch_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));
+
+ return SVN_NO_ERROR;
+}
+
+
+svn_error_t *
svn_wc_get_actual_target2(const char **anchor,
const char **target,
svn_wc_context_t *wc_ctx,
Modified: subversion/trunk/subversion/svn/cl.h
URL:
http://svn.apache.org/viewvc/subversion/trunk/subversion/svn/cl.h?rev=1815228&r1=1815227&r2=1815228&view=diff
==============================================================================
--- subversion/trunk/subversion/svn/cl.h (original)
+++ subversion/trunk/subversion/svn/cl.h Tue Nov 14 16:03:34 2017
@@ -255,6 +255,7 @@ typedef struct svn_cl__opt_state_t
const char *show_item; /* print only the given item */
svn_boolean_t adds_as_modification; /* update 'add vs add' no tree conflict
*/
svn_boolean_t vacuum_pristines; /* remove unreferenced pristines */
+ svn_boolean_t list;
} svn_cl__opt_state_t;
/* Conflict stats for operations such as update and merge. */
@@ -302,6 +303,9 @@ svn_opt_subcommand_t
svn_cl__revert,
svn_cl__resolve,
svn_cl__resolved,
+ svn_cl__shelve,
+ svn_cl__unshelve,
+ svn_cl__shelves,
svn_cl__status,
svn_cl__switch,
svn_cl__unlock,
Modified: subversion/trunk/subversion/svn/svn.c
URL:
http://svn.apache.org/viewvc/subversion/trunk/subversion/svn/svn.c?rev=1815228&r1=1815227&r2=1815228&view=diff
==============================================================================
--- subversion/trunk/subversion/svn/svn.c (original)
+++ subversion/trunk/subversion/svn/svn.c Tue Nov 14 16:03:34 2017
@@ -145,6 +145,9 @@ typedef enum svn_cl__longopt_t {
opt_show_item,
opt_adds_as_modification,
opt_vacuum_pristines,
+ opt_delete,
+ opt_keep_shelved,
+ opt_list
} svn_cl__longopt_t;
@@ -465,6 +468,10 @@ const apr_getopt_option_t svn_cl__option
{"vacuum-pristines", opt_vacuum_pristines, 0,
N_("remove unreferenced pristines from .svn
directory")},
+ {"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")},
+
/* Long-opt Aliases
*
* These have NULL desriptions, but an option code that matches some
@@ -1648,6 +1655,64 @@ 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} },
+ { "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"
+ ),
+ {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"
+ ),
+ {opt_keep_shelved, opt_list, 'q', opt_dry_run} },
+
+ { "shelves", svn_cl__shelves, {0}, N_
+ ("List shelved changes.\n"
+ "usage: shelves\n"),
+ },
+
{ "status", svn_cl__status, {"stat", "st"}, N_
("Print the status of working copy files and directories.\n"
"usage: status [PATH...]\n"
@@ -2197,6 +2262,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;
@@ -2377,6 +2445,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:
@@ -2392,6 +2461,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:
@@ -2896,7 +2966,8 @@ sub_main(int *exit_code, int argc, const
|| subcommand->cmd_func == svn_cl__mkdir
|| subcommand->cmd_func == svn_cl__move
|| subcommand->cmd_func == svn_cl__lock
- || subcommand->cmd_func == svn_cl__propedit))
+ || subcommand->cmd_func == svn_cl__propedit
+ || subcommand->cmd_func == svn_cl__shelve))
{
/* If the -F argument is a file that's under revision control,
that's probably not what the user intended. */
Modified:
subversion/trunk/subversion/tests/cmdline/getopt_tests_data/svn--help_stdout
URL:
http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/getopt_tests_data/svn--help_stdout?rev=1815228&r1=1815227&r2=1815228&view=diff
==============================================================================
---
subversion/trunk/subversion/tests/cmdline/getopt_tests_data/svn--help_stdout
(original)
+++
subversion/trunk/subversion/tests/cmdline/getopt_tests_data/svn--help_stdout
Tue Nov 14 16:03:34 2017
@@ -42,6 +42,9 @@ Available subcommands:
resolve
resolved
revert
+ shelve
+ unshelve
+ shelves
status (stat, st)
switch (sw)
unlock
Modified:
subversion/trunk/subversion/tests/cmdline/getopt_tests_data/svn_help_stdout
URL:
http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/getopt_tests_data/svn_help_stdout?rev=1815228&r1=1815227&r2=1815228&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/cmdline/getopt_tests_data/svn_help_stdout
(original)
+++ subversion/trunk/subversion/tests/cmdline/getopt_tests_data/svn_help_stdout
Tue Nov 14 16:03:34 2017
@@ -42,6 +42,9 @@ Available subcommands:
resolve
resolved
revert
+ shelve
+ unshelve
+ shelves
status (stat, st)
switch (sw)
unlock
Modified: subversion/trunk/tools/client-side/bash_completion
URL:
http://svn.apache.org/viewvc/subversion/trunk/tools/client-side/bash_completion?rev=1815228&r1=1815227&r2=1815228&view=diff
==============================================================================
--- subversion/trunk/tools/client-side/bash_completion (original)
+++ subversion/trunk/tools/client-side/bash_completion Tue Nov 14 16:03:34 2017
@@ -248,6 +248,7 @@ _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 shelve shelves unshelve"
# help options have a strange command status...
local helpOpts='--help -h'
@@ -1020,6 +1021,15 @@ _svn()
upgrade)
cmdOpts="$qOpts $pOpts"
;;
+ shelve)
+ cmdOpts="$qOpts --keep-local --delete --list $qOpts --dry-run
--depth --targets $cOpts"
+ ;;
+ unshelve)
+ cmdOpts="$qOpts --keep-shelved --list $qOpts --dry-run"
+ ;;
+ shelves)
+ cmdOpts="$qOpts"
+ ;;
*)
;;
esac