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?

sarat
  • 10,512
  • 7
  • 43
  • 74

5 Answers5

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
Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • it gives me a crippled file name with @ and other characters. Is it possible to get with normal path? – sarat Apr 29 '11 at 05:50
  • 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? – sarat Aug 02 '11 at 11:59
  • @sarat: simply replace the '`.`' in '`ct find . -type ...`' by the full path you are looking into. – VonC Aug 02 '11 at 12:14
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
JD D
  • 7,398
  • 2
  • 34
  • 53
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
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
Prathima
  • 111
  • 3
  • 1
    interesting (+1). I have tried to improve the presentation of your answer to make the different parts of your command more visible. – VonC Apr 29 '11 at 06:17
2

try this command

cleartool find -avo -nxname -element '{brtype(branch_name)}' -print
Sᴀᴍ Onᴇᴌᴀ
  • 8,218
  • 8
  • 36
  • 58
jaxkewl
  • 195
  • 10
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

Gajendra
  • 1,291
  • 1
  • 19
  • 32