I just put the wraps on the code for the Perforce Plugin for OnTime 2006. You can expect it in the next beta drop we do.
Coming from using VSS and Vault, perforce seemed very complex initially. Thankfully, they have extensive documentation on their website, which really helped accelerate my learning curve. The Perforce plugin for OnTime will support all the same functionality as the existing plugins; you can check items in and out from OnTime, view the history of a file, and see a file at a specific revision.
There was quite a challenging issue I had to overcome while writing this, and Google proved no help, so I thought I'd document it here.
When you submit a changelist through perforce's command line, it normally pops up a form (using notepad by default) where you can put in a description (comments) of your changelist. In VSS and Vault, I could specify comments through the commandline:
vault checkin “myfile.cs” -c “my comments here” (or something like that)
Perforce doesn't support that, but it does support reading in a file from disk that contains that form, so you can issue this command:
p4 submit -i < “mychangelist.txt”
However, there's a problem when trying to do this through .NET. Rather than just being able to say:
Process p = new Process();
p.StartInfo.FileName = @”c:\program files\perforce\p4.exe”;
p.StartInfo.Arguments = “ -i < \”mychangelist.txt\””;
p.StartInfo.UseShellExecute = false;
I had to use the Process object's StandardInput property to actually write the contents of that file directly to the process. I'm not 100% sure why that is (any of you reading this that know the reason, by all means let me know), but it took some probing and guesswork to find the solution:
Process p = new Process();
p.StartInfo.FileName = @“c:\program files\perforce\p4.exe“;
p.StartInfo.Arguments = “ -i “;
p.StartInfo.UseShellExecute = false;
p.StartInfo.RedirectStandardInput = true;
p.Start();
p.StandardInput.WriteLine(/* contents of the file here */);
p.StandardInput.Flush();
p.StandardInput.Close();
And success! Our changelist gets submitted.
We're really thrilled with all the feedback we've gotten so far from Beta 1. Keep it coming! We'll be doing another Beta drop here in the coming weeks, which will include the perforce plugin, as well as other new features.