[英]How to list switched svn directories recursively in a working copy?
我已經從存儲庫中簽出了一份工作副本,並將某些目錄切換到了不同的URL,但是在同一倉庫中(同一主機和svn服務器)。
如何列出這些切換的目錄?
我們將許多切換用於內部目的,這將有助於輕松地在工作副本中列出所有這些內容,直到消除了這種煩瑣的切換用法。
(1)@ ks1322提供的答案很簡潔,除了一個小的調整外,它的工作效果很好:一個人應該使用“ ^ URL”而不是“ URL”,因為有些文件也會報告Copied from URL
行Copied from URL
。 這是我的系統上的一些示例輸出,顯示了這個小問題:
URL: file:///C:/usr/tmp/SvnSandbox/branches/sub-branch1
URL: file:///C:/usr/tmp/SvnSandbox/branches/sub-branch1/commands
URL: file:///C:/usr/tmp/SvnSandbox/branches/sub-branch1/commands/show%20test.cmd
URL: file:///C:/usr/tmp/SvnSandbox/trunk/commands/subdir
URL: file:///C:/usr/tmp/SvnSandbox/trunk/commands/subdir/stuff.txt
URL: file:///C:/usr/tmp/SvnSandbox/branches/sub-branch1/commands/reversion_test.txt
URL: file:///C:/usr/tmp/SvnSandbox/branches/sub-branch1/file-on-branch1.txt
Copied From URL: file:///C:/usr/tmp/SvnSandbox/branches/branch1/file-on-branch1.txt
URL: file:///C:/usr/tmp/SvnSandbox/branches/sub-branch1/externals
URL: file:///C:/usr/tmp/SvnSandbox/branches/sub-branch1/file-on-branch-and-subbranch.txt
URL: file:///C:/usr/tmp/SvnSandbox/branches/sub-branch1/file-on-sub-branch1.txt
(2)對於Windows系統上的用戶,一個等效命令(使用PowerShell)為:
svn info --depth=infinity | Select-String ^URL
(3)但是對於具有更高信噪比的輸出,請嘗試以下操作:
Get-SvnInfo . -Recurse -ContainersOnly Path, URL |
Format-Table Path, `
@{ n='Branch'; `
e={$_.URL -replace ".*(trunk|branches/[^/]*).*", '$1'} }
該序列的輸出使您一目了然地了解了您需要了解的內容。 從我的第一個示例中使用的同一示例樹中,它揭示了以下內容:
Path Branch
---- ------
commands branches/sub-branch1
externals branches/sub-branch1
commands\subdir trunk
externals\commonlib trunk
externals\commonlib\textfiles trunk
(可從我的開源PowerShell庫中Get-SvnInfo
cmdlet,有關詳細信息,請參閱我的API書架上的PowerShell書。)
您可以使用以下命令以遞歸方式列出工作副本中所有文件和目錄的URL:
svn info --depth=infinity|grep URL
您將在輸出中看到切換的URL,因此也會看到切換的目錄。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.