Sergey Azarkevich
Sergey Azarkevich

Reputation: 2671

Change svn user name during commit

We have corporate logins like QWE098765 and using them to acess to SVN repository. I want map this names to emails, so in SVN history they will be human readable.

Currently I use post-commit hook which change svn:author revision property, but... But here is small gap between commit and change name, and sometime applications which track SVN changes (CommitMonitor, Jenkins) catch QWE098765 name instead of emails. This is not very big problem, but annoying.

May be here is other way to map names?

P.S. We use VisualSVN server for access to repository.

Upvotes: 3

Views: 1729

Answers (3)

Hermann
Hermann

Reputation: 1

Use a python script to change the author in a pre-commit hook:

This one is a nice example: http://svn.apache.org/repos/asf/subversion/trunk/tools/hook-scripts/log-police.py This one modifies the log, but modifying the author works the same (simply replace svn:log by svn:author).

You'll need python-subversion. If you are on Ubuntu/Debian, then install it using:

sudo apt install python-subversion

Upvotes: 0

Sergey Azarkevich
Sergey Azarkevich

Reputation: 2671

Finally I got it with advice from Lazy Badger

Indeed, with standard tools it is not possible: http://svn.haxx.se/users/archive-2014-09/0032.shtml

But it is possible write simple script or program and operate with Subversion API directly. I write simple implemenation of such program: https://github.com/azarkevich/SvnPreCommitAuthor

It take file path with mapping name -> new name and should be runned as pre-commit hook.

Upvotes: 2

Lazy Badger
Lazy Badger

Reputation: 97375

Just do it in pre-commit hook (I know about and follow "Do not modify transaction content in pre-commit", but log, author and date properties are another story and they can be changed freely)

Upvotes: 2

Related Questions