Change svn user name during commit

余生长醉 提交于 2019-12-10 17:57:13

问题


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.


回答1:


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)




回答2:


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.




回答3:


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


来源:https://stackoverflow.com/questions/25687538/change-svn-user-name-during-commit

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!