Search code examples
svn

How do you avoid the extra newline appended to each revprop when using svnadmin setrevprop?


I am attempting to set a revprop using svnadmin setrevprop /path/to/repos propname propfile -r 0. Each time I set this property a trailing newline gets appended to the value.

My propfile does not contain any newlines at all. (that I am aware of)

This is svn 1.6.11, running the Collabnet Solaris binaries.

If it matters I used vi in Solaris to edit the file . Vi seems to claim that the file has no newlines at all.

When I do a propget I see this:
my prop value

prompt#

I also confirmed this by dumping revision 0 out of the repository.

The newline does make a big difference, as I am trying to set the svn:sync-from-url property to set up a mirror repos. When I try to run synchronize i get this as the output
svnsync: No repository found in 'svn://myserver/myrepos
'

(Note the newline in the output; thank goodness svn includes the quotes or I might never have figured this out!)


Solution

  • It's a Unix convention that editors put an extra LF at the end of the file. That prevents the shell prompt from appearing on the last line of the file when displaying its contents using cat among other things.

    To make sure this is happening run od -t x1 propfile and you'll see that the last character is 0a.

    If that's the case you can use echo -n text > propfile to write some text in the file without adding that extra LF at the end.

    You can then pass that file to svnadmin setrevprop.