問題描述
如何在 Subversion 存儲庫歷史記錄中查找文件? (How Do I Find a File in a Subversion Repository History?)
是否可以通過 Subversion 存儲庫的歷史來查找特定名稱的文件(更好的是讓它們進行通配符搜索)?
我想看看一個 .bat
文件在過去的某個時間點已提交到存儲庫,但在以後的更新中已被刪除。甚至每次修訂時都轉儲文件歷史記錄也可以,因為我可以 grep 輸出。我查看了手冊,但找不到一個好的方法。
每個提交的日誌都是描述性的,所以我不能只查看日誌消息來查看進行了哪些修改。我想 Subversion 確實有辦法檢索這個?
參考解法
方法 1:
TortoiseSVN can search the logs very easily, and on my system I can enter ".plg" in the search box and find all adds, modifies, and deletes for those files.
Without Tortoise, the only way I can think of doing that would be to grep the full logs or parse the logs and do your own searching for 'A' and 'D' indicators on the file you are looking for (use svn log ‑‑verbose
to get file paths).
svn log ‑‑verbose | grep .bat
方法 2:
I assume you are using the SVN command line client. Give TortoiseSVN a try. Its "Show Log" dialog allows searching for comments, filenames and authors.
http://tortoisesvn.net/downloads
PS: Windows only.
方法 3:
TortoiseSVN is completely sweet. I can't imagine dealing with Subversion without it.
Also, as a long shot, if you're using Eclipse I'd recommend the Subclipse plug‑in.
方法 4:
Personally I'd use
svnadmin dump ‑r1:HEAD /path/to/repo/
Pipe it into less and search or grep with some context.
方法 5:
svn log ‑v .bat
(by kaybenleroll、crashmstr、Ishmaeel、Owen、Philip Reynolds、Dinakar)