How to find the files modified under a clearcase branch
Asked Answered
A

5

20

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?

Avid answered 27/4, 2011 at 7:45 Comment(0)
A
29

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
Agranulocytosis answered 27/4, 2011 at 8:56 Comment(3)
it gives me a crippled file name with @ and other characters. Is it possible to get with normal path?Avid
Thanks for your answer, but how can I find a modified files under a specified folder than a vob. e.g I need to find the modified files \vob_name\sub1\sub2 . how can I do that?Avid
@sarat: simply replace the '.' in 'ct find . -type ...' by the full path you are looking into.Agranulocytosis
T
9

The find command is the best source. To address the OPs concerns about getting back a "crippled" name with @@ and all of the branch and version information afterwards, the "-nxn" option can be added to not provide this info. This is much easier that doing the element search combined with exec directive to format the output.

cleartool find . -type f -branch "brtype(mybranch)" -nxn -print
Trill answered 21/5, 2013 at 17:17 Comment(0)
G
7

The above command will give all the files modified in particular branch(myBranch).
But if you want to find the files modified by particular user in particular date, you would need the following command:

cleartool find . -version "{created_since(28-APRIL-2011.23:00:00) \
                           && (!created_since(29-APRIl-2011.23:00:00)) \
                           && brtype(BR_test) \
                           && created_by(p723029)}" \
                 -exec "cleartool describe -fmt \nName\t\t:\040%En\nResponsible\t:\040%u\nDate\t\t:\040%d\nComment\t\t:\040%c\n %CLEARCASE_XPN%" \
                 -print >> D:\test.xls

(in one giant line for copy/paste purpose:)

cleartool find . -version "{created_since(28-APRIL-2011.23:00:00) && (!created_since(29-APRIl-2011.23:00:00))  && brtype(BR_test)  && created_by(p723029)}" -exec "cleartool describe -fmt \nName\t\t:\040%En\nResponsible\t:\040%u\nDate\t\t:\040%d\nComment\t\t:\040%c\n %CLEARCASE_XPN%" -print >> D:\test.xls
Glennisglennon answered 29/4, 2011 at 5:42 Comment(1)
interesting (+1). I have tried to improve the presentation of your answer to make the different parts of your command more visible.Agranulocytosis
E
3

try this command

cleartool find -avo -nxname -element '{brtype(branch_name)}' -print
Euell answered 6/7, 2017 at 16:5 Comment(1)
This is the only thing on this page that worked for meBowsprit
A
0

Use the following script

   #!/bin/sh

   display()
   {
       echo "usage: $0 branchname -v vobs"
       echo "  branchname: optional, if absent uses the current view-name"
       echo "  -v vobs: optional, if absent uses default vob list"
   }

  if [ $# -gt 1 ]; then
      if [ $1 == -v ]; then
          branch=`basename $CLEARCASE_ROOT`
          VOB_LIST=${@:2:($# - 1)}

      elif [ $2 == -v ]; then
          branch=$1
          VOB_LIST=${@:3:($# - 2)}

      else
          display
         exit 1
      fi

  else
      VOB_LIST="/vobs/abc /vobs/def /vobs/ghi /vobs/jkl /vobs/mno"

      if [ $# -eq 1 ]; then
         if [ $1 == -h ]; then
              display
              exit 0
          else
              branch=$1
          fi
      else
         branch=`basename $CLEARCASE_ROOT`
      fi
  fi

  echo "Searching for files of branch <$branch> in following vobs:"
  echo "$VOB_LIST"
  echo "================================================================"

  cleartool find $VOB_LIST -all -version "version(.../$branch/LATEST)" -print

Save this in a file named ctlsbr and use this from the vob you want to find out the list of modified files.

Thanks, Amit

Arlenaarlene answered 15/4, 2013 at 10:44 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.