tags:

views:

1223

answers:

2

When I commit changes in Eclipse, svn records my author name as the one that I entered the first time I committed changes in Eclipse (Alok). By author name, I mean the name that shows up when you run "svn log" or "svn blame".

However, when I commit changes from the command line, the Author Name is set to the username that I use to ssh to the repository (svnadmin). Is there a way to set the equivalent of Author Name/svn username independently of the ssh username from the command line when using svn+ssh? I have tried

svn --username Alok ci

but the username in this case is ignored, and the change is attributed to svnadmin.

A: 

It is by design that you cannot change the username for svn+ssh. If you could, you would be able to fake somebody else as the committer - when the SSH key would normally clearly identify yourself as the committer.

So if you want different committer names to show up with svn+ssh, you need to change something on the server:

  1. Create separate remote users, and put your key into the authorized_keys file for the user you want to appear as committer. Alternatively,
  2. Put command= lines into the authorized_keys file of the svnadmin user. The command should read /usr/bin/svnserve -t --tunnel-user Alok; optionally also with a --root option.
Martin v. Löwis
What you say makes sense, but then how does eclipse do it? It also connects over svn+ssh as svnadmin, yet manages to set the Author Name to Alok. I suppose I should take a closer look at exactly what eclipse is doing.
Alokito
A: 

One workaround is to first enable editing of revision tags by putting a shell script like the following in hooks/pre-revprop-change

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

if [ "$PROPNAME" = "svn:log" ]; then exit 0; fi
if [ "$PROPNAME" = "svn:author" ]; then exit 0; fi
exit 1

Then, after the commit you can change the svn:author with

svn propset --revprop -r1234 svn:author Alok

This does not explain how eclipse is able to set svn:author at commit time without having a pre-revprop-change hook. This solution is a little unsatisfying because it allows any user to change the svn:author of any commit, it would be nice to know what eclipse is actually doing.

Alokito