I love Perforce as an SCM system - it’s not as dead simple as SVN but it’s pretty simple to use once you understand what a clientspec is (in fact I wrote the Perforce SCM plugin for Maven 2.x).
I like cygwin - the installer is horrible but it works ok once you get past that.
The problem is that the two don’t work too well together. cygwin likes to use pseudo-unix paths on Windows that look like /cygdrive/c/src/foo/bar instead of c:\src\foo\bar. So when you create a bash script to automate some file chore, those paths are used. Well, Perforce doesn’t understand those paths. Others have suggested creating a clientspec whose root matches the cygwin syntax and use that clientspec with the cygwin tools. My solution is simpler but non-obvious: use the cygpath command to convert the cygwin path to a standard windows path but it must be an absolute path. If it is not an absolute path, p4 tries to resolve the path and cygwin will hand it a cygdrive-style path again.
p4 edit `cygpath -a -w $file`
I hope this helps someone else with the same problem!
3 responses so far ↓
1 Tony Smith // Jun 15, 2007 at 3:37 am
Hi Mike,
Thanks for your comments - glad you like Perforce. One thing that might also help you is to use the Cygwin client instead of the win32 client, as that understands Cygwin paths.
Try this one:
http://filehost.perforce.com/perforce/r07.2/bin.cygwinx86/p4.exe
Obviously you need to make sure that this p4.exe is ahead of the Windows one in your PATH.
2 P4 Cygwin client does not work for me // Jul 26, 2007 at 9:17 pm
The Cygwin Perforce client does not work for me or a colleauge. We still get “path is not under client’s root.
3 Jonathan // Jul 21, 2008 at 7:12 am
Try adding the following to your .bashrc and then p4 from commandline just works:
function p4() {
export PWD=`cygpath -wa .`
/cygdrive/c/Program\ Files/Perforce/p4.exe $@
}