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

set svn:keywords property on svn add

From: Olaf Hering <olh_at_suse.de>
Date: 2003-02-09 22:07:15 CET

Hi,

I added a (global) svn:keyword on 'svn add foo.c' with the patch below.

~/.subversion/config:
[properties_on_add]
keywords = foo bar Id HostURL

However, it would make more sense to specify that per repository. The
right place for that seems to be ~/subversion/servers.
I do not see how to retrieve the URL in the add-cmd.c and match it
against the configured servers.

Is such a change acceptable?

--- subversion-0.17.1.orig/subversion/clients/cmdline/add-cmd.c 2003-01-20 22:21:27.000000000 +0100
+++ subversion-0.17.1/subversion/clients/cmdline/add-cmd.c 2003-02-02 17:11:45.000000000 +0100
@@ -31,8 +31,24 @@
 #include "svn_delta.h"
 #include "svn_error.h"
 #include "svn_pools.h"
+#include "svn_config.h"
 #include "cl.h"
 
+#define olh
+#ifdef olh
+svn_error_t * svn_cl__add_keywords(const char *add_keywords, svn_boolean_t recurse, const char *target, apr_pool_t *pool);
+svn_error_t *
+svn_cl__add_keywords(const char *add_keywords, svn_boolean_t recurse, const char *target, apr_pool_t *pool)
+{
+ svn_string_t propval;
+
+ propval.data = add_keywords;
+ propval.len = strlen(add_keywords);
+
+ SVN_ERR (svn_client_propset("svn:keywords", &propval, target, recurse, pool));
+ return SVN_NO_ERROR;
+}
+#endif
 
 
 /*** Code. ***/
@@ -50,6 +66,13 @@ svn_cl__add (apr_getopt_t *os,
   apr_pool_t *subpool;
   svn_wc_notify_func_t notify_func = NULL;
   void *notify_baton = NULL;
+#ifdef olh
+ struct svn_config_t *cfg;
+ const char *add_keywords = NULL;
+
+ SVN_ERR (svn_config_read_config (&cfg, pool));
+ svn_config_get (cfg, &add_keywords, "properties_on_add", "keywords", add_keywords);
+#endif
 
   SVN_ERR (svn_opt_args_to_target_array (&targets, os,
                                          opt_state->targets,
@@ -81,6 +104,10 @@ svn_cl__add (apr_getopt_t *os,
           else
             return err;
         }
+#ifdef olh
+ if (add_keywords)
+ svn_cl__add_keywords(add_keywords, ! opt_state->nonrecursive, target, pool);
+#endif
       
       svn_pool_clear (subpool);
     }

-- 
A: No.
Q: Should I include quotations after my reply?
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Sun Feb 9 22:08:01 2003

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