How to create a perforce empty changelist from command line

后端 未结 3 1931
悲&欢浪女
悲&欢浪女 2021-01-05 08:50

i\'m trying to create an empty changelist from command line using the command p4 change -i but seems that this command does nothing, i don\'t get any error/succ

相关标签:
3条回答
  • 2021-01-05 09:51

    Just using "p4 change" will open up the change form in the editor and upon saving a numbered change is created

    0 讨论(0)
  • 2021-01-05 09:55

    If you're using the command line interactively, the regular "p4 change" command is the way to go:

    p4 change
    

    This opens the changelist spec in your editor so you can fill it out, and saves the changelist when you save the file in your editor and exit it.

    If you're scripting, you can use "p4 change -i" but you need to make sure to feed it a valid changelist form via stdin. The "p4 change -o" command gives you the same form you get from "p4 change" (via stdout instead of your editor), so all that's left is to fill out the description and/or modify the list of files to be included. The --field option is useful here:

    p4 --field "Description=My pending change" change -o | p4 change -i
    

    If you want the new changelist to be empty rather than inheriting open files from the default changelist, blank the Files field:

    p4 --field "Description=My pending change" --field "Files=" change -o | p4 change -i
    
    0 讨论(0)
  • 2021-01-05 09:55

    My p4 doesn't understand --fields option. The following worked for me.

    #Powershell commandlet
    echo "Change: new`nClient: <client-name>`nUser: <user-name>`nStatus: new`nDescription: NewCL"|p4 change -i
    

    Replace the items in <> brackets.

    Here is the output of just the echo part.

    #Powershell commandlet
    PS C:\Users\sahil> echo "Change: new`nClient: <client-name>`nUser: <user-name>`nStatus: new`nDescription: NewCL"
    Change: new
    Client: <client-name>
    User: <user-name>
    Status: new
    Description: NewCL
    

    As you can see, the echo command just constructs a formatted string which p4 change -i accepts.

    `n is used above for new line.

    Note that I have excluded Files, as I wanted the change list to be empty.

    Update - I updated my perforce installation and now p4 understands --fields option.

    0 讨论(0)
提交回复
热议问题