Search code examples
clearcase

Difference between two versions in ClearCase dynamic view


Say , I've two different dynamic views in ClearCase.

I would like to know if there is any command to give a report with:
"x lines added , y lines deleted , z lines changed" between two versions.


Solution

  • Yes, you can use diffstat to produce a very nice, visual "x lines added , y lines deleted , z lines changed" overview (1).

    Here is an example of the output from comparing the two latest versions of diffstat:

    $ diff -u diffstat-1.53 diffstat-1.54 | diffstat
     CHANGES    |   12 +++++++++++-
     diffstat.1 |    4 ++--
     diffstat.c |   57 +++++++++++++++++++++++++++++++++++++++++++++++++++------
     3 files changed, 64 insertions(+), 9 deletions(-)
    

    In your case, run

    diff -u /view/VIEW1/SOMEVOB/some/dir_or_file /view/VIEW2/SOMEVOB/some/dir_or_file | diffstat
    

    (1) Actually "z lines changed" is impossible to determine without analysing the meaning of the lines (and a computer algorithm cannot do that). E.g. if the old line is int x; and the new line is int y;, is a) x changed to y or b) x removed and y added?