Use diff to display differences between two revisions of a file. The command can be applied to more than one file. If you do not specify any revisions using -vn, -vd, -vl, or -vp, the working copy of each specified file is compared to the tip revision in the repository (or vault) for this file. If you specify a single revision, the working copy of each specified file is compared to that revision. If you specify two revisions, those two revisions of each specified file are compared.
When comparing text files, the differences can be displayed. When comparing binary files, output results indicate whether the revisions of the file are the same or different.
The syntax for this command is:
stcmd{Ex} diff [ -p "projectSpecifier" [-epwdfile "filePath"] [-cmp] [-csf]
[-encrypt encryptionType] ][-cfgl "labelName"| -cfgp "stateName" | -cfgd "asOfDate"]
[-is] [-rp "folderPath" | -fp "folderPath"] [-filter "fileStatus"]
[-eol [on | off | cr| lf| crlf]] [-w | -Bpvcs | -b] [-I] [-m "maskSet"]
[-t number] [-c number] [-n] [-nd] [-vl "labelName" | -vd "asOfDate" |
-vn revisionNumber] [-pattern "date-pattern"] | -vp promotionStateName[files...]
The full syntax is:
stcmd -p "userName:password@hostName:endpoint/projectName/[viewName/][folderHierarchy/]"
For example:
stcmd -p “bsmith:rocketfive@orion:49201/StarDraw/StarDraw/SourceCode/”
The -epwdfile keyword specifies the path to the file that contains the encrypted password. Like -pwdfile , -epwdfile replaces the password being used as part of the -p or -s option, preventing others from seeing the user's password on the command line. The full syntax is: -epwdfile "filePath" .
The -pwdfile is supported for backward compatibility. Un-encrypted passwords stored using older versions of stcmd are read. However, passwords cannot be stored to files using -pwdfile anymore.
In this case, the syntax of -p or -s reduces to -p "username@hostname:port/... -epwdfile "fullyQualifiedPathToPasswordFile"".
The following is the syntax of the commands that can be used to store an encrypted password.
Use the following syntax to be prompted for the password that will be encrypted and stored in a file.
stcmd store-password -epwdfile "filePath"
stcmd store-password -epwdfile "filePath" -password "password"
After an encrypted password is stored, other stcmd commands can specify -epwdfile "filePath"' as parameters. For example:
stcmd delete-local -p "JMarsh@Orion:1024/StarDraw/StarDraw/SourceCode" -epwdfile "C:\estuff\myfile.txt" -filter "N" "*"
Compresses all the data sent between the workstation and the server and decompresses it when it arrives. Without this option, no compression takes place.
Compression speeds transmission across the network, but it takes time on the front end to compress the data and at the back end to decompress the data.
This is an optional parameter. If not specified, then the platform default is not to compress.
When the command maps the folder specified in the -p option to the underlying StarTeam folder, using -csf causes the command to differentiate StarTeam folders based on the case-sensitive spelling of their names This option does not apply to the case-sensitivity of filenames in the folders. For example, with -csf, StarTeam folders named doc and Doc are recognized as different folders. Without this option, either folder could be recognized as the doc folder.
The default is that StarTeam folders are not differentiated based on the case of letters in their names.
With or without -csf, if folder names are ambiguous, an error occurs. For example, when you use -csf, the names of two folders are ambiguous if both a Doc and doc folder exist. When you do not use -csf, folder names are ambiguous if they are spelled identically.
Encrypts all data sent between the workstation and the server and decrypts it when it arrives. Without this option, no encryption takes place. Encryption protects files, data and other project information from being read by unauthorized parties over unsecured networks.
This is an optional parameter. If not specified, then the server and the command line negotiate the encryption required by the server.
The full syntax is: -encrypt encryptionType.
The types of encryption are:
These encryption types are ordered from fastest to slowest. Each of the slower encryption types is safer than the one preceding it.
"12/29/13 10:52 AM"
"December 29, 2013 10:52:00 AM PST"
"Monday, December 29, 2013 10:52:00 AM PST"
When used with add or ci, the command recursively visits all modified files in all sub-folders and checks them in.
Overrides the working folder or working directory for the StarTeam view’s root folder.
While this option allows you to use a different working folder than the one specified by the StarTeam view, its critical importance is to provide cross-platform compatibility. For example, UNIX and Microsoft Windows systems specify drive and directory path names in incompatible ways.
While the path D:\MYPRODUCT\DEVELOPMENT\SOURCE is understood on a Microsoft Windows platform, it is not understood on a UNIX platform. Use this option to define the working path if your platform does not understand the path specified in the StarTeam project.
The UNIX shell interprets a backslash (\) as an escape character when it precedes certain characters, such as quotation marks. As a result, an error occurs in the following example:
stcmd ci -p "xxx" -rp "C:\" "*"
which is interpreted as:
stcmd ci -p "xxx" -rp "C:" *"
To avoid a situation like this, escape the final character in "C:\" as follows:
stcmd ci -p "xxx" -rp "C:\\" "*"
Or avoid it as follows when the -rp path doesn’t end with the root folder as in "C:\orion\":
stcmd ci -p "xxx" -rp "C:\orion" "*"
The full syntax is: -rp "folderName" .
Folder is the Microsoft Windows term and appears in the StarTeam user interface. Directory is the correct term for the UNIX platform.
Overrides the specified StarTeam folder’s working folder or working directory. This is equivalent to setting an alternate working path for the folder.
While this option allows you to use a different working folder than the one specified by the StarTeam view, its critical importance is to provide cross-platform compatibility. For example, UNIX and Microsoft Windows systems specify drive and directory path names in incompatible ways.
While the path D:\MYPRODUCT\DEVELOPMENT\SOURCE is understood on a Microsoft Windows platform, it is not understood on a UNIX platform. Use this option to define the working path if your platform does not understand the path specified in the StarTeam project.
A backslash (\) is interpreted as an escape character when it precedes quotation marks. As a result, an error occurs in the following example:
stcmd ci -p "xxx" -fp "C:\" "*"
which is interpreted as:
stcmd ci -p "xxx" -fp "C:" *"
To avoid a situation like this, escape the final character in "C:\" as follows:
stcmd ci -p "xxx" -fp "C:\\" "*"
Or avoid it as follows when the -rp path doesn’t end with the root folder as in C:\orion\:
stcmd ci -p "xxx" -fp "C:\orion" "*"
The full syntax is: -rp "folderName".
Folder is the Microsoft Windows term and appears in the StarTeam user interface. Directory is the correct term for the UNIX platform.
When on, text files are transferred from the StarTeam Server’s repository to the workstation’s working folder with the end-of-line convention for the platform executing the command as determined by the Java VM.
When off, the default, no end-of-line conversion is performed. Using off is the same as not using -eol at all.
For Microsoft Windows clients, the end-of-line marker is a carriage return/line feed (crlf) combination. For UNIX platforms, it is a line feed (lf). For MAC systems, a carriage return (cr).
You would set this option to on or lf, for example, when you compare a file from the repository and a working file on a UNIX system (if the repository stores text files as crlf).
Ignores all whitespace (tabs and spaces) when comparing two lines in text files. For example, the following lines would be equivalent:
"a = ( b + 2);" "a=(b+2);"
The-w, -Bpvcs, and -b options are mutually exclusive.
When comparing two lines of text files, ignores leading and trailing whitespace. For example, the following lines are equivalent because there is only one space between "hi" and "mom":
" hi mom " " hi mom"
but the next line is not equivalent:
"hi mom"
" hi mom " " hi mom"
When comparing two text files, ignores the characters in certain columns as specified by one or more masks. Each mask has the following syntax:
"columnNumber-columnNumber[(numeric)]"
For example, "1-6" ignores the characters in the first six columns of each line, and "1-6 (numeric)" ignores the first six columns of each line if the character in column 1 is a digit in both files.
You can use a series of masks, but they must be separated by commas. The syntax is:
"mask[,mask]..."
The following example uses diff to compare the Beta1 and Beta2 revisions of each of the .cpp files in the folder SourceCode, a child of the root folder StarDraw (in the StarDraw view of the StarDraw project). It ignores all white space.
Use the -p with diff or the stateful set command to set the context of the project/view/parent folder.
stcmd diff "SourceCode" -w -vl "Beta1" -vl "Beta2" "*.cpp"
Note that diff compares versions of files at differing specified revisions of the view, which allows you flexibility in determining how to specify the revisions of interest. A few examples are listed below.
Compare .cpp files in the view between labels Beta1 and Beta2:
stcmd diff "SourceCode" -w -vl "Beta1" -vl "Beta2" "*.cpp"
Compare .java files in the view between dates March 01 1997 to Jan 01 2013:
stcmd diff "SourceCode" -w -pattern MM/DD/yyyy -vd 03/01/1997 -vd 01/01/2013 "*.java"
Compare .java files in the view between date March 01 1997 and the label Beta2:
stcmd diff "SourceCode" -w -pattern MM/DD/yyyy -vd 03/01/1997 -vl "Beta2" "*.java"
Compare .cs files in the view between date December 31 2013 and the tip:
stcmd diff "SourceCode" -w -pattern MM/DD/yyyy -vd 12/31/2013 "*.cs"
Also, the best use of -vd is in conjunction with the -pattern option. The -pattern specifications is part of the java SimpleDateFormat and permits the engine to precisely determine what one has in mind when specifying a date without attempting to guess at intent.