[p4] PowerShell Integration

Bennett, Patrick Patrick.Bennett at inin.com
Fri Dec 1 10:18:43 PST 2006


You might think about getting with Tony Smith (of P4Ruby, P4PHP, P4Perl
fame) and maybe come up with a consistent approach/interface.
It would be nice if I could use Powershell P4 objects the same way I'm
used to using them in P4Ruby.
 
Patrick Bennett


________________________________

	From: Shawn Hladky [mailto:p4shawn at gmail.com] 
	Sent: Friday, December 01, 2006 1:07 PM
	To: Robert Cowham
	Cc: mancaus.40868864 at bloglines.com; perforce-user at perforce.com;
Bennett, Patrick
	Subject: Re: [p4] PowerShell Integration
	
	
	You may want to wait a bit before using P4.Net.  I have a large
set of changes queued up, and plan on submitting in the next couple of
days.  It will include quite a bit of documentation, a new sample
application, a couple bug fixes, and minor refactoring. 
	
	As for PowerShell, It looks really cool, but I haven't dug much
into how cmdlets work.  My guess is that a generic integration would be
pretty easy to pull off building on P4.Net... something like:
	
	p4-run changes -s pending ... 
	
	So the arguments would be identical to the std cli, but it would
return a rich object providing tagged output as a list of dictionaries.
In P4.Net, I call it a P4RecordSet.  I imagine accessing dictionary
elements by key in PowerShell is straight-forward. 
	
	This is similar to the approach I have in the MSBuild custom
task sample.  Rather than using the Ant/Nant paradigm, where there are
separate tasks for each Perforce activity (P4Sync, P4Label, P4Edit,
etc.), I have a single task to run any p4 command.  Then I abuse
MSBuild's ItemGroups and metadata to provide access to all the tagged
output for use later in the script.  In my next submit, I'll have a
sample MSBuild script that demonstrates the "working offline" technique
completely from MSBuild.  Except for some strange-looking MSBuild
transformations, it's quite simple, and you couldn't accomplish anything
close to that with the Ant/Nant paradigm. 
	
	
	
	On 11/30/06, Robert Cowham <robert at vaccaperna.co.uk> wrote: 

		No need to start from scratch:
		
		Courtesy of Shawn Hladky:
		
	
http://public.perforce.com:8080/@md=d&cd=//guest/shawn_hladky/&ra=s&c=CQ
u@// 
		guest/shawn_hladky/P4.Net/?ac=83
		
		Robert
		
		> -----Original Message-----
		> From: perforce-user-bounces at perforce.com
		> [mailto: perforce-user-bounces at perforce.com
<mailto:perforce-user-bounces at perforce.com> ] On Behalf Of
		> mancaus.40868864 at bloglines.com
		> Sent: 30 November 2006 09:49
		> To: perforce-user at perforce.com
		> Subject: Re: [p4] PowerShell Integration
		>
		> Yes, that's sort of what I was thinking too.
		>
		>
		>
		> I'll have a look at the Ruby
		> implementation - it's probably a good starting point
and, as 
		> much as it will grate with many, powershell does pay
quite a
		> homage to Ruby.
		>
		>
		>
		> Ideally I'd
		> like to be able to do a
		>
		> # Revert open changelists with comments beginning
"Temp" 
		>
		> Get-P4Changes ... | ?{
		>
		>   $_.Comment.StartsWith( "Temp" } -and $_.IsOpen
		> | %{
		>
		>     $_.Revert()
		>
		>   }
		>
		> }
		_______________________________________________ 
		perforce-user mailing list  -
perforce-user at perforce.com
	
http://maillist.perforce.com/mailman/listinfo/perforce-user 
		




More information about the perforce-user mailing list