Domanda

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?

È stato utile?

Soluzione

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.

--

Altri suggerimenti

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

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top