如何在 CVS 中获取文件特定修订版的先前修订版
是否有任何 CVS 命令可以在给定文件名及其修订版本的情况下为我提供文件的先前修订版本?
Is there any CVS command that can give me previous revision of a file, given the filename and its revision?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
CVS 控制文件版本的方式是仅当该文件中有提交时才增加修订版本。树或标记等的更改不会影响单个文件的修订。
尽管没有明确的方法可以根据名称和版本来获取文件的先前版本...但是有一个围绕它的点击和试用方法。盲目地去之前的修改。例如,
Rev 1.5
的上一个版本将是Rev 1.4
另一种解决此问题的方法是编写 shell 脚本。使用 cvs log 获取特定文件名的更改日志并 grep 所需的修订号。
The way CVS controls the version of a file is that the revision is increased only when there is a commit in that file. The changes in the tree or tagging etc will not affect the revision of a single file.
Although there is no definite way of getting the previous revision of a file, given the name and it's revision... But there is a hit and trial method around it. Blindly go to the previous revision. For eg, the prev revision of
Rev 1.5
would beRev 1.4
Another way to sort this out is, to write a shell script. Use
cvs log
to get the change log of a particular filename and grep the desired revision number.没有直接的方法可以通过 CVS 命令执行此操作。但由于我在 java 中使用(CVS 日志)的输出,因此以下代码片段对我有用
上面的代码还处理分支修订,例如,如果当前修订(如图所示)是分支上的第一个修订,它将返回为该文件创建的分支的修订版本。
希望这有帮助。
There is no direct way to do this from CVS commands. But since I am using the output (of CVS log) IN java, following code snippet worked for me
Above code also handles branch revisions, for example, if the current revision (in picture) is the first one on branch that it will return the revision from which branch for that file was created.
Hope this helps.