Search code examples
version-controlclearcase

How to find the files modified under a clearcase branch


I modified and checked-in a bunch of files under my branch. Now I need to get the list of files I modified. Is there any scripts to do so?


Solution

  • The cleartool command find should help you find any element (file) with at least one version on a given branch.

    The following will find all the files on a branch

    cleartool find . -type f -branch "brtype(mybranch)" -print
    

    See find examples or "Additional examples of the cleartool find command" for more examples.


    The OP sarath adds:

    it gives me a crippled file name with @ and other characters. Is it possible to get with normal path?

    True, such a command would give you something like (as an example):

    .\.checkstyle@@\main\MyBranch
    .\.classpath@@\main\MyBranch_Int\MyBranch
    .\.classycle@@\main\MyBranch_Int\MyBranch
    .\.fbprefs@@\main\MyBranch_Int\MyBranch
    

    To get only the path, you have two solutions:

    1/ look for elements (and not versions) with the right branch:

    cleartool find . -type f -ele "brtype(mybranch)" -print
    

    (note the -ele replacing the -branch)
    That would give:

    .\.checkstyle@@
    .\.classpath@@
    .\.classycle@@
    .\.fbprefs@@
    .\.pmd@@
    

    But you still have the "ugly" '@@'.

    2/ combine the find with an exec directive which describe the element found with fmt_ccase format:

    cleartool find . -type f -ele "brtype(mybranch)" -exec "cleartool descr -fmt \"%En\n\" \"%CLEARCASE_PN%\""
    

    Multi-line form for readability:

    cleartool find . -type f -ele "brtype(mybranch)" \
      -exec "cleartool descr -fmt \"%En\n\" \"%CLEARCASE_PN%\""
    

    Please note that all "inner" double quotes need to be escaped.

    The %En will give you the name of the element found.

    .\.checkstyle
    .\.classpath
    .\.classycle
    .\.fbprefs
    .\.pmd
    .\.project
    .\.settings\dico.txt