如何查看旧版本的 SVN 文件?
我有一个 SVN 文件,现在缺少一些逻辑,所以我需要回溯到它具有我需要的逻辑时的大约 40 个修订版。除了尝试在命令行中查看文件的差异(很难阅读)之外,有什么方法可以获取该文件的副本进行查看,以便我可以研究它来恢复部件?
I have an SVN file which is now missing some logic and so I need to go back about 40 revisions to the time when it had the logic I need. Other than trying to view a diff of the file in the command line (very hard to read), is there any way I could get a copy of that file to review so I can study it to recover parts?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(6)
您可以更新到较旧的版本:
或者您可以直接查看文件:
You can update to an older revision:
Or you can just view the file directly:
将当前工作修订版的文件与另一个修订版的相同文件进行比较也很有趣。
您可以执行以下操作:
It is also interesting to compare the file of the current working revision with the same file of another revision.
You can do as follows:
更新到特定修订版:
Update to a specific revision:
我相信查看修订的最佳方式是使用方便您的程序/应用程序。我喜欢使用 trac : http://trac.edgewall.org/wiki/TracSubversion
它提供一个很棒的 svn 浏览器,可以很容易地返回你的修改。
为您想要检查的一个特定修订版进行此设置可能有点过分,但如果您将来要经常这样做,它可能会很有用。
I believe the best way to view revisions is to use a program/app that makes it easy for you. I like to use trac : http://trac.edgewall.org/wiki/TracSubversion
It provides a great svn browser and makes it really easy to go back through your revisions.
It may be a little overkill to set this up for one specific revision you want to check, but it could be useful if you're going to do this a lot in the future.
直接回答如何“获取该文件的副本”的问题:
然后您可以使用任何查看器或比较程序查看新创建的
file_r666
,例如很好地显示差异。
我发布了答案,因为接受的答案的命令实际上没有提供文件的副本,并且因为 svn cat -r 666 file | vim 不适用于我的系统 (
Vim: 读取输入时出错,退出...
)To directly answer the question of how to "get a copy of that file":
then you can view the newly created
file_r666
with any viewer or comparison program, e.g.nicely shows the differences.
I posted the answer because the accepted answer's commands do actually not give a copy of the file and because
svn cat -r 666 file | vim
does not work with my system (Vim: Error reading input, exiting...
)使用最新版本的 Subclipse,您实际上可以在不使用 cmd 提示符的情况下查看它们。在文件上,只需右键单击 =>团队 =>切换到另一个分支/标签/修订。除了修订字段之外,您单击选择,您将看到该文件的所有版本。
Using the latest versions of Subclipse, you can actually view them without using the cmd prompt. On the file, simply right-click => Team => Switch to another branch/tag/revision. Besides the revision field, you click select, and you'll see all the versions of that file.