如何判断 SVN 工作副本中的所有目录都指向同一个存储库根目录? [英] How can I tell that all directories in a SVN working copy point at the same repository root?

查看:35
本文介绍了如何判断 SVN 工作副本中的所有目录都指向同一个存储库根目录?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们最近遇到了一个问题,即 TortoiseSVN 或 AnkhSVN(我无法确定哪个)在切换 SVN 工作副本的过程中崩溃.我们的开发人员没有意识到切换不完整,一切都很好,直到将分支合并回主干,我们了解到一些更改已经提交到主干,并且一些更改已经提交到分行.

We recently had an issue where TortoiseSVN or AnkhSVN (I can't determine which) crashed in the middle of switching a SVN working copy. Our developer didn't realise that the switch was incomplete, and everything was fine until it came to merging the branch back to trunk, where we learned that some of the changes had already been committed to trunk, and some of the changes had been committed to the branch.

幸运的是,这实际上并没有影响任何事情,但我担心将来可能会再次发生这种情况,我需要一种快速的方法来测试工作副本中的子目录指向哪个存储库.现在,在 Linux 中,我可以非常快速地一起破解一个 shell 脚本来确定这一点,但我目前不知道如何在 Windows 中找到这一点.

Fortunately, this did not actually affect anything, but I am concerned that this may happen again in the future, and I need a speedy way to test which repository that subdirectories in a working copy point to. Now, in Linux, I could hack a shell script together very quickly to determine this, but I currently don't know how I might find this out in Windows.

如果必须的话,我并不完全反对使用 SharpSVN 一起破解某些东西(请放心,如果我愿意,我会分享它),但我想知道我是否可以通过内置一些东西来节省一些时间TortoiseSVN 或 AnkhSVN 功能为我做这件事.

I am not entirely against hacking something together using SharpSVN if I have to (and rest assured that I'll share it if I do), but I'd like to know if I can save some time by getting some built in TortoiseSVN or AnkhSVN feature to do it for me.

推荐答案

如果您可以使用 Powershell,请使用以下内容:

If you can use Powershell use something like below:

gci -Recurse | ?{ $_.psIsContainer -eq $true} | %{svn info $_.fullname} | select-string -Pattern "PATH:|URL:"

对于您工作副本中的每个文件夹,它都会显示您的存储库中的路径和 url.如果某个文件夹切换到一个分支,你可以看到那个url和路径.

For every folder in your working copy, it will display the path and the url from your repo. If some folder is switched to a branch, you can see that url and the path.

您可以轻松调整它以仅打印当前分支(或主干)之外的路径和网址

You can easily tweak it to print only the path and urls that are outside of your current branch ( or trunk )

忽略未版本控制的文件夹很容易:

Ignoring unversioned folders is easy:

(svn status $_.fullname) -notmatch "\?")

所以整个事情将是:

gci | ?{ $_.psIsContainer -eq $true -and ((svn status $_.fullname) -notmatch "\?")} | %{svn info $_.fullname} | select-string -Pattern "PATH:|URL:"

你需要有一个命令行 svn 客户端,比如 SlikSVN 或 CollabnetSVN 并且在路径上.

You need to have a command line svn client like SlikSVN or CollabnetSVN and on path.

这篇关于如何判断 SVN 工作副本中的所有目录都指向同一个存储库根目录?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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