如何在Mercurial中查看文件的先前版本 [英] how to view previous version of a file in Mercurial
问题描述
我正在使用mercurial对目录中的几个文件进行版本控制.假设我有10次提交(10个变更集或修订).我只想查看特定文件(例如thisFile.py)在其第七修订版中的外观.我不想恢复到该旧版本.我不想去做任何更改或修复此先前版本中的任何错误.我只是想查看它,而不会以任何方式影响文件的最新版本或商品历史.有简单的方法吗?
I am using mercurial for version control of a few files in a directory. Suppose I have 10 commits (10 changesets or revisions). I want to just view how a particular file, say thisFile.py, looked in its 7th revision. I don't want to revert back to this older version. I don't want to go and make any changes or fix any bugs in this previous version. I simply want to see it, without affecting the latest version of the file or the mercurial history in any way. Is there a simple way to do it?
推荐答案
将hg cat
命令与-r
(修订)参数一起使用.
Use the hg cat
command with the -r
(revision) argument.
hg cat path_to/myfile.cpp -r 46
其中46是修订号(使用hg log
查看修订历史)
where 46 is the revision number (use hg log
to see revision history)
这篇关于如何在Mercurial中查看文件的先前版本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!