Author: julianfoad
Date: Fri Mar  2 14:25:25 2018
New Revision: 1825728

URL: http://svn.apache.org/viewvc?rev=1825728&view=rev
Log:
Shelving: add 'svn unshelve --drop' option.

* subversion/svn/cl.h
  (svn_cl__opt_state_t): Add new 'drop' flag.

* subversion/svn/shelf-cmd.c
  (svn_cl__shelf_unshelve): Drop after shelving, if successful.

* subversion/svn/svn.c
  (svn_cl__longopt_t,
   svn_cl__options,
   svn_cl__cmd_table,
   sub_main): Add new 'drop' option.

* tools/client-side/bash_completion
  (_svn): Add new 'drop' option.

Modified:
    subversion/trunk/subversion/svn/cl.h
    subversion/trunk/subversion/svn/shelf-cmd.c
    subversion/trunk/subversion/svn/svn.c
    subversion/trunk/tools/client-side/bash_completion

Modified: subversion/trunk/subversion/svn/cl.h
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/svn/cl.h?rev=1825728&r1=1825727&r2=1825728&view=diff
==============================================================================
--- subversion/trunk/subversion/svn/cl.h (original)
+++ subversion/trunk/subversion/svn/cl.h Fri Mar  2 14:25:25 2018
@@ -256,6 +256,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 drop;             /* drop shelf after successful unshelve */
 } svn_cl__opt_state_t;
 
 /* Conflict stats for operations such as update and merge. */

Modified: subversion/trunk/subversion/svn/shelf-cmd.c
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/svn/shelf-cmd.c?rev=1825728&r1=1825727&r2=1825728&view=diff
==============================================================================
--- subversion/trunk/subversion/svn/shelf-cmd.c (original)
+++ subversion/trunk/subversion/svn/shelf-cmd.c Fri Mar  2 14:25:25 2018
@@ -920,6 +920,12 @@ svn_cl__shelf_unshelve(apr_getopt_t *os,
                         opt_state->dry_run, opt_state->quiet,
                         local_abspath, ctx, scratch_pool));
 
+  if (opt_state->drop)
+    {
+      SVN_ERR(shelf_drop(name, local_abspath,
+                         opt_state->dry_run, opt_state->quiet,
+                         ctx, scratch_pool));
+    }
   return SVN_NO_ERROR;
 }
 

Modified: subversion/trunk/subversion/svn/svn.c
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/svn/svn.c?rev=1825728&r1=1825727&r2=1825728&view=diff
==============================================================================
--- subversion/trunk/subversion/svn/svn.c (original)
+++ subversion/trunk/subversion/svn/svn.c Fri Mar  2 14:25:25 2018
@@ -146,6 +146,7 @@ typedef enum svn_cl__longopt_t {
   opt_show_item,
   opt_adds_as_modification,
   opt_vacuum_pristines,
+  opt_drop,
 } svn_cl__longopt_t;
 
 
@@ -471,6 +472,9 @@ const apr_getopt_option_t svn_cl__option
   {"vacuum-pristines", opt_vacuum_pristines, 0,
                        N_("remove unreferenced pristines from .svn 
directory")},
 
+  {"drop", opt_drop, 0,
+                       N_("drop shelf after successful unshelve")},
+
   /* Long-opt Aliases
    *
    * These have NULL desriptions, but an option code that matches some
@@ -1778,7 +1782,7 @@ const svn_opt_subcommand_desc2_t svn_cl_
 
   { "unshelve", svn_cl__shelf_unshelve, {0}, N_
     ("Copy shelved changes back into the WC.\n"
-     "usage: unshelve [NAME [VERSION]]\n"
+     "usage: unshelve [--drop] [NAME [VERSION]]\n"
      "\n"
      "  Apply the shelf named NAME to the working copy.\n"
      "  NAME defaults to the newest shelf.\n"
@@ -1787,10 +1791,13 @@ const svn_opt_subcommand_desc2_t svn_cl_
      "  already in the WC is handled the same way as by 'svn patch',\n"
      "  creating a 'reject' file.\n"
      "\n"
+     "  With --drop, delete the shelf (like shelf-drop) after successfully\n"
+     "  unshelving with no conflicts.\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', opt_dry_run} },
+    {opt_drop, 'q', opt_dry_run} },
 
   { "status", svn_cl__status, {"stat", "st"}, N_
     ("Print the status of working copy files and directories.\n"
@@ -2527,6 +2534,9 @@ sub_main(int *exit_code, int argc, const
       case opt_remove:
         opt_state.remove = TRUE;
         break;
+      case opt_drop:
+        opt_state.drop = TRUE;
+        break;
       case opt_changelist:
         SVN_ERR(svn_utf_cstring_to_utf8(&utf8_opt_arg, opt_arg, pool));
         if (utf8_opt_arg[0] == '\0')

Modified: subversion/trunk/tools/client-side/bash_completion
URL: 
http://svn.apache.org/viewvc/subversion/trunk/tools/client-side/bash_completion?rev=1825728&r1=1825727&r2=1825728&view=diff
==============================================================================
--- subversion/trunk/tools/client-side/bash_completion (original)
+++ subversion/trunk/tools/client-side/bash_completion Fri Mar  2 14:25:25 2018
@@ -1049,7 +1049,7 @@ _svn()
                          $qOpts $pOpts"
                ;;
        unshelve)
-               cmdOpts="--dry-run \
+               cmdOpts="--drop --dry-run \
                          $qOpts $pOpts"
                ;;
        *)


Reply via email to