SVN:是否可以获取给定路径的修订号列表?
我正在制作一个连接到存储库、下载提交列表并将其存储在本地的 PHP 工具。但是,由于某些存储库可能很大并且抓取其日志会导致长时间的等待时间和可能的超时/错误,我想使用异步请求下载每个提交消息。
因此,我在修订历史记录中有一个起点和终点,我可以像这样获取所有日志:
svn log -r
...我最终可能会得到一个非常大的 XML 文件,需要很长时间才能下载,需要很长时间和大量资源来解析,并且需要很长时间来存储。
如果我知道起点和终点,我可以创建一个 for() 循环来逐一获取修订:
svn log -r
但是,由于我不知道给定路径存在哪些特定修订,因此我将收到错误。我可以让应用程序在更新期间忽略该错误,但这是一个令人讨厌的黑客行为,它会发布请求并等待响应 - 这一点都不好。
所以,我需要这样的东西:
- “给我这个路径的修订号列表”,或者:
- “给我这个路径的修订号列表,在 和 之间,
这样我就能够做出一系列有效的修订获取存储库路径并一一获取它们,
欢迎所有建议,提前致谢。
I am making a PHP tool that connects to a repository, downloads the list of commits and stores them locally. However, due to the possibility that certain repositories are HUGE and grabbing their log results in long waiting time and possible time-outs/errors, I would like to download each commit message using async requests.
So, I have a start and end points in revision history, and I can grab all logs like this:
svn log -r <from_revision>:<to_revision> <REPO_URL>
... and I will possibly end up with an XML file which is so huge that it will take long time to download, long time and lots of resources to parse, and long time to store.
If I know the start and the end point, I can create a for() loop to grab revisions one by one:
svn log -r <revision> ...
BUT, since I don't know which specific revisions exist for given path, I will receive an error. I can make the application to ignore that error during the update, but it's a nasty hack and it will post requests and wait for the responses anyway - which is not good at all.
So, I need something like this:
- "give me the list of revision numbers for this path", OR:
- "give me the list of revision numbers for this path, between and
That way I would be able to make an array of valid revisions for the repository path and get them one by one.
All suggestions are welcome, thanks in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
我认为最好的选择是执行以下 svn log -l 100 0:{$newest} .\ 这将检索给定目录或文件的前 100 个日志。然后读取返回的最后一个修订号,然后请求接下来的 100 个 svn log -l 100 {$last_ret_log}:{$newest} .\
这样,每个请求都会获得 99 个新日志条目,但您不会得到所有的。
I think your best bet would be to do the following
svn log -l 100 0:{$newest} .\
that will retrieve the first 100 logs for a given directory or file. then read the last revision number returned, then request the next 100svn log -l 100 {$last_ret_log}:{$newest} .\
that way you get 99 new log entries with each request but you wont get all of them.
我只是想得到类似的结果。
我只想要特定分支的所有修订号。
我发现以下内容非常有帮助。
这给了我一个文件,其中所有修订号都在不同的行上。
希望您或其他人会发现它有帮助。
我们的存储库有超过 25000 个修订,生成此文件需要几秒钟的时间。
I have just been trying to get a similar result.
I just want all the revision numbers for a particular branch.
I found the following to be quite helpful.
This gives me a file with all the revision numbers on separate lines.
Hopefully, you or someone else will find it helpful.
Our repo has over 25000 revisions and it takes a couple seconds to produce this file.
如果您有权访问 Subversion 服务器上的存储库树,则可以使用 svnlook History 来获取修订号列表。
更多详细信息请访问 http://svnbook.red-bean.com/ en/1.1/re49.html。
If you have access to the repository tree on your Subversion server, then you can use
svnlook history
to get a list of revision numbers.More details can be found at http://svnbook.red-bean.com/en/1.1/re49.html.
您可能想查看
svn list
。因此,为了您的目的:
这列出了任何文件的最后(头)修订版。
You may want to look at
svn list
.So for your purpose:
This lists the last (head) revision of any file.
如果你想找到下一个较旧的(较小的)版本(版本)
例如
fromReversion 大于 toReversion
如果你想找到下一个更新(更大)的版本(版本)
if U want to find the next older(smaller) reversion( version )
for example
fromReversion greater than toReversion
if U want to find the next newer(bigger) reversion( version )