In clearcase I want to list the files /file versions checked in during the last 2 days. Can anyone help me with the command or script for the same.
You will find plenty of cleartool find examples, including:
"find all file versions created since a certain date"
List all the files versions below the current directory created since a certain date,
cleartool find . -type f -version "created_since(01-Mar)" –print
Note: Add the –follow options if you want to follow any symbolic links that are present.
See the query_language man page for the date format.
Related
Suppose I have a file with versions 0 to 4. On version 2 I applied a label called mylabel. Now I want to do a find query using cleartool which gives me all versions created after my labelled version 2. That is I only want to get versions 3 and 4 as output, but not versions 0-2.
I know how to find all versions except the labelled one:
cleartool find . -version "!lbtpye(mylabel)" -print
There is also a command to get the history of this element:
cleartool lshistory -minor PATH_TO_FILE
This theoretically gives me the date when the label was applied, so I could do
cleartool find . -version "created_since(date)" -print
But the lshistory command always outputs the full history of the element and I feel it is too much to parse all this information just to get the desired date.
So basically I want to know if there is a more elegant way to do this. I could imagine that I could maybe first check which version has mylabel (because the version number is already provided by the find query) and then search for files with a version higher than the labelled version. So in my example with mylabel at version 2 I would hope for something like:
cleartool find . -version "version( > /main/2)" -print
After VonC's answer I should mention that the labeltype will only be created once and the label itself moved every few days. It is therefore not possible to check for the time the labeltype was created.
version( > /main/2) jas no equivalence in the ClearCase config spec 'version selectors'.
That means an easier option should rely on a convention, like the convention the date of applying the label should be very close to the date of creating the label type.
Meaning the mklbtype shoudl be done just before mklabel, and you could then use the label type creation date for your cleartool find . -version "created_since(date)" -print query.
Basically, the crux of the issue is to keep track of the date where the label where last applied (or moved, since it is here a shifting label).
Another approach would be to store that date as an attribute attached to the lbtype: only one lbtype, and one attribute changed each time the label is moved.
See cleartool mkattr.
I have a file test.cpp somebody added a few lines of code i don't know when but i'm assuming it was in a specific range of time that i know.I want to find the activity that was used to deliever this changes, i found a lot of versions of this element in the version tree of this element, but all the activities that i was able to see were as a result of a rebase, i need to find the source activity that was in charge of adding this few lines of code.
Is there any way to do that ?
For each deliver activity (that you can see in the version tree), you can list the contributing activities with
cleartool lsact -contrib activity:anact#/apvob # on unix #/vobs/apvob
See "Finding which developer activities were delivered in a specific delivery"
Then you need to describe each activity found, to see if your file is in it.
cleartool descr -l activity:anact#/avob
Obviously, you also can use a cleartool annotate, in order to see the versions in that file: see "How to use ClearCase Annotate".
If you see one line which interest you, check its version n# 'x' and use cleartool descr -l file#/main/.../x to find its corresponding activity.
How to find files or elements which are not modified after a paticular version in ClearCase?
Like I want to find all the elements which were not modified after version 1(no versions after version 1).
Or Can we find all the elements which are not modified after a particular date in ClearCase?
As explained in "Find files in Clearcase view newer than a specific date?", you can find files newer (since then), not before.
That means you would need to:
find all files
find those with version post a certain date
deduce the resulting group of files by removing the second set from the first.
Regarding version, you can try and find all files without version 2, for instance:
cleartool find . -version 'version(.../bugs/2)' -print
But remember, a version can be deleted, and a file would still have a version 3, 4... so it is not a guarantee.
So I'm writing a script at work where I have to go through all the projects in a ClearCase vob, look for a file and parse some info from said file.
Naturally, I wouldn't want to load every single project so I'm using cleartool to retrieve the unloaded files.
First, I'm using the find command to locate the files. This was my first attempt:
root>cleartool find C:/viewpath -name file.txt -version "lbtype(Version-label)" -print -nr
Viewpath is the path to the project where I'm currently looking for the file. The file I'm looking for is file.txt on the version specified by Version-label.
This gave me no result whatsoever, even though I knew file.txt existed on that version.
I figured out it was looking through an old version of the directory, the latest on the main-branch, which was before file.txt was added to the directory. I tried this instead:
root>cleartool find C:/viewpath##/Version-label -name file.txt -version "lbtype(Version-label)" -print -nr
And got this result, which was what I was looking for
C:/viewpath\file.txt##\main\branch\41
So now that I knew where I could find the file I tried to get it.
root>cleartool get -to savepath C:/viewpath\file.txt##\main\branch\41
Which gave me this result
cleartool: Error: "C:/viewpath\file.txt##\main\branch\41" does not exist, or is not a ClearCase version, or is a checked out version which was removed.
Also tried
root>cleartool get -to savepath C:/viewpath\file.txt##/Version-label
With the same result
I can get files added to the directory when it was still on the main-branch, so it is still searching through the directory on the main-branch, where file.txt is nowhere to be found.
How do I tell it to look through a version of the directory from after it was branched from main?
I would really recommend for you to try those same commands in a dynamic view.
As illustrated here, a dynamic view gives you access to extended path (the file##/branch/version syntax), which means command like get will work.
You have in this question an example of search (cleartool find) using extended paths.
As explained in "In ClearCase, how can I view old version of a file in a static view, from the command line?", you can browse (as in 'change directory to') the various extended paths of a file in a dynamic view.
I have a Folder in ClearCase that contains a large list of Reports.
I have checked all the Reports out because I need to make a sweeping change.
I have changed a set of the Reports and now want to deploy this set.
I probably should have checked the Report files out one at a time and then deployed each as I finished.
But, since I did not do that, is there a way to inspect the ClearCase folder that contains the List of checked out Reports to see which ones have changed and which ones have not?
You could ask cleartool for a diff with the previous version:
cleartool lsco -r -cvi -fmt "diff -options \"-hea\" -pred \"%n\"\n" | cleartool | grep ">>>"
That would give you the list of currently checked-out modified files.
Note: remove the '-r' option if you only want the check-out files of the current directory (and not its sub-directories)
In ClearCase (or Explorer if you have integration enabled), right-click the base of the tree, and choose "Find Modified Files". This will return a list of ALL files that have been modified, and that are part of the repo (i.e. it will not return list of private files).
If you want to know all files - checked out, modified, and private - the only way I know of is to use cleartool from within the view:
cleartool ls -r
If you want more (or less) info about the files, check the docs for the -fmt option (which doesn't work with ls, but does work with describe), and you can create a command that will give you exactly what you want (it'll take some experimenting until you get the hang of it).
NOTE: "Find Modified Files" is only available within the gui from the base of the view tree; Elsewhere your only option is "Find Checked Out Files" (confusing, to say the least).
You can set up a second view with an identical config spec as the view with the checked out files. Once you have the second view set up you can compare the same directory in each view with a difference tool (like WinDiff). This will list all the files that have been changed.
It's not native to ClearCase but it should give the results you are looking for.
I also found a solution. I selected my ClearCase folder and clicked on "Find Checkouts". This showed my huge list of Report files that were checked out. I then selected them all and selected "Check In". I left the "Check in if identical to previous version" option unchecked. I then selected "OK" to check in. All the modifeid files checked in and the un-modified files remained checked out. This gave me my delta of modified files vs un-modified files.