'cm diff' should compare a file against previous revision by default
'cm diff' compares against the last checked in revision if the file is modified in the workspace. If it is not, it just gives a message "Item has only one revision". It would be more useful if in this case it compared the last two revisions. Finding appropriate revision numbers on the command line is not easy.
It’s the current behavior
-
robl commented
I am currently getting the error "Item has only one revision" for items that have 2 or 3 revisions on the current branch but no workspace revision with 'cm diff <item>' (5.0.44.534)
-
robl commented
The error “Item has only one revision” happens when there is only one revision on the current branch. In this case it should find the parent revision from the parent branch (or higher up the tree). It is often the case that a file has only changed once on a branch, but I would still like to look at that change. The GUI's diff correctly identifies the parent in this case.
-
Borja commented
The diff always compare the current content against the previous content.
* When the item is changed locally, the diff will compare the local content against the server content of the loaded revision.
* When the item is checked out, the diff will compare the local content against the checkout parent revision content.
* In other case the diff will compare the loaded revision (local content) against its parent revision.
The error “Item has only one revision” happens when the loaded revision is the first revision for this item, so there is no parent revision to compare with.