可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
Currently I would simply like to find all files that have not been modified in the last X days but ultimately I would like to be able to make more complex queries against my subversion repository.
Is there a Subversion Query Language of some sort or an API that I could use?
回答1:
You can use svn log command to produce an XML file with a lot of information about all commits like this:
svn log URL --xml --verbose > commits.xml
There are some more options you can play with to limit the revision range, get more information on rev props, include merge info, etc.
The problem then becomes "how do I perform queries on the content of an XML document", which is easier than working with the existing SVN APIs. For example, in C# you can do LINQ queries on XML.
回答2:
You could use the SvnQuery project (http://svnquery.tigris.org) which has the intention to provide a query interface for doing such queries. It has a .NET API and a web frontend, providing the same query language. You can do complex queries with operators, nested expressions, wildcards, phrases and gap phrases. The operator you ask for, calculating the difference between now and the last commit date, is not implemented, but as it is an open source project you can either volunteer to do it or post a feature request for it :-)
回答3:
Currently no, there's no subversion query language or query based api that's in widespread use (ok, now watch someone contradict me, that's life on the net I suppose).
This means you're limited to splicing together the outputs from the normal svn commands like
svn info
and
svn log
I'm sure something like bash or powershell could make this at least feasible. If you're stuck with windows batch, I'd start crying now.
回答4:
there is no repository query language or search api. for complex queries, you would need an repository indexer (like http://supose.soebes.de/wiki/supose) or a commit database (like http://www.viewvc.org/). http://markmail.org/thread/wszzgnrny6o2r7u7 has some more links.
回答5:
With Powershell you can do some nice querying on the log messages
$data = [xml] (svn log -r "r1:r2" --xml)
$data.log.logentry | where-object {$_.message -match "regex"}
Or even on the files changed (with some required magic to avoid a well-known powershell issue)
$diff = [xml] (svn diff -r "r1:r2" --xml --summarize | %{$_ -replace "item", "item1"})
$diff.diff.paths.path | where-object {$_.item1 -eq "file"}
回答6:
You may want to checkout VoilàSVN or OpenGrok
回答7:
As already mentioned, svn log/info can be combined with shell commands to find what you want. Alternatively, you could directly use SVN's own API in C/C++ to programmtically process repository enties. SVN has Python bindings. If Java is your language of choice, try http://svnkit.com/
回答8:
Check Fisheye . Really cool .
http://211.144.86.166/software/fisheye/docs/EyeQL%20Reference%20Guide.html
回答9:
Apart from using a Subversion command-line or a graphical client such as TortoiseSVN to view svn repository history, you can install an advanced web interface for Subversion repos.
For example, in VisualSVN Server 3.2 and newer you can use a web-based revision history viewer, see the demo here.
See the description of the HTML5-based web svn client here.
回答10:
Since 1.7 SVN, the working copy has a wc.db file in the .svn directory. It is a basic sqlite database, so pretty easy to query.
You should make sure your working copy is up-to-date. If you are doing anything more than a quick and simple select, it would be safer to copy the file rather than risk breaking it.
The change date is based on the unix epoch. For example:
sqlite3 .svn\wc.db "select changed_revision, datetime((changed_date/1000000),'unixepoch') changed_date, changed_author, repos_path from NODES"