This post shows how to include a job number with Perforce changelists submitted from the Bash prompt. Here’s an example of the error:
[user-name@server-name ~/scripts]$ p4 submit -d "ABC-1234 Testing Scala connection to Oracle" Submitting change 2011453. Locking 1 files ... Submit validation failed -- fix problems then use 'p4 submit -c 2011453'. 'bugattached' validation failed: Submissions to this branch must have a bug attached
The strings ABC-1234, changelist number 2011453, and the description, are fill values for use in the post to illustrate the problem and the solution.
If you’re receiving this error at the command line and end up going back to the Perforce visual client, read on. There is a way to submit at the command line. The terms bug number, and job, are equivalent to the JIRA ticket number that I use here.
Including JIRA ticket
The above error is obtained when a validation rule in in place that a bug has to be associated with the changelist. The fix is a three-command process:
[burgerp@ordddmbir01 tools]$ p4 submit -d "ABC-1234 Testing Scala connection to Oracle" [burgerp@ordddmbir01 tools]$ p4 fix -c 2011453 'ABC-1234' [burgerp@ordddmbir01 tools]$ p4 submit -c 2011453
Note: System responses that are displayed after each of the commands have been removed.
It’s a three-step process. It works. Reading the Perforce documentation, it looks like there is a second way to submit at the command line, and using just one command. This second way uses the Jobs parameter within the Perforce Form Field: usage. I couldn’t find a working example. Spending time on it myself, I couldn’t figure it out. If you are aware of how to use the form field, please write in with a comment!