开发者

Mercurial: Get non-versioned copy of an earlier version of a file

How do I get a non-versioned copy of an older version of a file from a mercurial repository?

Edit: I have changed somefile.png (binary file) in my local copy. I am looking for a command which will allow me to get an earlier version of somefile.png so that I can com开发者_运维技巧pare it with my modified copy (using an image viewer) before I commit changes. How can I do that?


The command you are looking for is cat

hg cat [OPTION]... FILE...

output the current or given revision of files

hg cat -o outputfile.png -r revision somefile.png

You can then compare somefile.png with outputfile.png


If you mean: what is the equivalent of svn export?, that would be:

hg archive ..\project.export

See also this TipsAndTrick section

Make a clean copy of a source tree, like CVS export

hg clone source export
rm -rf export/.hg

or using the archive command

cd source
hg archive ../export

The same thing, but for a tagged release:

hg clone --noupdate source export-tagged
cd export-tagged
hg update mytag
rm -rf .hg

or using the archive command

cd source
hg archive -r mytag ../export-tagged


There's a tip on the hgtip that might get you most of the way there:

Merging binary files

While it specifically talks about merging, the diff stuff should be generic enough to do it outside a merge...


I'm not sure I understand the question. You you could just copy it somewhere else using the normal file copy tools of your operating system.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜