Jump to content


How do I create a new workarea and sync a specifc changelist to this dir FROM THE COMMAND LINE

scripting

  • Please log in to reply
3 replies to this topic

#1 Oisin

Oisin

    Newbie

  • Members
  • Pip
  • 1 posts

Posted 24 May 2019 - 08:06 PM

Hi,

Can anyone give me a COMPLETE set of command line commands to:
1. Crate  a new workspace
2. Populate a specific change list to this workspace

For example:
p4 -c Client_Name -p 172.28.16.2:1666 -u UserName-P Password sync -f //SEABU/LiveState/etc/…
Where
UserName is User name of perforce server
Password is Password of the perforce server.
Client_Name is the existing perforce client

Note how the above instructions FAIL TO EXPLAIN how to create Client_Name. This is useless. I need the commands to create 'Client_Name' and populate the files

Does anyone known how to do this ?

Thanks,

Oisín.

#2 Matt Janulewicz

Matt Janulewicz

    Advanced Member

  • Members
  • PipPipPip
  • 176 posts
  • LocationSan Francisco, CA

Posted 04 June 2019 - 11:06 PM

The base command for creating a client is just 'p4 client'. It'll open the spec in your default editor, and I would posit that you wan't to edit this somewhat (the View: part) 100% of the time. If you want to automate it more, create a template and use 'p4 client -t'. So, your first command:

p4 -p 172.28.16.2:1666 -u UserName-P Password client my_cool_client

​You'll also want to pay attention to the Root:, which is where your synced files will go. Either change that, or set into that directory first, then it'll use that for the Root:

Then your sync command should work:

p4 -c my_cool_client -p 172.28.16.2:1666 -u UserName-P Password sync -f //SEABU/LiveState/etc/…

I'd also look into P4CONFIG so you can set things like client, port, username in a config file and not have to pass them in all the time. If you have multiple clients with different roots, having a proper P4CONFIG in each Root: directory will allow you to switch back and forth between them simply by setting into their root directories.
-Matt Janulewicz
Staff SCM Engineer, Perforce Administrator
Dolby Laboratories, Inc.
1275 Market St.
San Francisco, CA 94103, USA
majanu@dolby.com

#3 Miles O'Neal

Miles O'Neal

    Advanced Member

  • Members
  • PipPipPip
  • 135 posts

Posted 04 June 2019 - 11:40 PM

I would add that there are plenty of docs online that explain this. For instance, type "perforce create client" or "perforce client example" into any reasonable search engine.
Much of what you will find comes from Perforce itself; they have far more extensive (and useful) docs than A lot of vendors I've dealt with.

#4 Sambwise

Sambwise

    Advanced Member

  • Members
  • PipPipPip
  • 917 posts

Posted 06 June 2019 - 01:04 AM

View PostOisin, on 24 May 2019 - 08:06 PM, said:

Can anyone give me a COMPLETE set of command line commands to:
1. Create  a new workspace
2. Sync specific files to this workspace

First make sure that you're connected to the server and logged in:
p4 set P4PORT=172.28.16.2:1666
p4 set P4USER=UserName
p4 login

Then create your client:
p4 set P4CLIENT=Your_Client_Name_That_Is_Unique_To_You_And_Your_Client_Machine
p4 client

Once you've done everything up to this point, you probably don't need to do any of it ever again (except maybe the "p4 login"; by default a login ticket expires every 12 hours).

Then it's just one command to sync files:
p4 sync //SEABU/LiveState/etc/…


The output of that command will show you where all the files have been written to your workspace.  Is that not where you wanted them?  Here's how to un-sync them and then modify your client spec so you can try again:
p4 sync #none
p4 client

The "Root" determines the top-level directory of your client workspace, and the "View" field determines where (and which) depot files get synced into that root.  After you modify these fields with the "p4 client" command, the next sync command you run will write files into the corresponding locations.  Changes to the "View" will be automatically applied to files that you've already synced, but if you change the "Root" while there are files in your workspace you need to manually move the old root to match!  (That's why in my instructions I had you "sync #none" to empty the workspace before editing the client.)

If you want to sync the files to their state as of a specific changelist, add "@CHANGELIST" to the file path, like this:

p4 sync //SEABU/LiveState/etc/...@1234






Also tagged with one or more of these keywords: scripting

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users