1

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.

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
srinannapa
  • 3,085
  • 8
  • 49
  • 66

4 Answers4

3

As I commented earlier, you can use

cleartool diff -serial_format prog.c prog.c@@\main\4

This will format the difference to view the all line rather than just the beginning.

7dr3am7
  • 755
  • 1
  • 8
  • 21
3

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?

hlovdal
  • 26,565
  • 10
  • 94
  • 165
  • It looks good , but I'm not understaning how to use this file , I downloaded diffstat.tar file but it doesn't have any exe , do I need to do something more with the downladed tar file to work with the diff command? – srinannapa Dec 04 '10 at 19:09
  • The tar file is a archive of files, just like zip. The file contains the source code and you have to compile yourself. For windows a lot of unix programs are available precompiled from www.cygwin.com. – hlovdal Dec 04 '10 at 19:12
1

For dynamic views, you can use the extended pathnames with cleartool diff.

This help page "To compare with a version other than the predecessor " gives all the details:

cleartool diff prog.c prog.c@@\main\4

cleartool diff won't give you exactly what you want if you look only for a summary (displaying only the number of lines added, removed and changed):

The default file-comparison report begins with a file summary, which lists all the input files and their assignments as file 1, file 2, and so on.
If no differences are detected among the files, this listing is replaced by the message Files are identical.

The remainder of the report is a series of pairwise differences, each of which is preceded by a descriptive header line:

******************************** (file summary)
<<< file 1: util.c@@/main/1
>>> file 2: util.c@@/main/3
********************************
----------[after 15]------|-------[inserted 16]------ (header)
                          | char *s;        (difference)
                                                    |-
---------[changed 18]-----|----[changed to 19-21]---- (header)
return ctime(&clock);     | s = ctime(&clock); (difference)
                       -  | s[ strlen(s)-1 ] = '\0';
                          | return s;
                          |-

Note:

report with x lines added , y lines deleted , z lines changed between two versions

No, not with cleartool diff: the diff format doesn't include a pure summary style.

But since you can access to any two versions in a dynamic view, you can use any diff tool you want to achieve that particular output.

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
0

cleartool diff

Vladimir Ivanov
  • 42,730
  • 18
  • 77
  • 103