[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

[PATCH] propset can't delete properties

From: Joe Orton <jorton_at_btconnect.com>
Date: 2001-07-07 12:43:20 CEST

The propset command can't delete properties at the moment, but the code
thinks it can... the argument grammar is ambiguous:

usage: propset PROPNAME [PROPVAL | --valfile VALFILE] [TARGETS]

PROPVAL and TARGETS can't both be optional: "propset SomeProp Foo" can
mean either

    propset SomeProp Foo . # remove 'foo' from .
or propset SomeProp [] Foo # remove 'SomeProp' from Foo

I think the best solution is to not use propset for deleting properties,
and add a 'propdel' command instead, or a 'proprm' or whatever. Sound
okay?

Index: propset-cmd.c
===================================================================
RCS file: /usr/local/tigris/data/helm/cvs/repository/subversion/subversion/clients/cmdline/propset-cmd.c,v
retrieving revision 1.2
diff -u -r1.2 propset-cmd.c
--- propset-cmd.c 2001/06/08 09:01:02 1.2
+++ propset-cmd.c 2001/07/07 10:47:48
@@ -57,12 +57,6 @@
   if (num_args_wanted == 2)
     propval = ((svn_stringbuf_t **) (opt_state->args->elts))[1];
 
- if (! strcmp (propval->data, ""))
- {
- /* The user wants to delete the property. */
- propval = NULL;
- }
-
   /* suck up all the remaining arguments into a targets array */
   targets = svn_cl__args_to_target_array (os, pool);
 
@@ -77,12 +71,8 @@
         return err;
 
       /* fitz todo: make these print out only when VERBOSE */
- if (propval)
- printf ("property `%s' set on %s.\n",
- propname->data, target->data);
- else
- printf ("property `%s' deleted from %s\n",
- propname->data, target->data);
+ printf ("property `%s' set on %s.\n",
+ propname->data, target->data);
     }
 
   return SVN_NO_ERROR;
Index: cl.h
===================================================================
RCS file: /usr/local/tigris/data/helm/cvs/repository/subversion/subversion/clients/cmdline/cl.h,v
retrieving revision 1.5
diff -u -r1.5 cl.h
--- cl.h 2001/07/04 12:12:20 1.5
+++ cl.h 2001/07/07 10:47:49
@@ -109,6 +109,7 @@
   svn_cl__proplist,
   svn_cl__propget,
   svn_cl__propset,
+ svn_cl__propdel,
   svn_cl__status,
   svn_cl__diff,
   svn_cl__update;
Index: propdel-cmd.c
===================================================================
RCS file: propdel-cmd.c
diff -N propdel-cmd.c
--- /dev/null Tue May 5 13:32:27 1998
+++ propdel-cmd.c Sat Jul 7 03:47:49 2001
@@ -0,0 +1,75 @@
+/*
+ * propdel-cmd.c -- Remove property from files/dirs
+ *
+ * ====================================================================
+ * Copyright (c) 2000-2001 CollabNet. All rights reserved.
+ *
+ * This software is licensed as described in the file COPYING, which
+ * you should have received as part of this distribution. The terms
+ * are also available at http://subversion.tigris.org/license-1.html.
+ * If newer versions of this license are posted there, you may use a
+ * newer version instead, at your option.
+ * ====================================================================
+ */
+
+/* ==================================================================== */
+
+
+
+/*** Includes. ***/
+
+#include "svn_wc.h"
+#include "svn_client.h"
+#include "svn_string.h"
+#include "svn_path.h"
+#include "svn_delta.h"
+#include "svn_error.h"
+#include "cl.h"
+
+
+/*** Code. ***/
+
+svn_error_t *
+svn_cl__propdel (apr_getopt_t *os,
+ svn_cl__opt_state_t *opt_state,
+ apr_pool_t *pool)
+{
+ svn_stringbuf_t *propname;
+ svn_error_t *err;
+ apr_array_header_t *targets;
+ int i;
+
+ err = svn_cl__parse_num_args (os, opt_state,
+ "propdel", 1, pool);
+ if (err)
+ return err;
+
+ propname = ((svn_stringbuf_t **) (opt_state->args->elts))[0];
+
+ /* suck up all the remaining arguments into a targets array */
+ targets = svn_cl__args_to_target_array (os, pool);
+
+ /* Add "." if user passed 0 file arguments */
+ svn_cl__push_implicit_dot_target(targets, pool);
+
+ for (i = 0; i < targets->nelts; i++)
+ {
+ svn_stringbuf_t *target = ((svn_stringbuf_t **) (targets->elts))[i];
+ err = svn_wc_prop_set (propname, NULL, target, pool);
+ if (err)
+ return err;
+
+ printf ("property `%s' deleted from %s\n",
+ propname->data, target->data);
+ }
+
+ return SVN_NO_ERROR;
+}
+
+
+
+/*
+ * local variables:
+ * eval: (load-file "../svn-dev.el")
+ * end:
+ */

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Sat Oct 21 14:36:33 2006

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.