SVN:是否可以获取给定路径的修订号列表?

发布于 2024-08-08 16:25:06 字数 663 浏览 12 评论 0原文

我正在制作一个连接到存储库、下载提交列表并将其存储在本地的 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

追风人 2024-08-15 16:25:06

我认为最好的选择是执行以下 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 100 svn 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.

筱果果 2024-08-15 16:25:06

我只是想得到类似的结果。
我只想要特定分支的所有修订号。

我发现以下内容非常有帮助。

svn log <svn_server_path> | grep "^r[0-9]\+ | " | cut -d' ' -f1 | cut -c2- > revisions.csv

这给了我一个文件,其中所有修订号都在不同的行上。

希望您或其他人会发现它有帮助。

我们的存储库有超过 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.

svn log <svn_server_path> | grep "^r[0-9]\+ | " | cut -d' ' -f1 | cut -c2- > revisions.csv

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.

笑叹一世浮沉 2024-08-15 16:25:06

如果您有权访问 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.

执妄 2024-08-15 16:25:06

您可能想查看svn list
因此,为了您的目的:


$ svn list --verbose file:///var/svn/repos
     16 sally         28361 Jan 16 23:18 README.txt
     27 sally             0 Jan 18 15:27 INSTALL
     24 harry               Jan 18 11:27 examples/

这列出了任何文件的最后(头)修订版。

You may want to look at svn list.
So for your purpose:


$ svn list --verbose file:///var/svn/repos
     16 sally         28361 Jan 16 23:18 README.txt
     27 sally             0 Jan 18 15:27 INSTALL
     24 harry               Jan 18 11:27 examples/

This lists the last (head) revision of any file.

仅冇旳回忆 2024-08-15 16:25:06
svn log url -l limitNumber - r fromReversion:toReversion

如果你想找到下一个较旧的(较小的)版本(版本)
例如

   svn log url -l 4 -r someVersion:1
 or
   svn log url -l 4 -r 99: 3

fromReversion 大于 toReversion
如果你想找到下一个更新(更大)的版本(版本)

  svn log url -l 4 -r someVersion:head
or   
  svn log url -l 4 -r 3:99
   fromReversion lower than toReversion
svn log url -l limitNumber - r fromReversion:toReversion

if U want to find the next older(smaller) reversion( version )
for example

   svn log url -l 4 -r someVersion:1
 or
   svn log url -l 4 -r 99: 3

fromReversion greater than toReversion
if U want to find the next newer(bigger) reversion( version )

  svn log url -l 4 -r someVersion:head
or   
  svn log url -l 4 -r 3:99
   fromReversion lower than toReversion
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文