2008-12-24 76 views
23

如何搜索名爲foo.txt的文件是否曾提交給我的svn存儲庫(在任何修訂版本中)?如何在任何修訂版本中搜索svn存儲庫以查看是否存在文件

+0

我想簡單的答案是「搜索日誌」。你如何實現這一點取決於你如何與SVN交互,因此Martijn和我的不同答案。 – 2008-12-24 16:23:08

+0

那麼把亞當:)我首先回答了一個編碼的答案,但後來注意到相當明確的tortoiseSVN標籤。 – 2008-12-24 16:44:10

+1

對,我錯過了。不過,我會留下我的答案,有人可能會感興趣。 – 2008-12-24 16:46:42

回答

30

上籤出的文件夾的根目錄右鍵> TortoiseSVN的>顯示日誌

您可以輸入文件名一樣好那裏。

10

這應該爲你工作:

svn log -r 0:HEAD -v $REPOSITORY_PATH | grep "/foo.txt" 

這會給你從日誌路徑的文件和狀態。如果你有任何點擊,你知道它在某個時刻存在。如果沒有獲得結果,那麼在任何修訂版本中,存儲庫中的任何地方都不會匹配。您還可以看到美國從每個日誌行,例如:

 
    A /some/path/foo.txt 
    D /some/path/foo.txt 

但我猜額外的信息是不是對你的問題。 :)

4

使用Subversion 1.8+客戶端和new --search and --search-and options become available for svn log command。這些選項不允許進行倉庫內全文搜索和查找只有以下數據:

  • 修訂的作者(svn:author版本化的屬性),
  • 日期(svn:date版本化的屬性),
  • 日誌消息文本(svn:log未版本控制的屬性),
  • 已更改路徑(即受特定修訂影響的路徑)的列表。

據我猜測,你可以搜索 「foo.txt的」 使用以下命令行:

svn log -v --search "foo.txt"

下面是對這些新svn log搜索選項完整的幫助頁面:

If the --search option is used, log messages are displayed only if the 
provided search pattern matches any of the author, date, log message 
text (unless --quiet is used), or, if the --verbose option is also 
provided, a changed path. 
The search pattern may include "glob syntax" wildcards: 
    ?  matches any single character 
    *  matches a sequence of arbitrary characters 
    [abc] matches any of the characters listed inside the brackets 
If multiple --search options are provided, a log message is shown if 
it matches any of the provided search patterns. If the --search-and 
option is used, that option's argument is combined with the pattern 
from the previous --search or --search-and option, and a log message 
is shown only if it matches the combined search pattern. 
If --limit is used in combination with --search, --limit restricts the 
number of log messages searched, rather than restricting the output 
to a particular number of matching log messages. 
相關問題