Undefined Variable
Undefined Variable

Reputation: 4267

SVN show usernames instead of user ids

So we have this SVN repository where earlier the committers name was shown neatly and it was easier to track who did what. Recently, the svn repository was moved to another server and it was set up so that now when we check logs we can only see the user ids of the author. I believe that we can update the SVN authz or some other settings file in the server to add the author name.

What I wanted to ask is, is there any way to do that in the client side? Mainly because we do not have access or permission to modify the SVN server settings. Is there way I can have a prop or something where I can have the mapping and it could show up in the log.

I am using tortoiseSVN as the SVN client.

Upvotes: 4

Views: 2931

Answers (2)

David W.
David W.

Reputation: 107040

Where are these Subversion user IDs coming from? Is your Subversion integrated with LDAP like a Windows Active Directory, or is this a separate Subversion authorization file?

Did the user IDs change from the old server (where people use to use their name) to the current user IDs?

I can think of two things:

  • You used Windows AD via LDAP, and the old server validated against the user's cn attribute while the new one validates against sAMAccountName.

  • Your old server had a post-commit hook that changed the svn:author revision property from the user's login ID to the user's name.

Do you still have the old Subversion server? You should see if you can find the differences in the setup.


Additional Comments

Thanks David. I will check that though I am not sure if I will be able to, because of access restrictions. Do you know if I could just set a client side prop value like set "X123" as "John Doe". So that when I view log all the committer's name that has X123 will show up as John Doe?

The svn:author revision property contains the name of the user who did the commit. You can change this to anything you want. As I said before, I've seen sites do this with post-commit hooks. I am far from a fan of doing this. However, some sites seem to pick random strings of characters for user names. Like X123 as you said in your example. The temptation to tempt fate and change svn:author can be very strong.

There are a few recommendations I can make:

  • You can use something like Jenkins. Jenkins is a continuous build engine. However, it also stores your complete history in an easy to use interface. One of the things it can do is translate user IDs to actual names if you're using LDAP or Windows AD. Thus, if you look at your history on Jenkins, you'll see actual user names.

  • You can use another revision property. For example, local:username. This again, is done by a post-commit hook. However, it doesn't change the svn:author revision property, so you won't have any possible side effects. You can do a quick lookup when you need to see the user's name via the svn pg --rev-prop -r $rev command. Or you can see it with the svn log if you use either the --with-rev-prop local:username or the --with-all-revprops parameter as well as the --xml parameter (sorry, only shows up in the log when in XML format).

By the way, if you do use a post-commit hook to either change svn:author, or to add the local:username revision property, you will also need to add a pre-revprop-change to give you permission to change/add the revision property. This is the opposite of all other hooks. In those hooks, you had to generate a non-zero exit value in order to prevent an action. In this one, you want to generate a zero exit value to allow an action. Without this hook, you won't be able to change the revision property.

Upvotes: 1

alroc
alroc

Reputation: 28174

The user ID seen in the logs is the ID used to authenticate to the server when the revision is committed. There is no way to change what's being reported by clients directly within the client; you can only extract the log and remap the IDs after the fact, and you'll have to do that every time you want to pull a log.

Upvotes: 1

Related Questions