Xoliul
Xoliul

Reputation: 23

P4 Sync command with local paths?

I'm trying to call a p4 sync command on a local path from within python.

P4dir = "D:/Perforce/Project/*"
subprocess.call("p4 sync " + P4dir)

This fails with a non-existing directory error. However, if i call the sever path, it works fine:

P4dir = "//depot/Project/*"
subprocess.call("p4 sync " + P4dir) 

This is probably extremely simple and I'm a bit embarassed i have to ask, but the documentation for P4 commandline arguments is lacking a lot.

So is there perhaps a way to translate a local path, should be simple by just checking the mappings?

Upvotes: 2

Views: 3655

Answers (2)

Paul
Paul

Reputation: 4430

You can use p4 where to convert local paths. Example:

$ p4 where /home/user/perforce/project
//depot/project //the_workspace/project /home/user/perforce/project

I tired this on a Linux box so the local path is *nix style, but it should work on Windows as well. p4 where also works with relative paths like ./some_folder which is very handy.

Upvotes: 3

dig
dig

Reputation: 449

I'm suspecting P4 does not realise that you intended to pass it a local path. (In Unix sense, it does not look like one.) Have you tried executing p4 sync * with D:/Perforce/Project its current directory?

On a different tack, if your P4 binaries have been built with Cygwin, you may be able to specify the path as /cygdrive/d/Perforce/Project.

Upvotes: 1

Related Questions