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 / Argument | Description |
---|---|
--added | Prints only differences consisting of items added to the repository. |
--changed | Prints only differences consisting of items that changed. |
--moved | Prints only differences consisting of moved or renamed items. |
--deleted | Prints only differences consisting of items that were deleted. |
--repositorypaths | Prints repository paths instead of workspace paths. (This option overrides the '--fullpaths' option.) |
--download | Stores the differences content in the specified output path. |
--encoding | Specifies 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). |
--comparisonmethod | Sets the specified comparison method. See Remarks for more info. |
--clean | Does not take into account the differences generated because of a merge, but only the differences created by simple checkins. |
--integration | Shows 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. |
--format | Retrieves the output message in a specific format. See Remarks for more info. |
--dateformat | Format used to output dates. |
--fullpaths, --fp | Forces 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 / Argument | Description |
---|---|
'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 / Argument | Description |
---|---|
ignoreeol | Ignores the end of line differences. |
ignorewhitespaces | Ignores the whitespace differences. |
ignoreeolandwhitespaces | Ignores the end of line and whitespace differences. |
recognizeall | Detects 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 / Argument | Description |
---|---|
{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