1

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?

  • I am using the static view.
  • I need the history dumped into standard output so that I can use it in scripts.
  • "cleartool lshistory -cview {files}" is what I want, but -cview is not available.

Thank you very much for your help.


Followup edit on Feb. 29, 2012.

Thanks to the hint given by @VonC, I could create a simple shell script which does

  1. get visible branch of the current view
  2. list version history in the branch

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:

  • configspec of the current view.
  • visible branch of the given file.

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.

1 Answer 1

2

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
2
  • Thank you very much. So, in short, there no such thing as view specific history. I'll try to combine 'find' and 'lshistory' method to get at least a (non-precise) rough history. I'll post the outcome.
    – Tosh
    Feb 29, 2012 at 13:23
  • @user1238847: excellent, I will be interested in your findings.
    – VonC
    Feb 29, 2012 at 13:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.