How can I download/sync file in P4V/p4python locally?

968 Views Asked by At

I am trying to download/sync locally into my Perforce workspace a file from another stream of my P4V, I've tried p4.run_sync("-f", "//depot-of-file") in my python script but it doesn't work. Any idea?

1

There are 1 best solutions below

2
Samwise On

The sync command will download files according to your current client view. If your client is viewing a stream that doesn't include the file, you can't sync it. There are three different solutions depending on what exactly you're trying to do:

  1. Switch your client to a stream/view that does include that file.
  2. Modify your current stream to import that file, e.g.:
    Paths:
        share ...
        import path/some_file //depot/path/some_file
  1. Use p4 print to download a copy of that file that's disconnected from the depot (you won't be able to make changes to it, and you will need to delete it manually later):
    p4 print -o some_file //depot/path/some_file