Search code examples
clearcaseannotate

ClearCase annotate to find the culprit who added a particular LOC


I am in the middle of writing a script to find the culprit who added a particular line of code in ClearCase. I am using annotate command for this. cleartool annotate -all -fmt "%Ad %-8.8u %-100.150Vn | " -nheader -force I am using -all so that I can explore to unrelated levels(not in the same line of descent). But I smell a problem. If i have 2 same lines of code in my .c file, which one to choose? So to tackle this issue, i thought I can remove that -all and locate a particular version in the same line of descent. Then look at any merge is coming to that particular version and do another annotate in that version.
so my question is, can I do this if I am not at this version at the moment?

cleartool annotate -all -fmt "%Ad %-8.8u %-100.150Vn | "  -nheader -force MEMManager.c@@\main\optimus_2_build\optimus_r10_integration_branch\12

Am I in the right direction? Or is there any better command I can use to achieve this goal?


Solution

  • I can't really speak to the best way to deal with this, I can speak to what I did the last time I had to deal with a "where did THAT change come from?" issue.

    I walked the vtree back using annotate. I annotated the current version with -long (to get the entire line of code, because it was rather heavily indented), and located the changed line and where it came from. I then went to that version and annotated it, and found that the lines in question came from still another version (which was merged into this "middle" version). Lather, rinse, repeat as needed.

    Yes, it was tedious, but it was some time ago... And for some reason the use of -all didn't occur to me.

    The "2 identical changes" issue may not have any operational impact. But here is what those "identical changes" look like in a simple hello.c source:

    ##### 2016-12-05T09:19:55-05:00 Brian    \main\1                  |                         | #include <stdio.h>
    #####                             .                               |                         | 
    #####                             .                               |                         | int main(int argc, char** argv)
    #####                             .                               |                         | {
    ##### 2016-12-05T09:23:38-05:00 Brian    \main\testbr\2           |                         |         // And here 
    ##### 2016-12-05T09:22:10-05:00 Brian    \main\3                  | UNRELATED               |         // And here 
    ##### 2016-12-05T09:19:55-05:00 Brian    \main\1                  |                         |         printf("Hello World!\n");
    #####                             .                               |                         |         return 0;
    ##### 2016-12-05T09:21:31-05:00 Brian    \main\2                  | UNRELATED               |         // I felt like adding this here
    ##### 2016-12-05T09:21:02-05:00 Brian    \main\testbr\1           |                         |         // I felt like adding this here
    ##### 2016-12-05T09:19:55-05:00 Brian    \main\1                  |                         | }
    

    The "UNRELATED" means that it did nto come from the current "line of descent" and also tells you where the change also happened. This could be because one of those versions was merged to multiple branches, or some was a very prolific typist.