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 have a VisualSVN server running on Windows 2008 R2 x64 using basic authentication.

I want to upgrade to use windows authentication.

However, some of the usernames set up do not match the domain usernames.

Is there a way to alias basic-auth-username to domain-username, so when someone now commits using domain-username, svn records it as their old basic-auth username?

Or is there a way to spin through the repositories and find/replace basic-auth usernames in commits to domain-auth usernames?

Or is it probably not worth the trouble?

share|improve this question
add comment

1 Answer 1

It is possible to replace usernames in history, but slightly complicated. User name is stored in the svn:author property associated with every revision. svnadmin setrevprop command can change this property.

You can do it manually but it requires to run this command for all revision. So I recommend to use the following steps to simplify this work.

  1. Create backup copy of the repository.
  2. Create batch file chg_users.cmd.

    @ECHO OFF
    SET OLDUSER=oldusername
    SET NEWUSERFILE=user.txt
    
    SET REPO=C:\Repositories\test\
    
    SET SVNADMIN="%VISUALSVN_SERVER%bin\svnadmin.exe"
    SET SVNLOOK="%VISUALSVN_SERVER%bin\svnlook.exe"
    
    REM Iterate over all revisions (svnlook history), get author of each revision (svnlook author),
    REM replace author if necessary (svnadmin setrevprop)
    
    FOR /F "delims=/" %%i IN ('%SVNLOOK% history %REPO% ^| FINDSTR ^[0-9][0-9]*') DO %SVNLOOK% author -r %%i %REPO% | FINDSTR %OLDUSER% && %SVNADMIN% setrevprop %REPO% -r %%i svn:author %NEWUSERFILE%
    
  3. Set old user name using OLDUSER variable. Set path to your repository using REPO variable.

  4. Create text file user.txt with the new user name. Please note this file must contain the only line with the user name.
  5. Run chg_users.cmd.
  6. Check result using svn log command or its TortoiseSVN equivalent.
  7. Repeat steps 2-6 for another user name.
share|improve this answer
add comment

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.