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?
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
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
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
try this command
cleartool find -avo -nxname -element '{brtype(branch_name)}' -print
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
来源:https://stackoverflow.com/questions/5800926/how-to-find-the-files-modified-under-a-clearcase-branch