Question

I want to change the default SVN username to a new name. I tried solution suggested in this link (How do I change the default author for accessing a local SVN repository?), but it is not working.

I have access to SVN repository through command line and Aptana using Subversive client.

Was it helpful?

Solution

Edit: This answer is on how to change an author in the logs, not how to set the default author. I'll leave the solution here since it could still help undo the past few commits, were the author not the correct one.

Edit 2: hook script example and information for .bat files.


You don't give much details so we'll have to guess, and my first thought would be about the hook script that is called to validate the change. In that case, your client is not the problem, it is a server configuration issue.

Make sure that the pre-revprop-change hook script (in your <repository>/hooks directory, on the server), is executable by the server and allows a change of author.

Here is an example in C:

#include <stdio.h>

int main(int argc, char *argv[])
{
int i;
 char *repos = argv[1];
 char *rev = argv[2];
 char *user = argv[3];
 char *propname = argv[4];
 char *action = argv[5];

 if (!strcmp(action, "M") && !strcmp(propname, "svn:log")) return 0;
 if (!strcmp(action, "M") && !strcmp(propname, "svn:author")) return 0;
 fprintf(stderr, "Changing revision properties other than svn:log or svn:author is prohibited");
 return 1;
} 

If your SVN server is on Linux, you may also simply rename the pre-revprop-change.tmpl file which is automatically created with each repository to pre-revprop-change, and give it executable permission for the server. It should look like this to allow author and log changes:

#!/bin/sh

REPOS="$1"
REV="$2"
USER="$3"
PROPNAME="$4"
ACTION="$5"

if [ "$ACTION" = "M" -a "$PROPNAME" = "svn:author" ]; then exit 0; fi
if [ "$ACTION" = "M" -a "$PROPNAME" = "svn:log" ]; then exit 0; fi

echo "Changing revision properties other than svn:log or svn:author is prohibited" >&2
exit 1

For Windows:

@echo off
REM pre-revprop-change.bat hook script
if "%4" == "svn:log" exit /b 0
if "%4" == "svn:author" exit /b 0
echo "Changing revision properties %4% is prohibited" >&2
exit /b 1

if it does not work, it might be due to the COMSPEC or the PATH variables not having the proper values for the server account, or it could also be the permissions on the hook script. Check this link for more details.

There are other examples of hook scripts at CollabNet.

More details in the Version Control with Subversion online book, and also here (check the next sections).

OTHER TIPS

For Eclipse (but should work with Eclipse-based IDE like Aptana) :

In the SVN Repository views of the SVN Perpective, just go to the Location Properties of the desired repository and change the credentials in the Authentication box.

It should change your author from now on.

If you want to rewrite history, you have to use something like RedGlyph's solution.

Subversion 1.4.x have got only svn:log allowed in default pre-revprop-change file. This can cause problem when using Eclipse with Subversive svn plugin.

To solve magical error stating that

Changing revision properties other than svn:log is prohibited

after svn commands. To solve this particular problem add

if [ "$ACTION" = "M" -a "$PROPNAME" = "svn:author" ]; then exit 0; fi

from RedGlyph solution above.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top