如何列出所有提交到存储库的文件?

发布于 2024-08-10 14:28:31 字数 486 浏览 6 评论 0原文

我如何让 SVN 列出曾经提交到存储库的所有文件(如果可能,以及位置和修订版本)。

更准确地说:我需要所有曾经存在的路径。

如果有人知道如何对整个存储库(包括所有修订版)进行全文搜索,这会对我有更好的帮助。

示例

假设我提交了一个文件 SomeFileOne.txt,稍后将其重命名为 SomeFileTwo.txt

执行所需的任务(我正在寻找的解决方案)后,我不仅应该获得 SomeFileTwo.txt,而且还应该获得 SomeFileOne.txt

...
/trunk/SomeProject/SomeFileOne.txt - revision 100
/trunk/SomeProject/SomeFileTwo.txt - revision 101
...

How could I let SVN list all files which were ever committed to a repository (if possible, along with location and revision).

More exactly: I need all ever existed paths.

If someone knows how to do a fulltext search on the entire repository (including all revisions), this would help me even better.

Example

Let's say I commit a file SomeFileOne.txt, later rename it to SomeFileTwo.txt.

After performing the required task (for which solution I'm looking for), I should get not only SomeFileTwo.txt, but also SomeFileOne.txt.

...
/trunk/SomeProject/SomeFileOne.txt - revision 100
/trunk/SomeProject/SomeFileTwo.txt - revision 101
...

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(4

错爱 2024-08-17 14:28:31

通过玩发现了一些东西。

一个缓慢而肮脏的解决方案可能是:

svnadmin dump MY_REPO | grep Node-path

输出看起来像:

* Dumped revision 3039.
Node-path: trunk/proj1/src/p/keywords/main/NoOp.java
Node-path: trunk/proj1/src/p/keywords/main/ScopeDecl.java
* Dumped revision 3040.
Node-path: trunk/myCommons/src/i/IConverter.java
Node-path: trunk/myCommons/src/i/ListUtils.java
* Dumped revision 3041.
Node-path: trunk/proj1/src/p/execution/impl/IterativeExecuter.java
Node-path: trunk/proj1/src/p/keywords/DeclConstant.java

嗯,至少它解决了我的问题。

注意:显示转储修订版...,因为它是stderr

Found out something by playing around.

A slow-and-dirty solution might be:

svnadmin dump MY_REPO | grep Node-path

Output looks like:

* Dumped revision 3039.
Node-path: trunk/proj1/src/p/keywords/main/NoOp.java
Node-path: trunk/proj1/src/p/keywords/main/ScopeDecl.java
* Dumped revision 3040.
Node-path: trunk/myCommons/src/i/IConverter.java
Node-path: trunk/myCommons/src/i/ListUtils.java
* Dumped revision 3041.
Node-path: trunk/proj1/src/p/execution/impl/IterativeExecuter.java
Node-path: trunk/proj1/src/p/keywords/DeclConstant.java

Well, at least it solves my problem.

NOTE: Dumped revision ... is shown, because it's stderr.

不可一世的女人 2024-08-17 14:28:31

要获得 svn log -v 的改进、结构化输出,请使用以下 bash 脚本:

$ svn log -v | egrep '^   A' | cut -c 6- | sort | uniq

解释:

  • 获取给定路径的整个 svn 日志,
  • 仅选择以“A”开头的行,这是添加文件的 svn 日志输出。
  • 切掉前 5 个字符,即前面提到的添加信息
  • 对输出进行排序
  • 删除重复行(例如,如果稍后读取文件)

这也适用于结帐的子路径,您甚至根本不需要结帐,如果您提供存储库路径:

$ svn log -v https://github.com/schacon/kidgloves/ | egrep '^   A' | cut -c 6- | sort | uniq

结果:

/branches
/branches/testing (from /trunk:17)
/trunk
/trunk/README
/trunk/example.rb
/trunk/kidgloves.rb
/trunk/simple_rack.rb

正确,文件列表可能还不适合自动处理,但如果我可以这么说的话,它距离日志输出还有很长的路要走。享受。

For an improved, structured output to svn log -v, use the following bash script:

$ svn log -v | egrep '^   A' | cut -c 6- | sort | uniq

Explained:

  • fetch the whole svn log of the given path
  • select only lines starting with ' A', which is the svn log output for an added file.
  • cut away the first 5 chars, which is the mentioned add info
  • sort the output
  • remove duplicate lines (e.g. if a file was readded later)

This also works for subpaths of the checkout, you don't even need a checkout at all, if you provide the repository path:

$ svn log -v https://github.com/schacon/kidgloves/ | egrep '^   A' | cut -c 6- | sort | uniq

Result:

/branches
/branches/testing (from /trunk:17)
/trunk
/trunk/README
/trunk/example.rb
/trunk/kidgloves.rb
/trunk/simple_rack.rb

Right, the file list may not be perfect for automated processing yet, but it goes a long way from just the log output, if I may say so. Enjoy.

猫烠⑼条掵仅有一顆心 2024-08-17 14:28:31

对我来说, svn log -v 是一种更直观的方法 - 或者您已经尝试过吗?是否可以分享对存储库中所有文件提交的如此广泛的报告的需求?

To me, svn log -v would have been a more intuitive method - or have you already tried that ? Is it possible to share the need for requiring such an extensive report on all the file commits ever made in the repository?

怕倦 2024-08-17 14:28:31

如果您只是想浏览一下,您可以使用 svn Web 访问工具之一获得您想要的内容。综述写在这里。

If you just want to browse around you might get what you want with one of the svn web access tools. A roundup was written up over here.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文