You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by Olaf Hering <ol...@suse.de> on 2003/02/09 21:07:15 UTC

set svn:keywords property on svn add

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

Re: set svn:keywords property on svn add

Posted by Olaf Hering <ol...@suse.de>.
 On Mon, Feb 10, Karl Fogel wrote:

> It's extending the directory URL with the name of the file.  But the
> resulting URL is a bit suspect, because of course it doesn't exist in
> the repository yet...

Yes, I have looked at svn info. Getting the current working directory
and look there for the url might be an option. 
I will suggest a patch, later this week. My quick hack from last night
did not work as expected.


Gruss Olaf

-- 
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

Re: set svn:keywords property on svn add

Posted by Karl Fogel <kf...@newton.ch.collab.net>.
Olaf Hering <ol...@suse.de> writes:
> Ok, well, to say it again:
> Is there a way to do a 'svn proset svn:keywords Id file' automatically
> when on runs 'svn add file'? And if there is no such feature, can it be
> added on a per repository base, configureable via ~/.subversion/servers
> (I assume thats the users repository "database")?
> 
> The problem I see right now, how do I retrieve the URL on svn add? It
> seems 'svn info' gets it in some way, and even 'svn add' must know it
> somehow. Have to dig depper in the code.

It's extending the directory URL with the name of the file.  But the
resulting URL is a bit suspect, because of course it doesn't exist in
the repository yet...

-K

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: set svn:keywords property on svn add

Posted by Karl Fogel <kf...@newton.ch.collab.net>.
Michael Price <mp...@atl.lmco.com> writes:
> I'm aware of the priorities for a 1.0 release. My one-line voice of
> support for the idea was just that -- a voice of support. It wasn't a
> "commit this feature now or I'm going to throw a fit" email :)

Oops, my apologies Michael.  I overinterpreted your mail, not because
it was at all unclear, but because my reflexes for stomping down new
features right now are a little *too* eager :-).

> If small features like this are more appropriate for post-1.0 then I'd
> be more than happy to organize my collection and file them with patches
> in the issue tracker for that happy day many months from now when the
> 1.0 release is a reality.

That would be great, thanks.

-K

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: set svn:keywords property on svn add

Posted by Michael Price <mp...@atl.lmco.com>.
Karl Fogel writes:
 > Michael Price <mp...@atl.lmco.com> writes:
 > > Olaf Hering writes:
 > > > Is there a way to do an 'svn propset svn:keywords Id file'
 > > > automatically when on runs 'svn add file'?
 > >
 > > I found myself wishing for that feature just the other day.
 > 
 > I hate to be the wet blanket, but we can't just add any feature that
 > sounds good.

Well, I don't think you are a wet blanket Karl.

I'm aware of the priorities for a 1.0 release. My one-line voice of
support for the idea was just that -- a voice of support. It wasn't a
"commit this feature now or I'm going to throw a fit" email :)

If small features like this are more appropriate for post-1.0 then I'd
be more than happy to organize my collection and file them with patches
in the issue tracker for that happy day many months from now when the
1.0 release is a reality.

Michael


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: set svn:keywords property on svn add

Posted by Karl Fogel <kf...@newton.ch.collab.net>.
Michael Price <mp...@atl.lmco.com> writes:
> Olaf Hering writes:
>  > Is there a way to do an 'svn propset svn:keywords Id file' automatically
>  > when on runs 'svn add file'?
> 
> I found myself wishing for that feature just the other day.

I hate to be the wet blanket, but we can't just add any feature that
sounds good.  Although we haven't officially declared some sort of
code freeze or 1.0 release branch yet (it's still a bit early), IMHO
it's best to avoid introducing new features or enhancements where
possible now.  Each one is a potential bug source, while we are
already mostly feature complete and have enough bugs to fix as it is.
(Missing 1.0 features should already be entered in the issue tracker.)

This feature is a good candidate for post-1.0, when we will have time
to think it through carefully and design it right.  If you'd like to
file a Post-1.0 feature request (or maybe call it an "enhancement" to
keyword functionality), go for it.  But I'm -0.5 to -1 on putting it
in the code right now.  There are many, many potential features that
are useful to someone, under some circumstances.  We must resist
implementing them before 1.0, or else be prepared to wait forever for
1.0.

Nor is branching the answer here.  Branching is useful for work that
we intend to merge soon, where the branch is being actively developed
and kept in sync with the trunk, or for exploratory experiments that
are too large to keep in a working copy.  But for a change like this,
the branch would essentially be a snapshot of trunk with one patch
applied -- in other words, the branch contains no more information
than the patch itself, so just attach a patch to an issue, and that's
your "virtual branch" :-).

-Karl

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: set svn:keywords property on svn add

Posted by Michael Price <mp...@atl.lmco.com>.
Olaf Hering writes:
 > Is there a way to do an 'svn propset svn:keywords Id file' automatically
 > when on runs 'svn add file'?

I found myself wishing for that feature just the other day.

Michael


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: set svn:keywords property on svn add

Posted by Olaf Hering <ol...@suse.de>.
 On Tue, Feb 11, William Uther wrote:

> 
> On Tuesday, February 11, 2003, at 06:55  AM, Olaf Hering wrote:
> 
> >Is there a way to do a 'svn proset svn:keywords Id file' automatically
> >when on runs 'svn add file'? And if there is no such feature, can it be
> >added on a per repository base, configureable via ~/.subversion/servers
> >(I assume thats the users repository "database")?
> 
> There was discussion on the list a while ago about having inheritable 
> properties.  These are properties that you set on a directory, and then 
> anything added to that directory has those properties added to it 
> (including other directories, allowing the properties to act as 
> defaults for whole directory hierarchies.)
> 
> Would that solve your problem?

Sure, that smells like 'recursive properties', if we can go that way,
fine.


Gruss Olaf

-- 
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

Re: set svn:keywords property on svn add

Posted by William Uther <wi...@cse.unsw.edu.au>.
On Tuesday, February 11, 2003, at 06:55  AM, Olaf Hering wrote:

> Is there a way to do a 'svn proset svn:keywords Id file' automatically
> when on runs 'svn add file'? And if there is no such feature, can it be
> added on a per repository base, configureable via ~/.subversion/servers
> (I assume thats the users repository "database")?

There was discussion on the list a while ago about having inheritable 
properties.  These are properties that you set on a directory, and then 
anything added to that directory has those properties added to it 
(including other directories, allowing the properties to act as 
defaults for whole directory hierarchies.)

Would that solve your problem?

Be well,

Will       :-}

--
Dr William Uther                            National ICT Australia
Phone: +61 2 9385 6926             School of Computer Science and 
Engineering
Email: willu@cse.unsw.edu.au             University of New South Wales
Jabber: willu@jabber.cse.unsw.edu.au          Sydney, Australia


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: set svn:keywords property on svn add

Posted by Olaf Hering <ol...@suse.de>.
 On Mon, Feb 10, Karl Fogel wrote:

> Olaf Hering <ol...@suse.de> writes:
> > 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?
> 
> It looks like you are offering the patch as a substitute for a precise
> prose description of the change.  Please just use prose instead :-).
> Then it would be much easier to comprehend, quote, modify, etc, in the
> context of a mailing list discussion.
> 
> If I understand the proposal correctly, I don't find it very
> compelling, not pre-1.0 imho.

Ok, well, to say it again:
Is there a way to do a 'svn proset svn:keywords Id file' automatically
when on runs 'svn add file'? And if there is no such feature, can it be
added on a per repository base, configureable via ~/.subversion/servers
(I assume thats the users repository "database")?

The problem I see right now, how do I retrieve the URL on svn add? It
seems 'svn info' gets it in some way, and even 'svn add' must know it
somehow. Have to dig depper in the code.

> (If I'm wrong, and the patch really is meant for application, then see
> the HACKING file for guidance.  Specifically, the "#ifdef olh"s have
> to go :-); it needs a log message; the new function needs to be
> documented; the new function should be static, needs no independent
> prototype, and needs no "svn_cl__" prefix; etc.)

Sure, the patch was not meant for inclusion, just a hack to make our
guys happy.


Gruss Olaf

-- 
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

Re: set svn:keywords property on svn add

Posted by Karl Fogel <kf...@newton.ch.collab.net>.
Olaf Hering <ol...@suse.de> writes:
> 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?

It looks like you are offering the patch as a substitute for a precise
prose description of the change.  Please just use prose instead :-).
Then it would be much easier to comprehend, quote, modify, etc, in the
context of a mailing list discussion.

If I understand the proposal correctly, I don't find it very
compelling, not pre-1.0 imho.

(If I'm wrong, and the patch really is meant for application, then see
the HACKING file for guidance.  Specifically, the "#ifdef olh"s have
to go :-); it needs a log message; the new function needs to be
documented; the new function should be static, needs no independent
prototype, and needs no "svn_cl__" prefix; etc.)

Best,
-Karl


> --- 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

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org