SVN:是否可以获得给定路径的修订号列表? [英] SVN: Is it possible to get the list of revision numbers for given path?

查看:30
本文介绍了SVN:是否可以获得给定路径的修订号列表?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在制作一个连接到存储库、下载提交列表并将它们存储在本地的 PHP 工具.但是,由于某些存储库可能很大并且抓取它们的日志导致长时间等待和可能的超时/错误,我想使用异步请求下载每个提交消息.

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 :

...我最终可能会得到一个非常大的 XML 文件,它需要很长时间才能下载,需要很长时间和大量资源来解析,并且需要很长时间来存储.

... 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.

如果我知道起点和终点,我可以创建一个 for() 循环来一一抓取修订:

If I know the start and the end point, I can create a for() loop to grab revisions one by one:

svn log -r ...

但是,由于我不知道给定路径存在哪些特定修订,我将收到错误消息.我可以让应用程序在更新期间忽略该错误,但这是一个令人讨厌的黑客行为,它会发布请求并等待响应 - 这一点都不好.

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:

  • 给我这个路径的修订号列表",或者:
  • "给我这个路径的修订号列表,介于 和

这样我就可以对存储库路径进行一系列有效的修订,并逐一获取它们.

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.

推荐答案

我认为最好的办法是执行以下 svn log -l 100 0:{$newest} .\检索给定目录或文件的前 100 个日志.然后读取返回的最后一个修订号,然后请求下一个 100 svn log -l 100 {$last_ret_log}:{$newest} .\

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 100 svn log -l 100 {$last_ret_log}:{$newest} .\

这样一来,每个请求都会获得 99 个新的日志条目,但不会全部获得.

that way you get 99 new log entries with each request but you wont get all of them.

这篇关于SVN:是否可以获得给定路径的修订号列表?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆