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

Jeff A. Bowles jab at pobox.com
Thu Jun 28 12:18:47 PDT 2007


This looks absolutely excellent, if I can say. I think you're hitting
everything nicely.

You'll find something like:
    BRNAME=main
    chgnum=`p4 changes -s submitted //depot/$BRNAME/...`

    # nifty code to run "p4 label -i" creating label $BRNAME_XX_YY
    # where XX and YY are dates (overnight builds) or identifiers
    # (for releases), pointing revision+view to "@$chgnum" and
    # "//depot/$BRNAME/...", respectively.


    p4 sync #none
    echo   then lots of rm commands
    p4 sync //depot/$BRNAME/...@$BRNAME_XX_YY
    # and, for the truly paranoid...
Don't be surprised if there's a "p4 where" or two in the eventual
script, to figure out what the p4-name to local-name mapping is.

   -Jeff Bowles

On 6/28/07, Jay Glanville <Jay.Glanville at naturalconvergence.com> wrote:
>
>  The general purpose of the script?  It's a loadbuild script.  I'm
> contemplating using the change list number as a "build identifier", or
> serial number.
>
> The sequence of events would be something like this:
>
>    - loadbuilder creates an automatic label based on a change list
>    number
>    - they sync to that label (or change list number) and only that
>    label.  That is: "sync #0", remove any remaining files from HD, "sync
>    @build_label".
>    - they run the loadbuild scripts
>
>
> The loadbuild script does the following:
>
>    - generates a build id based on the latest change list number for
>    the given branch (it's in this area that I was asking for help)
>    - performs the loadbuild
>    - embeds the build id into any deployables (comment area for zips,
>    manifest for jars, etc)
>
> The build id / number is most important in formal loadbuild scenarios,
> where the loadbuilder focuses on getting everything.  They don't do things
> like: sync file x to 10, sync file y to 20.
>
>
> So, I think I've mitigated your boundary case.  Does this logic make sense
> to you? or does anyone see a hole in my plans?
>
> Thanks to all.
>
> JDG
>
> ---
> Jay Dickon Glanville
>
>  -----Original Message-----
> *From:* Jeff A. Bowles [mailto:jeff.a.bowles at gmail.com]
> *Sent:* June 27, 2007 11:37 PM
> *To:* Jay Glanville
> *Cc:* Perforce Users
> *Subject:* Re: [p4] what's the best way to determine the current client
> workspace?
>
> Perhaps:     p4 changes  -m  1  //...#have
> might be what you want?
>
>
> *Still, I wonder about the boundary case: when someone did a 'sync'*
> *on part of, but not all of, the files mapped to the works. (Then, there*
> *might be content that a single "path at changelist" might not describe.)*
>
>
> What's the script gonna do, big-picture-wise? The
> boundary case I cite might not be a big deal, and might yet be one.
> So it's worth asking what you're trying to do...
>
>
>    -Jeff Bowles
>
>
>   On Jun 27, 2007, at 12:00 PM, Jay Glanville wrote:
>
>  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<http://maillist.perforce.com/mailman/listinfo/perforce-user>/mailman/listinfo/perforce-user<http://maillist.perforce.com/mailman/listinfo/perforce-user>
>
>
>
>
>


-- 
---
Jeff Bowles - jeff.a.bowles at gmail.com


More information about the perforce-user mailing list