DIFF

Description

Shows differences between files, changesets, and labels.

Usage

cm diff <csetspec> | <lbspec> | <shspec> [<csetspec> | <lbspec> | <shspec>] [<path>] [--added] [--changed] [--moved] [--deleted] [--repositorypaths] [--download=<download_path>] [--encoding=<name>] [--comparisonmethod=(ignoreeol | ignorewhitespaces | ignoreeolandwhitespaces | recognizeall)] [--clean] [--integration] [--format=<str_format>] [--dateformat=<str_format>]

(Shows differences between a 'source' changeset or shelveset, and a 'destination' changeset or shelveset. The changesets can be specified using either a changeset or label specification. Where two specifications are given, the first will be the 'source' of the diff; the second, the 'destination'. If only one specification is given, the 'source' will be the parent changeset of the specified 'destination'. If an optional path is specified, the Diff window will launch to show differences between the two revisions of that file.)

cm diff <revspec1> <revspec2>

(Shows differences between a pair of revisions. The differences are shown in the Diff window. The first revision specified will appear on the left.)

cm diff <brspec> [--added] [--changed] [--moved] [--deleted] [--repositorypaths] [--download=<download_path>] [--encoding=<name>] [--comparisonmethod=(ignoreeol | ignorewhitespaces | ignoreeolandwhitespaces | recognizeall)] [--clean] [--integration] [--format=<str_format>] [--dateformat=<str_format>] [--fullpaths | --fp]

(Shows the branch differences. Use 'cm help objectspec' to learn more about specs.)

Options

Option / ArgumentDescription
--addedPrints only differences consisting of items added to the repository.
--changedPrints only differences consisting of items that changed.
--movedPrints only differences consisting of moved or renamed items.
--deletedPrints only differences consisting of items that were deleted.
--repositorypathsPrints repository paths instead of workspace paths. (This option overrides the '--fullpaths' option.)
--downloadStores the differences content in the specified output path.
--encodingSpecifies the output encoding, i.e.: utf-8. See the MSDN documentation at http://msdn.microsoft.com/en-us/library/system.text.encoding.aspx to get the table of supported encodings and its format, (at the end of the page, in the "Name" column).
--comparisonmethodSets the specified comparison method. See Remarks for more info.
--cleanDoes not take into account the differences generated because of a merge, but only the differences created by simple checkins.
--integrationShows the branch changes that are pending to be merged into its parent branch. It takes into account any rebase or prior merge already done from/to its parent branch.
--formatRetrieves the output message in a specific format. See Remarks for more info.
--dateformatFormat used to output dates.
--fullpaths, --fpForces printing full workspace paths for files and directories when possible.

Help

Remarks

File status

If '--added', '--changed', '--moved' or '--deleted' are not specified, then the command prints all differences.

Option / ArgumentDescription
'A'means added items.
'C'means changed items.
'D'means deleted items.
'M'means moved items. The left item is the original, the right is the destination.

Comparison methods (--comparisonmethod option)

Option / ArgumentDescription
ignoreeolIgnores the end of line differences.
ignorewhitespacesIgnores the whitespace differences.
ignoreeolandwhitespacesIgnores the end of line and whitespace differences.
recognizeallDetects the end of line and whitespace differences.

This command accepts a format string to show the output. The parameters of this command are the following:

Option / ArgumentDescription
{path}Item path.
{date}Change date/time.
{owner}Change author.
{revid}Revision id of the revision considered as the destination in the diff.
{parentrevid}Revision id of the parent of the revision considered as the destination of the diff.
{baserevid}Revision id of the revision considered as the source in the diff.
{srccmpath}Server path before moving the item (move operation).
{dstcmpath}Server path after moving the item (move operation).
{type}Item type: D (directory), B (binary file), F (text file), S (symlink), X (Xlink)
{repository}Repository of the item.
{status}Item status: A (added), D (deleted), M (moved), C (changed)
{fsprotection}Shows item permissions (Linux/Mac chmod).
{srcfsprotection}Shows parent revision item permissions.
{newline}Inserts a new line.

Notes on 'revid'

For added items, the 'baserevid' and 'parentrevid' will be -1, as no previous revision exists in this case. For deleted items, the 'revid' is the id of the source revision, and the 'baserevid' will be -1, as there is no destination revision. For Xlinks, both 'baserevid' and 'parentrevid' are always -1.

Examples

Comparing branches

cm diff br:/main/task001

cm diff br:/main/task001 \doc\readme.txt

cm diff br:/main/task001 --integration

Comparing changeset trees

cm diff 19

cm diff 19 25

cm diff cs:19 cs:25 --format="{path} {parentrevid}"

cm diff cs:19 cs:23 --format="{date} {path}" --dateformat="yy/dd/MM HH:mm:ss"

cm diff cs:19 cs:23 --changed

cm diff cs:19 cs:23 --repositorypaths

cm diff cs:19 cs:23 --download="D:\temp"

cm diff cs:19 cs:23 --clean

cm diff cs:19 cs:23 \doc\readme.txt

Comparing label trees

cm diff lb:FirstReleaseLabel lb:SecondReleaseLabel

cm diff lb:tag_193.2 cs:34214

cm diff cs:31492 lb:tag_193.2

Comparing shelve trees

cm diff sh:2

cm diff sh:2 sh:4

Comparing revspecs

cm diff rev:readme.txt#cs:19 rev:readme.txt#cs:20

cm diff serverpath:/doc/readme.txt#cs:19@myrepo serverpath:/doc/readme.txt#br:/main@myrepo@localhost:8084

cm diff rev:foo.c#cs:1 rev:foo.c#cs:2 --comparisonmethod=ignoreeol