Difference between two versions in ClearCase dynamic view

前端 未结 4 1188
南笙
南笙 2021-01-16 12:46

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 delet

相关标签:
4条回答
  • 2021-01-16 12:56

    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?

    0 讨论(0)
  • 2021-01-16 13:17

    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.

    0 讨论(0)
  • 2021-01-16 13:19

    cleartool diff

    0 讨论(0)
  • 2021-01-16 13:20

    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.

    0 讨论(0)
提交回复
热议问题