SVN 显示用户名而不是用户 ID [英] SVN show usernames instead of user ids

查看:33
本文介绍了SVN 显示用户名而不是用户 ID的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以我们有这个 SVN 存储库,之前提交者的名字被整齐地显示出来,并且更容易跟踪谁做了什么.最近,svn 存储库被移动到另一台服务器并设置为现在当我们检查日志时,我们只能看到作者的用户 ID.我相信我们可以更新服务器中的 SVN authz 或其他一些设置文件来添加作者姓名.

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.

我想问的是,有没有办法在客户端做到这一点?主要是因为我们没有访问或权限来修改 SVN 服务器设置.有什么方法可以让我拥有一个道具或其他东西,我可以拥有映射并且它可以显示在日志中.

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.

我使用 tortoiseSVN 作为 SVN 客户端.

I am using tortoiseSVN as the SVN client.

推荐答案

这些 Subversion 用户 ID 来自哪里?您的 Subversion 是否像 Windows Active Directory 一样与 LDAP 集成,或者这是一个单独的 Subversion 授权文件?

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?

用户 ID 是否从旧服务器(人们用来使用他们的名字的服务器)更改为当前用户 ID?

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

我能想到两件事:

  • 您通过 LDAP 使用了 Windows AD,旧服务器根据用户的 cn 属性进行验证,而新服务器根据 sAMAccountName 属性进行验证.

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

您的旧服务器有一个提交后挂钩,它将 svn:author 修订版属性从用户的登录 ID 更改为用户名.

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.

你还有旧的 Subversion 服务器吗?您应该看看是否可以找到设置中的差异.

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

谢谢大卫.我会检查一下,但我不确定我是否能够,因为访问限制.你知道我是否可以设置一个像 set X123" 这样的客户端属性值?作为约翰·多伊".这样当我查看日志时,所有具有 X123 的提交者名称都会显示为 John Doe?

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?

svn:author 修订版属性包含进行提交的用户的姓名.您可以将其更改为您想要的任何内容.正如我之前所说,我已经看到网站使用提交后挂钩来做到这一点.我远不是这样做的粉丝.但是,某些站点似乎为用户名选择随机字符串.就像您在示例中所说的 X123 一样.诱惑命运和改变svn:author的诱惑力非常强.

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.

我可以提出一些建议:

  • 您可以使用 Jenkins 之类的内容.Jenkins 是一个持续构建引擎.但是,它还在易于使用的界面中存储您的完整历史记录.如果您使用的是 LDAP 或 Windows AD,它可以做的一件事是将用户 ID 转换为实际名称.因此,如果您查看您在 Jenkins 上的历史记录,您将看到实际的用户名.

  • 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.

您可以使用另一个修订版属性.例如,local:username.这又是由提交后钩子完成的.但是,它不会更改 svn:author 修订版属性,因此您不会有任何可能的副作用.当您需要通过 svn pg --rev-prop -r $rev 命令查看用户名时,您可以进行快速查找.或者,如果您使用 --with-rev-prop local:username--with-all-revprops,您可以使用 svn log 查看它 参数以及 --xml 参数(抱歉,只有在 XML 格式时才会显示在日志中).

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).

顺便说一下,如果您确实使用 post-commit hook 来更改 svn:author 或添加 local:username 修订属性,您还将需要添加 pre-revprop-change 以授予您更改/添加修订属性的权限.这与所有其他钩子相反.在这些钩子中,您必须生成一个非零退出值以防止操作.在此,您希望生成零退出值以允许操作.没有这个钩子,你将无法更改修订属性.

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.

这篇关于SVN 显示用户名而不是用户 ID的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆