[英]Version control of users' metadata
I've got a question that most likely doesn't have a unique and clear answer. 我有一个问题,很可能没有唯一明确的答案。 In the team we are using the SVN, many of the people are using the git-svn
(treating it as a fancy SVN client). 在我们正在使用SVN的团队中,许多人都在使用git-svn
(将其作为git-svn
SVN客户端进行处理)。
We're storing some project related publications, reports, documents in the repository under let's say trunk/Documents/*
. 我们在仓库中存储一些与项目相关的出版物,报告,文档,比如trunk/Documents/*
。 Each of the users creates his own notes, annotations, etc. related to a given document - let's say trunk/Documents/doc1.txt
. 每个用户都创建自己的与给定文档相关的注释,注释等,比如说trunk/Documents/doc1.txt
。 Thus in the end we've got N users having doc1.txt.metadata
. 因此,最终我们有N个用户拥有doc1.txt.metadata
。
What are your recommendations for storing this metadata? 您对存储此元数据有何建议? Branches for each user metadata? 每个用户元数据的分支?
As the files are going to differ by user, the cleanest way I can think of is keeping text files like doc1.txt.metadata.username
. 由于文件会因用户而异,因此我想到的最干净的方法是保留doc1.txt.metadata.username
类的文本文件。 Keeping separate branches per user metafile sounds complicated to me, and hard to work with in everyday use. 对每个用户图元文件保留单独的分支对我来说听起来很复杂,并且在日常使用中很难使用。
There would be be the idea of automating this using a pre- and/or post-commit hook, but it is discouraged in the SVN book : 会有使用提交前和/或提交后挂钩自动执行此操作的想法,但是在SVN书中不建议这样做 :
While hook scripts can do almost anything, there is one dimension in which hook script authors should show restraint: do not modify a commit transaction using hook scripts. 尽管挂钩脚本几乎可以执行任何操作,但挂钩脚本作者应表现出一种约束:不要使用挂钩脚本修改提交事务。 ... Instead of modifying the transaction, you should simply validate the transaction in the pre-commit hook and reject the commit if it does not meet the desired requirements. ...而不是修改事务,您应该只在预提交挂钩中验证事务,并在不符合所需要求的情况下拒绝提交。 As a bonus, your users will learn the value of careful, compliance-minded work habits. 作为奖励,您的用户将学习认真,合规的工作习惯的价值。
The simplest thing might be to establish doc1.txt.metadata.username
as a rule, and to write a pre-commit script that rejects any commits of .metadata
files without the current user name as the extension. 最简单的事情可能是建立doc1.txt.metadata.username
作为规则,并编写一个预提交脚本,该脚本拒绝不使用当前用户名作为扩展名的任何.metadata
文件的提交。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.