add

Purpose

Instruct the P4ALTSYNC agent to create or update a placeholder for a file.

Input to agent

Key

Value

altSync add
client The client workspace name
port The P4PORT the client used to connect to the server
user The P4USER the client used to connect to the server
path The local syntax path of the file to create a placeholder for
clientFile The client syntax path of the file to create a placeholder for
depotFile The depot syntax path of the file to create a placeholder for
rev The revision number of the file to create a placeholder for
digest The server’s digest for depotFile (this is the MD5 of the file as it’s stored on the server) - Only if the server has a digest to send
fileSize The size of the file on the client in bytes (this might differ from the fileSize returned from p4 fstat)
writable true for writable, or false for read-only
executable true for executable, or false for not executable
noclobber

When true, if the target file already exists and isn't read-only, do not replace or update it. In such a case, the command fails.

keywords

If 0 or unset, the file must be hydrated without keyword expansion (p4 print -K)

lineEnd The line ending to hydrate text files with (p4 print -L unix/win/mac)
utf8bom The UTF8 BOM setting to use when hydrating utf8 type files (p4 print -B0/1/2)
charset

The charset to hydrate unicode type files with (p4 print -Q charset)

Note: this might be the charset’s numeric form, but p4 print -Q will accept either numeric or named forms.

The command might or might not include additional keys.

Action for the agent to perform

A placeholder file should be created for the requested file. If a file or placeholder already exists at that path, it should be updated/replaced with a placeholder (unless the noclobber flag is passed and the file isn’t read-only): this could be a destructive operation.

If directories need to be created to contain the target file, the P4ALTSYNC agent might need to create these in a way that allows them to contain placeholders.

The charset, utf8bom, lineEnd and keywords flags are provided for the P4ALTSYNC agent to store so that the hydration (likely via p4 print) can be performed in the same way that the action invoking the add command would have written the file if P4ALTSYNC were not in use.

Output from the agent

Key

Value

result Boolean true for success
error Description of what went wrong (applicable only if the result is boolean false or the string literal "error")

Example of input and output

{"altSync":"add","client":"vfs-cmr5","clientFile":"//vfs-cmr5/2013/2013-12-13/P1020326.JPG","depotFile":"//depot/2013/2013-12-13/P1020326.JPG","digest":"6939819742BB416BFD89512C66B58975","fileSize":5147136,"path":"e:\\temp\\vfs\\cmr5\\2013\\2013-12-13\\P1020326.JPG","port":"perforce:1666","rev":1,"user":"npoole","writable":true,"executable":false}
{"result":true}