Reputation: 36030
I want to get the modification history of the interested files in current view of clearcase.
cleartool lshistory {files}
will give me the history across all the branches including the change happening outside of the view. I simply want to view the changes that affect the current view.
Is there any convinient command or script which allows me to achieve this?
Thank you very much for your help.
Thanks to the hint given by @VonC, I could create a simple shell script which does
for a given file and 'since' date.
It does not give precise history because it assumes following aspects of the element did not change since the given date:
Without this assumption, I guess I'd have to keep track of history of the current view and also parse configspec to determine the precedence of the branch visibility for the view.
In my working environment and usage, span of the history is small and those assumptions almost always hold.
Thank you again for the help.
Upvotes: 1
Views: 19000
Reputation: 1323743
I am not surprised that you cannot have the history of the file in the current view... because the config spec of a view can change at any time (especially non-UCM ones).
(Note: snapshot or dynamic don't matter here, only the config spec, based on any rule your want, for snapshot view, or on a Stream for UCM views)
Realize that a view is made to select a fixed version (and then authorized, if configured properly) new versions to be created in a specific branch.
So I would imagine you could want to list all the versions of a specific branch.
Unless you are in an UCM view, you will have to specify which branch you are talking about (a non-UCM view can authorize branch, through the -mkbranch
directive, from any criteria, and not just from another branch).
I would recommend having a look at "Additional examples of the cleartool find command", and find all the versions of a given brtype.
cleartool find -all -version "brtype(mybranch)" -print
Note: don't add -cview
on that one, it would return only the one version currently selected by your view.
Strange fact: the cleartool lshistory
doesn't have any -cview
option, yet this article mentions one: "Displaying the history of checkouts on UNIX".
Now, before out good friend Tamir Gefen chims in, yes, some of his tools can help visualizing the history of a file (even if it isn't related to the view specifically)
But those are an extra set of tools that might not be in the budget of your project.
The OP tosh shimayama has since came up with this script lshistory_cview.sh
:
#!/bin/sh
[ $# -ne 2 ] && echo 'please specify date and filename' && exit 1
date=$1; shift; file=$1
ct='cleartool'
# get the current visible branch
branch=$(${ct} find ${file} -cview -print | sed -e 's/.*\\\(.*\)\\\(.*\)/\1/g')
# get the history of the file within the branch
${ct} find ${file} -version "{brtype(${branch}) && created_since(${date})}" -print
Upvotes: 2