Checking if Two Different Config Specs Select Exactly the Same Element Versions - clearcase

I have two similar but different config specs that I believe should select all of the same element versions. How can I most easily check if this is the case?

You can create two dynamic views, each one with their own config spec:
cleartool setcs -tag aViewTag yourConfigSpecFile
You can then compare the result of:
cleartool ls
(in both views)
A cleartool ls display the exact version found in each view.
Even better, using fmt_ccase:
# unix
cleartool find . -exec 'cleartool desc -fmt "Version: %n\n" $CLEARCASE_XPN'
#windows
cleartool find . -exec "cleartool desc -fmt \"Version: %n\n\" \"%CLEARCASE_XPN%\""
That will list all the selected versions, and you can redirect the output in a file, one for each view.
Then the comparison is trivial.

Related

How to find labels for a folder and it's files/subfolders

I assume there's no built in solution.
I'm using cleartool descr -fmt "%l\n" path to find labels for a particular directory, but it doesn't include subfolders.
Is there any way to find labels for a folder and all of it's childs?
You would need to find all the versions you want (the version of the folder selected by your config spec, as well as the version of the files and subfolders)
That would be with cleartool find.
You can combine cleartool describe and find with the -exec directive and is fmt_ccase syntax:
cleartool find . -exec "cleartool describe -fmt \"%n %l\n\" \"%CLEARCASE_PN%\""

Which tag or branch is created from a particular branch

In ClearCase suppose I have a branch App_Feb_Branch. Now I want to know if any Tag or Label has been created from this branch. How can I get this information?
You can list baselines (for ClearCase UCM) or grep for version with a label (for base ClearCase).
See "Command to find labels applied on particular branch":
ct find . -nrec -name "." -ver "brtype(myBranch)" -exec "cleartool descr -fmt "%l" \"%CLEARCASE_XPN%\""
With fmt_ccase formatting options, you can use the %l to only display labels for the versions found.
That is what the cleartool descr -fmt "%l" \"%CLEARCASE_XPN%\" part of the cleartool find above does.

clearcase: show recently changed files

Is there a clearcase command to show me say all the files and the respective committers/activities that have changed in the last X hours/days? Something similar to svn/git/hg log?
Not directly, because ClearCase is file-centric, not repository centric.
So you can make your query for a component or a Stream (list of components+baselines).
For instance, to list all activities for a given stream, you can type (using the fmt option of lsact):
cleartool lsact -fmt "%n %d" -in aStream#\aPVob -user auser
But then, you need to filter on the date to get only the activities you want, and you can the describe each activities in order to get their changeset.
For the files, you can use a find query similar to "Find files in Clearcase view newer than a specific date?":
cleartool find <vobtag> -element "{created_since(target-data-time)}" -print
cleartool find <vobtag> -element "{created_since(target-data-time)}" -exec "cleartool desc -fmt \"%n %u %[activity]p\" \"%CLEARCASE_XPN%\""
Using -fmt options, you can display the user for that version, and the activity whose change set contains the specified version.

Command to find labels applied on particular branch

Command to find labels applied on particular branch..
Suppose i have a branch name called BR_test , i want to know what are all the labels applied on this branch.
If this was UCM, a simple lsbl would be enough:
cleartool lsbl -stream myStream#\mypvob
But if this is base ClearCase, the simple way would be to determine what element (directory or file) is always labeled (typically a root directory), and fetch all the labels on that element for a given branch, through a combination of cleartool find and cleartool describe, based on fmt_ccase format (Windows syntax here):
C:\mySnapshotView\myVob\myRootDir>
ct find . -nrec -name "." -ver "brtype(myBranch)" -exec "cleartool descr -fmt "%l" \"%CLEARCASE_XPN%\""
That will list all labels for all versions of that element for a specific branch.

How to display recent changes and logs for current view spec in clearcase?

newbie for clearcase.
Since clearcase's config is rather different from other concept in git, I may mean logs for
any files with specified version/branch path.
Like I want to show log for all element match:
element * .../specified-lable-or-branch/
First you need to be aware of the differences between ClearCase and Git, ClearCase being file-centric (no notion of repository-wide revision or commit)
You can display logs for any visible file by typing:
cleartool lshistory /myView/myVob/path/to/myFile
See lshistory man page. (and also How do I understand about ClearCase event records in the VOB database)
The lshistory command lists event records in reverse chronological order, describing operations that have affected a VOB's data.
File system data history.
Lists events concerning elements, branches, versions, and VOB links.
This includes records for creation and deletion of objects, and records for attaching and removal of annotations: version labels, attributes, and hyperlinks.
Another kind of logs is the lsvtree (history of versions):
The lsvtree command lists part or all of the version tree of one or more elements.
By default, the listing includes all branches of an element's version tree except for obsolete branches.
alt text http://youtrack.jetbrains.net/_persistent/tree.PNG?file=74-3724&v=1&c=true
The OP adds:
How can I display all history for elements match a pattern like has new version under a branch?
You can combine almost any commands with a find query.
Windows syntax:
cleartool find . -name "apattern" -exec "cleartool lshistory \"%CLEARCASE_PN%\""
cleartool find . -version "{created_since(target-data-time)}" -exec "cleartool lshistory \"%CLEARCASE_PN%\""
Unix syntax:
cleartool find . -name "apattern" -exec 'cleartool lshistory "$CLEARCASE_PN"'
cleartool find . -version "{created_since(target-data-time)}" -exec 'cleartool lshistory "$CLEARCASE_PN"'
For the " like has new version under a branch?" specifically:
cleartool find . -version "brtype(mybranch)" -exec ...
should do it (any element which has no version created for that branch will not be listed).

Resources