开发者

In Mercurial, is it possible to export a file from a given commit?

Let's say I have a file main.c that I have been coding on. I am already on commit #100 but unfortunately I discovered I need to recover some functions I had coded in commit #50. I know I can use the Repository Explorer to see the differences between different versions on this file, but what I'd like to see is the file itself, as it was on commit #50 (without all those +'s and -'s -- just the file as it was at that time).

Is that possible?

I wouldn't want to have to make a commit to #50 just to get those functions and then have to go back to #1开发者_开发知识库00.

Thanks


hg cat will export the file. To commit on this revision, you need hg up. For example, use

hg cat -rC F

to retrieve revision C of file F.


Do the following

hg update -r 50 that_file
cp that_file /to/some/other/location/
hg update -r 100 ---> to get back the new file

Now you have two files

  1. One in repo at revision 100
  2. The other at /to/some/other/location/ at revision 50
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜