3

I need to edit a svn property on a file after a commit happened. Therefor I'd like to use a post-commit script.

Example:

I have a property called export with a value set to test when I commit a file called example.ex After my commit succeeded I have a post-commit hook, that does some smart things (that doesn't matter to my question) and after finishing it needs to change (or delete) the property export to a new value like succeeded.

On command line I would use this:

svn propedit "export"  file:///svn/repositoryName/path/to/file/in/repository/example.ex

This will open my system editor vi and I will see the value test. I can change it to whatever I want and save and quit the file with vi commands like :wq

Subversion gives back a message like this

"svn-prop.tmp" 1L, 10C written
Set new value for property 'export' on file:///svn/repositoryName/path/to/file/in/repository/example.ex'
Committed revision 67.

So much so fine. But as I've said, I need that in a post-commit script, where I can't control vi (or am I wrong?).

So Subversion gives me the possibility to add a file to the command propedit. The file contains just the new value succeeded.

The new command should look like this:

svn propedit "export"  file:///svn/repositoryName/path/to/file/in/repository/example.ex --file /path/to/propertyValueFile/propValue.file

And here's the problem: the last command doesn't work. Again vi opens and I need to change my value manually. Why? What am I doing wrong?

slowdog
  • 6,076
  • 2
  • 27
  • 30
derroman
  • 309
  • 2
  • 11
  • okay, meanwhile I've realized that --file will use the content of this file as log message. nevertheless, same problem: I need it in a script. – derroman May 11 '12 at 11:37

2 Answers2

2

I found the solution, that works for me.

svn propedit "export" file:///svn/repositoryName/path/to/file/in/repository/example.ex --file /data/svn/intranet/hooks/fileWithLogMessage --editor-cmd "echo succeeded >"

--editor-cmd gives another editor and I can outsmart propedit with echo newValueForProp.

And now it works like a charm.

--

derroman
  • 309
  • 2
  • 11
0

Try using svn propset rather than svn propedit. Using propedit always opens an external editor... that's what it's for.

Barton Chittenden
  • 4,238
  • 2
  • 27
  • 46
  • No. That's not a solution, because svn propset doesn't work either, if the property is already set. But I've found the solution by myself. But thanks anyway. – derroman May 13 '12 at 06:44