Search code examples
diffclearcase

Use bcompare to see difference with previous version


I actually use clearcase file browser to see version tree for a specific file. I can select the version for a baseline and do diff with predecessor.

But I want to do that with bcompare in commandline.

I have myFile.c and the baseline Version_XX_YY_ZZ, how can I do to compare with the previous version with bcompare ?


Solution

  • I found a solution by doing this :

    #!/bin/bash
    
    BASELINE="Version_XX_YY_ZZ"
    FILE="myFile.c"
    
    cleartool lsvtree "$FILE" | grep "$BASELINE" > ~/tmp.txt
    
    # tmp.txt must contain only 1 line
    
    # get file name for $BASELINE
    BaseFile=$(cat ~/tmp.txt | cut -d' ' -f1)
    # get predecessor file short name
    PredFile=$(cleartool descr -pred -short "$BaseFile" | cut -d$'\n' -f1)
    
    # Start compare
    bcompare "$FILE"@@"$PredFile" "$BaseFile"