Agnel Kurian
Agnel Kurian

Reputation: 59516

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 compare it with my modified copy (using an image viewer) before I commit changes. How can I do that?

Upvotes: 0

Views: 365

Answers (4)

RyanWilcox
RyanWilcox

Reputation: 13972

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

Upvotes: 0

David Sykes
David Sykes

Reputation: 49882

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

Upvotes: 4

VonC
VonC

Reputation: 1328712

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

Upvotes: 1

helium
helium

Reputation: 1078

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.

Upvotes: -2

Related Questions