开发者

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.


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?


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.


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.


cleartool diff

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜