When submitting changelists in Perforce I need to allocate a job. The jobs which I am supposed to associate with my changelist are not allocated to me and does not show up in the list of available jobs when I invoke "p4 submit". I know the job number which I am going to use, but can't find a way to specify it. Basically, I want to do something like:
p4 submit -j
But there is no -j option...
You can create a numbered pending changelist, and attach jobs (p4 fix) to that.
I don't think there's a one shot way of submitting the default changelist with an arbitrary job.
In your change spec (when you do p4 submit or p4 change) simply add a Jobs: section with a newline separated list of jobs you wish to fix.
If you edit your user (p4 user) and add a jobview: section, the jobs section will appear automatically.
See http://kb.perforce.com/?article=052
Related
Does perforce track the time and date at which changes were made to changelists? For example, updating the description text, or shelving different revisions of files into the changelist? And if so, can this information be accessed using p4 command line?
p4 changes -t will include information about the creation time of the changelist, but not the update. p4 describe doesn't seem to include any flags related to time. p4 fstat can show time information about the files in a changelist, but not the changelist itself.
No, changelists are not versioned objects (not even in the spec depot, annoyingly). The only ways to track changes to changelists are to go under the covers, e.g.:
Scrape information from the journal file (this requires some understanding of Perforce's db schema)
Add triggers on each command that might update a changelist in the ways you want to track (this requires exhaustive understanding of Perforce's command API so you don't "miss" anything that you need to trigger on).
Basically we have one CL ( e.g.1000000) that is integrated in one master branch as well as in all of its child branch . Now suppose that CL 1000000 is backout in master branch . Is there any way to check whether this changes are backed out in all of its child branch or not through script ?
It depends on how you backed it out. If you used the "p4 undo" command and your admin has enabled the option to be able to re-merge undone changelists, you can just do:
p4 ichanges (source-branch)#=10000000 (child-branch)
If you backed it out via P4V or the "p4 edit" command, there isn't any queryable metadata that relates to the original change -- you could check to see if the backout change (whatever its number is) was integrated to the child branches, or you could take a line of code from the original change and use "p4 grep" to see if it's present in the child branches.
P4 Server 2013.1/610569
I am trying to script the submission of default changelist with a Job. I understand that it is not possible to directly add a job to a pending changelist and submit it however I am open to doing things the indirect fashion. Basically the steps for me are
Move all files in the Pending changelist to a new numbered changelist
Add a given P4 Job name to this new numbered changelist
Set the textual description of the numbered changelist to be the same as the P4 Job name
Submit the given job
Can someone post me the p4 commands that need to be run for this? I tried doing this from the P4V and capture the commands at the bottom but it appears when you move files we have to list all files and I was looking for a straight-forward way of doing this.
Here's a starting place:
p4 change -o | sed 's/<enter.*>/Change to fix job000001/' >change.dat
echo 'Jobs: job000001' >> change.dat
p4 change -i < change.dat >changenumber.out
p4 submit -c `cut -f 2 -d ' ' < changenumber.out`
The first two lines construct the form data for the new changelist.
The third line creates the numbered changelist, and saves the output,
which is something like "Change 12345 saved".
The fourth line extracts that change number and gives it to 'p4 submit -c'.
Of course, I haven't done any error checking, reporting of the results to the user, etc.
As an alternative, consider this:
p4 submit -d "Change to fix job000001" | grep 'Change .* submitted' | cut -f 2 -d ' ' >change.out
p4 fix -c `cat change.out` job000001
That variant submits the change without the job attached, then associates the change with the job.
Either way, please consider using one of the Perforce scripting APIs (P4Perl, P4Ruby, P4Python, etc.) instead of this, as they are much, much easier.
I'm trying to print out a list of the change list numbers (and optionally descriptions) that are attached to a particular job in perforce.
You want the p4 fixes command:
p4 fixes -j <job>
Quite often when I'm working in a branch in Perforce, I realise I need a file I didn't branch when I initially branched.
So, I add the file to my client, run p4 integrate -b branchname, then p4 submit.
Thing that bugs me is that I then need to go through the list of files for submit, and remove all entries that are open for edit.
I can't see any option in p4 help submit, but it seems like this might be a reasonably common use case.
First do
p4 submit
Assuming your p4 editor is vi,
type this command in command mode
g/#.*edit\|#.*add\|#.*delete/d
You can choice to submit a single file on the command-line.
p4 submit <filename>
Then it won't bug you about the other files.
If you have more than one file, then maybe you should move all of the files you are currently editing onto an numbered changelist, or branch onto a numbered changelist, which will provide the separation you want.
If you're going to do this, it's much easier to manage numbered changelists from one of the GUIs.