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 2019/01/07 15:06:11 UTC

svn commit: r1850652 - in /subversion/trunk/subversion/svn: cl.h revert-cmd.c svn.c

Author: julianfoad
Date: Mon Jan  7 15:06:10 2019
New Revision: 1850652

URL: http://svn.apache.org/viewvc?rev=1850652&view=rev
Log:
Implement issue 4798 "revert: option to remove added items from disk".

But the the API doesn't currently work for items found by recursion, so the
last part of the test fails.

* subversion/svn/cl.h
  (svn_cl__opt_state_t): Add a new flag, 'remove_added'.

* subversion/svn/revert-cmd.c
  (svn_cl__revert): Pass that flag on to the API.

* subversion/svn/svn.c
  (svn_cl__longopt_t,
   svn_cl__options,
   svn_cl__cmd_table,
   sub_main): Add a new option, 'opt_remove_added', to the 'revert' command.

Modified:
    subversion/trunk/subversion/svn/cl.h
    subversion/trunk/subversion/svn/revert-cmd.c
    subversion/trunk/subversion/svn/svn.c

Modified: subversion/trunk/subversion/svn/cl.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/svn/cl.h?rev=1850652&r1=1850651&r2=1850652&view=diff
==============================================================================
--- subversion/trunk/subversion/svn/cl.h (original)
+++ subversion/trunk/subversion/svn/cl.h Mon Jan  7 15:06:10 2019
@@ -261,6 +261,7 @@ typedef struct svn_cl__opt_state_t
   svn_boolean_t mergeinfo_log;     /* show log message in mergeinfo command */
   svn_boolean_t remove_unversioned;/* remove unversioned items */
   svn_boolean_t remove_ignored;    /* remove ignored items */
+  svn_boolean_t remove_added;      /* reverting added item also removes it */
   svn_boolean_t no_newline;        /* do not output the trailing newline */
   svn_boolean_t show_passwords;    /* show cached passwords */
   svn_boolean_t pin_externals;     /* pin externals to last-changed revisions */

Modified: subversion/trunk/subversion/svn/revert-cmd.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/svn/revert-cmd.c?rev=1850652&r1=1850651&r2=1850652&view=diff
==============================================================================
--- subversion/trunk/subversion/svn/revert-cmd.c (original)
+++ subversion/trunk/subversion/svn/revert-cmd.c Mon Jan  7 15:06:10 2019
@@ -71,7 +71,7 @@ svn_cl__revert(apr_getopt_t *os,
                            opt_state->changelists,
                            FALSE /* clear_changelists */,
                            FALSE /* metadata_only */,
-                           TRUE /*added_keep_local*/,
+                           !opt_state->remove_added /*added_keep_local*/,
                            ctx, scratch_pool);
   if (err
       && (err->apr_err == SVN_ERR_WC_INVALID_OPERATION_DEPTH)

Modified: subversion/trunk/subversion/svn/svn.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/svn/svn.c?rev=1850652&r1=1850651&r2=1850652&view=diff
==============================================================================
--- subversion/trunk/subversion/svn/svn.c (original)
+++ subversion/trunk/subversion/svn/svn.c Mon Jan  7 15:06:10 2019
@@ -140,6 +140,7 @@ typedef enum svn_cl__longopt_t {
   opt_mergeinfo_log,
   opt_remove_unversioned,
   opt_remove_ignored,
+  opt_remove_added,
   opt_no_newline,
   opt_show_passwords,
   opt_pin_externals,
@@ -421,6 +422,8 @@ const apr_getopt_option_t svn_cl__option
   {"remove-unversioned", opt_remove_unversioned, 0,
                        N_("remove unversioned items")},
   {"remove-ignored", opt_remove_ignored, 0, N_("remove ignored items")},
+  {"remove-added", opt_remove_added, 0,
+                       N_("reverting an added item will remove it from disk")},
   {"no-newline", opt_no_newline, 0, N_("do not output the trailing newline")},
   {"show-passwords", opt_show_passwords, 0, N_("show cached passwords")},
   {"pin-externals", opt_pin_externals, 0,
@@ -1765,7 +1768,8 @@ const svn_opt_subcommand_desc3_t svn_cl_
      "  For information about undoing already committed changes, search\n"
      "  the output of 'svn help merge' for 'undo'.\n"
     )},
-    {opt_targets, 'R', opt_depth, 'q', opt_changelist} },
+    {opt_targets, 'R', opt_depth, 'q', opt_changelist,
+     opt_remove_added} },
 
   { "status", svn_cl__status, {"stat", "st"}, {N_(
      "Print the status of working copy files and directories.\n"
@@ -2807,6 +2811,9 @@ sub_main(int *exit_code, int argc, const
       case opt_remove_ignored:
         opt_state.remove_ignored = TRUE;
         break;
+      case opt_remove_added:
+        opt_state.remove_added = TRUE;
+        break;
       case opt_no_newline:
       case opt_strict:          /* ### DEPRECATED */
         opt_state.no_newline = TRUE;