我终于让我的团队从 SourceSafe 切换到 Subversion。 不幸的是,我的经理仍然想对每个文件使用独占锁。 因此,我在每个文件上设置了 svn:needs-lock 属性,并创建了一个预提交挂钩以确保该属性保持设置状态。
我们在 Linux 服务器上运行 Subversion。 我们大多数人使用 Windows 机器,少数人使用 Mac。 我们正在使用各种 SVN 客户端(TortoiseSVN、SmartSVN、Subclipse 等)。
我们现在需要的是一种好/简单的方法来查看当前在整个存储库中锁定的所有文件(以及谁锁定了它们)。 我在 Tortoise 和 Subclipse 中浏览了一下,但没有找到我想要的东西。 我们的项目有许多深层次的子目录,因此查看每个单独的目录会非常耗时。
我想要的是一个可以运行的单一报告,其中列出了当前锁定的所有内容以及锁定者。 获取此类信息的最佳方式是什么?
I finally got my group to switch from SourceSafe to Subversion. Unfortunately, my manager still wants to use exclusive locks on every single file. So I set the svn:needs-lock property on every file and created a pre-commit hook to make sure the property stays set.
We are running Subversion on a Linux server. Most of us use Windows machines and a few use Macs. We are using various SVN clients (TortoiseSVN, SmartSVN, Subclipse, etc.).
What we now need is a good/easy method to see all the files that are currently locked in the entire repository (and who has them locked). I have poked around a little in Tortoise and Subclipse, but haven't found what I am looking for. Our projects have many subdirectories that are multiple levels deep, so it would be too time consuming to look at each individual directory.
What I would like is a single report I can run that lists everything that is currently locked and who has it locked. What is the best way to get this type of information?
发布评论
评论(4)
您正在寻找的是
svnadmin lslocks
命令。我在工作中进行了此设置,因为我们在 Subversion 存储库中保存了一些 Word 文档(使用
svn:needs-lock
)。 我设置了一个 cron 作业,每天都会检查锁列表,并将超过 7 天的所有锁的报告通过电子邮件发送给整个团队。 这样我们就可以知道谁长期偷懒并坐在锁定的文档副本上。What you're looking for is the
svnadmin lslocks
command.I have this set up at work because we keep some Word documents in our Subversion repository (with
svn:needs-lock
). I have a cron job set up that every day, checks the list of locks and emails a report of all locks older than 7 days to the whole team. That way we can tell who has been slacking and sitting on a locked copy of a document for a long time.这可能不是您正在寻找的答案,但您应该尝试让经理相信锁实际上不是最佳的开发实践。 关于这个主题已经有很多文章了,所以我不会在这里重复。
当您从锁定环境转到没有强制结帐锁定的环境时,起初您认为这会导致混乱,但事实并非如此。 当两个人处理同一个文件时,SVN 擅长合并更改,即使最终出现冲突,修复它们也不是那么糟糕。
比等待那个带着重要文件出去吃午饭的人要好得多,或者更糟糕的是,去度假。
This might not be the answer you're looking for, but you should try to convince the manager that locks are actually not the best development practice. There's lots out there that's been written on this subject, so I won't repeat it all here.
When you go from a locking environment to one with no enforced checkout locks, at first you think it will lead to chaos, but it really doesn't. SVN is good at merging changes when two people are working on the same file, and even if you end up with conflicts, it's not so bad to fix them.
Much better than waiting around for the guy who went to lunch with a critical file checked out, or worse yet, went on vacation.
要查看您和其他人持有哪些锁,您可以使用 TortoiseSVN → 检查修改...本地持有的锁令牌会立即显示。 要检查其他人持有的锁(并查看您的锁是否被损坏或被盗),您需要单击“检查存储库”。
To see what locks you and others hold, you can use TortoiseSVN → Check for Modifications.... Locally held lock tokens show up immediately. To check for locks held by others (and to see if any of your locks are broken or stolen) you need to click on Check Repository.
您可以使用 svn status --show-updates 从本地结帐发现锁定,这会在服务器上锁定的所有文件之前放置一个
O
。例如,
请参阅 svnbook 了解更多详情
You can discover locks from a local checkout using
svn status --show-updates
which will put anO
before all files which are locked on the server.e.g.
see the svnbook for more details