Jump to content


p4 submit command without a description

p4 submit description

  • Please log in to reply
2 replies to this topic

#1 Orthoducks

Orthoducks

    Member

  • Members
  • PipPip
  • 19 posts

Posted 30 August 2016 - 08:42 PM

I'm writing a program that executes P4 as a subprocess, and I'm puzzled about how to make a submit operation work.

The case in question is a submit that doesn't provide a description on the command line (i.e. no -d switch). The command line looks like this:

p4 submit -f submitunchanged <pathname>
  
When my program executed this command, P4 activated my default text editor and opened a temporary file containing a form for entering the description. This is pretty much what I expected; based on my experience with other change control systems, P4 should wait for me to save the temporary file, confirm that I added a submit message at the beginning, and proceed.

Instead, when I clicked the editor, it said that the file had been deleted, and did I want to keep it open? Meanwhile, my program went away and never came back.

I tried executing the same command from a terminal window and got this:

Error in change specification.
Error detected at line 27.
Change description missing. You must enter one.
Hit return to continue...

Apparently P4 expects me to edit and save the temporary file, then "Hit return to continue." My program went away because P4 was waiting for me to hit return. But since I'm not calling P4 from a terminal window, I can't do that.

How am I supposed to deal with this? P4 seems to be designed so that this use case is impossible to practice programmatically.

"Error detected in line 27" is also a puzzle. In line 27 of what? Presumably of some file, but the only file involved in this operation is the file I'm submitting, and it's nonsensical for P4 to check it for "errors."

#2 P4Sam

P4Sam

    Advanced Member

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

Posted 30 August 2016 - 08:59 PM

"line 27" refers to the change specification (the temp file that p4 tried to invoke your editor on).

When you run a command that involves editing a spec, the spec is saved as a temp file on the client, the editor (defined by P4EDITOR) is invoked on the client, and when the editor exits, the temp file is uploaded to the server and deleted from the client.  Based on what you're describing I suspect the editor is returning early, i.e. when it's invoked it forks a new process and the parent process returns immediately -- see this thread for another example.  This would look to the caller (p4) like you opened your editor and exited without making any changes, which would in turn result in the "change description missing" error from the server, as well as the editor's sub-process reporting that the file had been deleted (p4 thought you were done editing it since as far as it could tell the editor had exited).

#3 Orthoducks

Orthoducks

    Member

  • Members
  • PipPip
  • 19 posts

Posted 31 August 2016 - 08:50 PM

Thank you. The topic at the link you gave wasn't very clear; it actually seems to describe a different problem, but the problem I have is as you said.

I was using was Notepad++ (in Windows 7). I switched to Notepad and the problem went away. I understand that vi also works.





Also tagged with one or more of these keywords: p4, submit, description

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users