[p4] what's the best way to determine the current clientworkspace?

Jay Glanville Jay.Glanville at naturalconvergence.com
Thu Jun 28 04:25:19 PDT 2007


Kudos go to Jeff for finding a cleaner solution.  I knew that putting
the over-all objectives into the email would be a good idea.

Jeff, #have is a great suggestion.  It reduces my interaction with P4 to
a single query and is platform independent.

Thanks

JDG

---
Jay Dickon Glanville


> -----Original Message-----
> From: perforce-user-bounces at perforce.com 
> [mailto:perforce-user-bounces at perforce.com] On Behalf Of Jeff Grills
> Sent: June 27, 2007 4:23 PM
> To: Jay Glanville; Perforce Users Mailing List
> Subject: Re: [p4] what's the best way to determine the 
> current clientworkspace?
> 
> 
> Maybe try "p4 info". Since it looks like you want the output to be
> easily parsed, you might try "p4 -ztag info".
> 
> However, if you just want the latest change of the current 
> workspace and
> don't need to be able to pass other workspaces names into the script,
> try "p4 changes -m1 //branch_name/...#have".
> 
> j
> 
> -----Original Message-----
> From: perforce-user-bounces at perforce.com
> [mailto:perforce-user-bounces at perforce.com] On Behalf Of Jay Glanville
> Sent: Wednesday, June 27, 2007 2:00 PM
> To: Perforce Users Mailing List
> Subject: [p4] what's the best way to determine the current client
> workspace?
> 
> I want to write a script that calls a perforce command where 
> one of the
> arguments is the name of the current workspace.  The desired output of
> the command is the latest change list number on the current 
> hard drive.
> In other words, I want to execute the following command:
> 
>     p4 changes -m 1 \
>       //branch_name/...@[current_workspace] | \
>       sed 's/Change \([0-9]*\).*/\1/'
> 
> Where [current_workspace] is the name of the current workspace.  My
> question is this: what is the best way to determine what is 
> the current
> workspace?  My original thought was to parse the client spec, 
> something
> like this:
> 
>     p4 client -o | \
>       sed 's/^Client: *\([a-zA-Z_0-9]*\).*/\1/'
> 
> (I know that this sed won't actually work, but you get the idea).
> 
> So, is this the best way?  Is there a better way?  Is there a 
> direct way
> to do this (by that, I mean simply ask p4 directly 'what is 
> the current
> workspace')?
> 
> Thanks
> 
> JDG
> 
> ---
> Jay Dickon Glanville
> 
> _______________________________________________
> perforce-user mailing list  -  perforce-user at perforce.com
> http://maillist.perforce.com/mailman/listinfo/perforce-user
> 
> _______________________________________________
> 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