I am working on a web-based tool to allow project managers to set up new subversion repositories and corresponding Trac instances.
As part of this tool, I'd like to be able to automatically add some specific dependencies to the new repository, like setting some externals for other libraries.
I'm aware that svn propset
doesn't work on remote repositories, however svn propedit
does.
My question is this - how can I issue a svn propedit
and set the svn:externals
property in one command on the command line?
Put another way, propedit
requires an editor, is there some kind of "fake" editor I can use that just accepts command line args (which I can use with svn's --editor-cmd
option)? That way, I can build a CLI command programmatically and issue it with a system call.
I am not worried about overwriting existing properties since this will only ever work on a brand new repository that has been created a few CPU cycles earlier.
You can write an executable script that serves as your prop-editor. It will get as its first argument ($1
on unix-like systems) a temporary file name with the current value of the property being edited. You modify the contents of the file in the script - and that's the new value of the property. You pass your script as svn propedit <pro-name> <item> --editor-cmd <my-custom-editor>
.