如何在 SVN 中为单个文件的单个修订设置属性 [英] How to set a property in SVN for a single revision of a single file

查看:29
本文介绍了如何在 SVN 中为单个文件的单个修订设置属性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个 Subversion 存储库,并且有许多用户正在检查和检查内容.但是,我也需要经常检查其他人的工作.我需要追踪作品的原作者.

I've got a Subversion repository, and there are a number of users checking things in and out. However, I also need to frequently check in work for other people. I need to track the original author of the work.

我正在考虑在 SVN 中创建一个属性,比如originalauthor",它可以跟踪这个.如果它是空的,我可以使用作者.如果填写,我可以适当地归因于更改.

I was considering creating a property in SVN, like "originalauthor", which could track this. In cases where it was empty, I could use the author. If it was filled in, I could attribute the changes appropriately.

但是,我看不到添加不会在多次修订中持续存在的属性的方法.同样,如果提交不包含originalauthor"属性,似乎也没有一种方法可以使用提交钩子来保证删除它.

However, I can't see a way to add a property that won't persist through multiple revisions. Similarly, there doesn't seem to be a way of using commit hooks to guarantee the "originalauthor" property will be removed if there's a commit which doesn't include it.

我总是可以重写服务器上的密码文件,以允许我使用他们的用户名提交,然后恢复原始密码文件,但这看起来很笨拙(并且不能让我跟踪它已在他们的用户名下签入的事实)代表).或者我可以创建一个额外的用户(因此对于每个用户 A",都有一个用户 A 代理"),我可以用它来检查更改.这些选项似乎都没有吸引力.

I could always rewrite the password file on the server to allow me to commit under their username and then restore the original password file, but that seems clunky (and doesn't let me track the fact that it was checked in on their behalf). Or I could create an additional user (so for every "User A" there's a "User A Proxy") which I could use to check in changes. Neither of these options seem appealing.

有什么建议或想法吗?

推荐答案

Subversion 有两种属性

Subversion has two kinds of properties

  • 文件或目录的属性.这些属性是版本化的
  • 修订属性.这些特定于它们所应用的还原.

第一种类型仅在您希望标记文件的所有版本时有用.

The first type is only usefull if you want all versions of the file to be marked.

为了标记特定路径,Subversion 项目本身将原始作者以一种特殊格式添加到日志消息中,由 contribulyzer 脚本读取:

To mark a specific path the Subversion project itself adds the original author to the log message in a special format that is read by the contribulyzer script:

Patch by: Jan Jansen <jan@example.com>

但是如果你有可用的工具(并且可以假设 subversion 1.5+)你也可以使用

But if you have tooling available (and can assume subversion 1.5+) you could also use

svn commit --with-revprop "original-author=Jan Jansen <jan@example.com>" 

创建原始作者修订属性.

to create a orignal-author revision property.

要检索属性,您可以使用 svn log 为:

To retrieve the property you can then use svn log as:

svn log <...> --with-revprop original-author

这篇关于如何在 SVN 中为单个文件的单个修订设置属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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