Jump to content


Modifying stream setting using p4

Modifying stream setting p4 command line

  • Please log in to reply
4 replies to this topic

#1 trilai

trilai

    Newbie

  • Members
  • Pip
  • 6 posts

Posted 20 June 2013 - 02:48 PM

Hi,
I'm looking for a way to modify stream setting using p4. I've read all the related documents (Getting started, Working with stream, Codeline branching & streams),other topics in this forum, the perforce api ref page, and 'p4 help stream' but I didnt see anywhere it showed how to. Anyone got an idea?

#2 P4GabeW

P4GabeW

    Advanced Member

  • Members
  • PipPipPip
  • 62 posts

Posted 20 June 2013 - 05:36 PM

What stream setting are you trying to modify?

A stream is just a perforce form, so from commandline calling 'p4 stream <streamName>' will open the default text editor with the stream's spec available to modify.

The other option is to open the stream spec in p4v and edit from there. That will show you all the options and give you a little guidance on what the various options do.

#3 trilai

trilai

    Newbie

  • Members
  • Pip
  • 6 posts

Posted 20 June 2013 - 10:52 PM

I want to change the option Locked/Unlocked setting and I want to do it programmatically though, without user interaction. Is there a way to do it?And, actually, where is the spec file? The documentation keeps mentioning about it doesnot tell me where the spec file is.

#4 P4GabeW

P4GabeW

    Advanced Member

  • Members
  • PipPipPip
  • 62 posts

Posted 20 June 2013 - 11:59 PM

The spec is stored on the server. Each spec type (change, branch, client, stream, etc) has a corresponding command to fetch that type of form from the server.

Programmatically, you could dump the spec to a file, change the option, then re-enter the spec...

SO, to dump the stream spec to file, you can do:

p4 stream -o <streamName> > stream.txt
Then use your fav scripting method to change the option. It'll involve parsing for the line that starts 'Options:' and flipping the locked/unlocked variable (if you want it locked and it's currently unlocked s/locked/unlocked/ for example).
Then once you have it adjusted, call
p4 stream -i < stream.txt

#5 P4Matt

P4Matt

    Advanced Member

  • Members
  • PipPipPip
  • 1383 posts

Posted 21 June 2013 - 05:24 PM

Another way to do this would be to have a spec out trigger that puts the spec in the state you want before it gets to the user. We use this in the Public Depot to generate client specs for users.

Here is the documentation on triggers: you can implement a lot of wonderful functionality through them.
http://www.perforce...._scripting.html





Also tagged with one or more of these keywords: Modifying stream setting, p4, command line

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users