Perforce and FTP Differences

This chapter describes how P4FTP differs from standard FTP and from Perforce.

FTP differences

This section describes how P4FTP differs from standard FTP.

How files are managed on the client computer

In a standard FTP site, all users share access to an area of storage and, depending upon the permissions in place, they might overwrite each others' work. P4FTP uses a Perforce approach, in which each P4FTP user has a private workspace that is mapped to shared areas of the Perforce depot. When a file is uploaded, it is opened for add or edit as appropriate, and locked. When the file is submitted, it becomes the new head revision. Another user who has the same depot path in their FTP client workspace can then download the updated version of the file.

P4FTP uses its client workspaces as temporary storage. Operations such as directory listings are performed by querying the Perforce server, and are always up-to-date.

How files are transferred

Standard FTP transfers files one at a time, and there is no facility for grouping changes. One of the key benefits of Perforce is that related changes are grouped together into changelists. P4FTP groups all changes (adds, edits and deletes) made in a single FTP session into one changelist that is submitted at the end of the session.

The following sections describe how your files are transferred between your client computer and a Perforce depot.

Saving files

When you use the put command from an FTP client, your files are added to a Perforce changelist in preparation for submission to the depot. When you close your connection, the changelist is submitted and the files are saved to the depot.

When you use the Save or Publish feature of your web authoring tool, your files are added to a Perforce changelist in preparation for submission to the depot. When you disconnect from P4FTP, the changelist is submitted and the files are saved to the depot. Note that a newly uploaded file is not visible to other P4FTP or Perforce users until the submitting user closes its FTP connection.

Getting files

When you use the get command from an FTP client, the Open feature of your web authoring tool, or download a file using a Web browser, the files are synced from the depot to your client computer and are immediately visible on the client computer.

The pwd command

The FTP command pwd (print working directory) normally displays the current directory on the remote computer. When you use P4FTP, the pwd command displays the Perforce depot directory but uses the client operating system convention.

For example, if you are connecting from a Windows computer to a depot on a UNIX computer, when you issue the pwd command, the working directory might be displayed as c:\p4client-test\depot.

Supported FTP commands

The following FTP commands are supported by P4FTP. The names in braces are the commands used by common FTP clients, and the uppercase names represent the actual protocol commands.

ACCT (account)
CDUP (cdup)
CWD (cd)
DELE (delete / rm)
HELP (rhelp/remotehelp)
LIST (ls / dir)
MDTM (modtime)
MKD (mkdir / md)
NLST (nlist)
NOOP

PASS
PASV (passive)
PORT
PWD (pwd)
QUIT (quit / bye)
RETR (get)
RNFR (rename)
RNTO (rename)
SIZE (size)
STAT (rstat)

STOR (put)
STRU (stru)
SYST (system)
TYPE (ascii / binary)
USER (user)
XCDUP (cdup)
XCWD (cd)
XMKD (mkdir / md)
XPWD (pwd)

Perforce differences

This section documents the differences in behavior between P4FTP and a normal Perforce client interface. Due to the nature of the FTP protocol, users of P4FTP do not have access to the full functionality provided by Perforce.

Changelist numbering

P4FTP uses only the default changelist. If a submit fails for any reason, Perforce turns the default changelist into a numbered changelist. To ensure that files opened under numbered changelists do not become abandoned, P4FTP consolidates all files opened on a client into the default changelist. Users can resolve most problems by simply retrying, without the assistance of an administrator.

Changelist descriptions

Due to the design of the FTP protocol, P4FTP cannot prompt the user for a description when a changelist is submitted, so a default description is used. If the ability to describe changelists is important to you, use the p4 command line client or P4V.

To override the default change description, specifying the desired description using the -t command line flag when you start P4FTP.

Filetypes

For new files being uploaded to the server, P4FTP uses the Perforce filetype detection mechanism to determine whether a file is a text file or a binary file. For files that already exist on the server but are being updated, P4FTP uses the filetype of the previous revision so that files marked as ktext or binary+S, for example, retain this type of information.

Workspace management

A standard Perforce client workspace is populated with revisions of files in the depot, and is periodically synced to the head revision to obtain changes made by other users. Because P4FTP uses its client workspace only for temporary storage, users do not need to sync to keep the workspace up to date.

P4FTP stores the following types of files in client workspaces:

  • Files uploaded by the user and open for add or edit
  • Files being downloaded to the user and synced to the head revision

The client workspace used by P4FTP provides:

  • An isolated area of temporary storage.
  • An identifier for Perforce to use to track open files and submissions.
  • A workspace that an administrator can use to correct errors.

After every successful submission, all files in the submitted changelist are removed from the client workspace using p4 sync filename#none. When a user requests a file from P4FTP using the FTP get command, P4FTP retrieves the head revision of the file from the depot, transfers it to the user and then removes it from its workspace by syncing it to #none. This feature enables large areas of the depot to be mapped without wasting disk space.

The only files that are typically present in the client workspace are files that the user is actively using. To prevent empty directories from cluttering the client workspace, you enable the rmdir option when you create clients specifications.

To diagnose client workspace problems, use the p4 command or P4V.

Concurrency

All files opened for add or edit and delete are locked by P4FTP to prevent other users from submitting their change first and thereby denying P4FTP access to the head revision. If a file is locked when a user tries to upload it using P4FTP, permission is denied until the lock is released.

Standards compliance and limitations

P4FTP is broadly compliant with the requirements of RFC 959 and RFC 1123. RFC 959 specifies that, though the telnet protocol is used on the FTP control channel, it is not the intention that the entire telnet protocol be implemented on this channel. RFC 1123 clarifies this requirement by stating that FTP servers must support the telnet IP and SYNCH commands and, although they are not required to support telnet option negotiation, they should be capable of refusing option requests (that is, responding with DONT/WONT).

P4FTP does not currently recognize any telnet option negotiation. (Few, if any FTP clients use this option negotiation.)

Note the following limitations:

  • P4FTP contains no support for restarting FTP transfers. All transfers must transfer the entire file.
  • P4FTP contains no support for appending to files as specified in the RFCs.
  • Symbolic links appear in directory listings, but attempts to download linked files result in an error.