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

mercurial, version-control

Solution

`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.

Problem

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 #100. Thanks

Original source