Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Subversion: how to remove property on commit

My situation is this: I have a Subversion server set up at my home, and we also use Subversion at the company where I work.

At work, we use the lock/edit/unlock model (mainly because we are transitioning from Visual SourceSafe and it's easier for the moment). At the moment this is achieved by setting the 'needs-lock' property on all added files (using the auto-props section of the SVN client config file on each client machine).

However, I don't want to use this model for my home SVN server (I prefer the edit/merge/commit way of working), so currently after I commit anything from my work PC to my home server, I have to manually remove the needs-lock property from any files I have added.

Is there a way I can set up the SVN client to only apply this property to files committed to a particular server? Or am I going about it the wrong way: should I be using hooks on the work server to add this property, instead of the client?

Any help or advice is much appreciated.

EDIT: Apparently, you cannot do this on the server (or at least it's extremely strongly recommended that you don't).

like image 524
Mark Bell Avatar asked Oct 08 '09 10:10

Mark Bell


People also ask

How remove SVN commit?

$ svn delete myfile D myfile $ svn commit -m "Deleted file 'myfile'." Deleting myfile Transmitting file data . Committed revision 14. Deleting a URL, however, is immediate, so you have to supply a log message: $ svn delete -m "Deleting file 'yourfile'" \ file:///var/svn/repos/test/yourfile Committed revision 15.

Where are SVN properties stored?

They are stored in the svn:log property. You can add the --revprop flag to the various property commands to view & edit this property.


2 Answers

I also wrote a little Windows batch file to recursively remove the needs-lock property from any folders where it had already been set. Put these lines into a text file:

svn propdel svn:needs-lock -R -q "%1"
svn commit "%1" -m "Removed needs-lock"

Save it as remove-needs-lock.bat, and add it's location to your PATH environment variable. Then you can run:

remove-needs-lock c:\workingcopyfoldername

And presto, all the files no longer require lock to edit.

like image 168
Mark Bell Avatar answered Sep 17 '22 21:09

Mark Bell


The subversion autoprops feature is configured in the config file of your SVN client. There is also a separate servers configuration file that supports server-specific settings, but unfortunately you cannot override autoprops there.

I suggest you make two versions of config: config.home and config.work. Then write a shell script (e.g. a .bat file) that copies one of those over config. That should allow you to switch quickly and easily between both configurations.

like image 33
Wim Coenen Avatar answered Sep 16 '22 21:09

Wim Coenen