SVNQuery–如何建立更新索引並查詢

命令行工具SvnIndex用來維護subversion版本資源庫的全文本索引,它包括兩個子命令,分別用來建立、更新索引。  正則表達式

svnindex create <Index> <Repository> [Options] sql

上述命令在指定的索引位置Index爲位於Repository的版本資源庫建立索引,會覆蓋Index位置的內容. -r過濾器選項用來指定索引到的修訂版本號,若是-r選項忽略,默認爲最新版本。取決你的版本資源庫的大小,索引操做可能須要很長的一段時間,儘可能少索引一些修訂版本,確認基本的索引流程OK,而後更新索引到最新版本。 -f過濾器選項用來排除索引匹配指 
定的正則表達式的內容。例如,你或許須要排除tags文件夾下的內容,由於這個文件夾通常是些trunk或branches的備份。 
svnindex update <Index> <Repository> [Options] 
上述命令在指定的索引位置Index爲位於Repository的版本資源庫更新索引。Index 是在本地文件系統上的文件夾路徑 ,Repository 是本地文件系統上的版本資源庫的文件夾路徑或 經過http、svn協議進行訪問的有效url。 
使用 SvnIndex的例子 服務器

在咱們的例子中,版本資源庫位於 e:\Repository, 建立的索引文件位於e:\RepositoryIndex . 版本資源庫由svnserve啓動,位於server服務器上。 svn

  • 複製SvnIndex文件夾到你的版本資源庫的hooks文件夾。
  • 使用下述命令建立初始的索引文件,取決於你的版本資源庫的大小,可能須要花費些時間。 
    svnindex create e:\RepositoryIndex e:\Repository -x svn://server -n 「Source Repository」 -f 「(/tags/)|(/branches/)」
  • 在hooks文件夾下建立post-commit.cmd 文件
  • 粘貼下述內容到post-commit.cmd 文件: 
    %~dp0SvnIndex\RunDetached %~dp0SvnIndex\svnindex.exe update e:\RepositoryIndex e:\Repository -f 「(/tags/)|(/branches/)」
  • 完成!

更多的使用 SvnIndex的例子 
命令:c:\SvnQuery_1.2.2.0\SvnIndex>SvnIndex.exe create c:\myIndex http://192.168.1.130/demo1/   -u ken -p ken 工具

其中 c:\myIndex是本地建立的索引文件夾, http://192.168.1.130/demo1/ 是遠程版本資源庫訪問地址,-u、-p指定用戶名和密碼。 post

執行結果日誌以下: url

c:\SvnQuery_1.2.2.0\SvnIndex>SvnIndex.exe create c:\myIndex http://192.168.1.130/demo1/ -u ken -p ken   SvnIndex 1.2.2.0   Begin indexing ... Revision 1 Revision 2 Index /75XT890/01-Start/trunk/03-UXD/媒體雲(包括家庭留言板)/媒體雲v1.5同k610/流程圖-雲相冊_files/u111_normal.png 1:99999999 ...... ...... Index /85XT910/01-Start/trunk/05-UED/4k2k/手勢控制/3切圖/未點擊切圖/頻道框.png 2:99999999 Index revision is now 2 Optimizing index ... Commit index Finished in 00:02:55

建立索引後,就能夠使用SVNFind來檢查一下建立的索引了,上圖: spa

svnfind

相關文章
相關標籤/搜索