Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I will perform a subversion migration from the built-in authentication against the central LDAP server using sasl. As part of this change, the usernames will be modified, from username to username@example.com.

To keep things simple, I'd like to update the authors on all revisions to conform to the same naming scheme. I understand that the author can be changed by allowing revprop changes and changing the svn:author property using svn propset:

svn propset --revprop -r revision_number svn:author your_username

However, I'd like to do this using a script, for all revisions.

Is there such a script already available which transforms the svn:author property according to a preset pattern for all revisions in a repository?

share|improve this question
add comment

1 Answer

up vote 3 down vote accepted

In such cases, I would either dump repository, modify and reload the dump, or use scripting to perform whatever changes required in a loop, i.e., if using Bash -

for i in {1..999}
do
  svn propset --revprop -r $i svn:author your_username
done

Replace 1..999 with actual revisions range to apply to.

Assuming you run the script from where the working copy is, you can get the last revision number within the script as well, i.e.:

REV=`svn info | grep Revision: | cut -c11-`
for ((i=0; i<=${REV}; i++))
do
  svn propset --revprop -r $i svn:author your_username
done

"svn info" can also be used to retrieve the author of the change:

svn info -r revnum | grep 'Last Changed Author:' | cut -c22-
share|improve this answer
    
Just a couple of questions: 1. How can I find out the current maximum revision in a script? 2. How can I extract the current author for a revision? –  Robert Munteanu Dec 8 '11 at 9:56
    
Revision: svn info | grep Revision: | cut -c11- Revision author: svn info | grep 'Last Changed Author:' | cut -c22- –  Konstantin Boyandin Dec 8 '11 at 10:02
    
Sorry for the bad formatting. Revision: svn info | grep Revision: | cut -c11- Revision author: svn info | grep 'Last Changed Author:' | cut -c22- Markdown somehow doesn't work for me here. –  Konstantin Boyandin Dec 8 '11 at 10:08
    
OK, so svn info gives me the last revision. And I can use svn propget ... to get the author for each revision. That's enough to work on, thanks. –  Robert Munteanu Dec 8 '11 at 10:16
1  
Revision-number: 3 Prop-content-length: 133 Content-length: 133 K 10 svn:author V 10 lazybadger K 8 svn:date just change relevant part of text (all revisions in text-file of dump have the same format). "Find&Replace all" in text editor may be the easiest way –  Lazy Badger Dec 8 '11 at 20:17
show 2 more comments

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.