[Perforce] Syncing a previous revision to temporary location

I have a script that needs to access the previous revision of a file for doing a transfer process. I know that I can go into a file’s history and right-click on a revision and select “Open” and it will copy that revision to temporary location prior to opening. Is there a way to do this or something like it via commands? I just need to import a previous revision of an obj and I’d rather not deal with syncing that version and reverting back to the prior state if I can.

Not sure if this is exactly what you need, but ‘p4 print’ allows you to grab any file’s/revision’s content, and dump it into a new file or string.

http://www.perforce.com/perforce/doc.current/manuals/cmdref/print.html#1040665

I don’t know if that’s the only method but it certainly works.

p4.fetch_print(temp_file, depot_path#revision)

Thanks