Clearcase Findmerge - clearcase

I want to find all the files that have been changed on a label (eg label1) from my view. label1 Can be be applicable to multiple branches as well.
I tried following command, it did not work:
cleartool findmerge . -fve "{lbtype(label 1)}" -print
What would be the correct command?

If you want to find all the files that are labelled 'label1', a cleartool find would be more adequate than cleartool findmerge.
cleartool find . –version 'lbtype(label1)' -print
For listing the files (and not their versions) on all branches:
cleartool find -all -element '{lbtype_sub(label1)}'
See also:
"Additional examples of the cleartool find command"
"cleartool find examples"

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%\""

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

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.

Cleartool - find unloaded/removed files

Is there a command in Cleartool which i can use to list all files which have been removed from a branch?
Thanks
The basic command to find anything in ClearCase is... cleartool find, also illustrated in "ClearCase UCM: Need to See Content of Deleted File".
In your case, you would search for versions of files which aren't at the LATEST of a branch:
cleartool find . -type f -version "! version(.../BRANCH/LATEST)" -print
(see version selector for more on this '.../' notation)
To display only the file (and not all the versions):
cleartool find . -type f -element "! version(.../BRANCH/LATEST)" -print
The OP linuxlewis mentions in the comments:
this will show all differences which exist between sibling branches. I just want to be able see the file names,if any were removed,from the current branch
I mention the possibility of a grep for BRANCH, to detect files which have versions in BRANCH but not LATEST)
However, a cleaner solution is to add another filter to the search: && version(.../BRANCH)
cleartool find . -type f -element "! version(.../BRANCH/LATEST) && version(.../BRANCH)" -print
That will search all "elements" (files or directories in ClearCase) which have versions in branch BRANCH, but not one in BRANCH/LATEST.

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).

find files in clearcase

situation:
one vob, 2 views (main dev and branch view).
i need to find all files that where created in the branch view and therefore can't be found via merge manager.
anyone able to help?
thanks
When it comes to cleartool find, the two sources of information and example I recommend are:
SAMECS find command
IBM find examples
In your case:
cleartool find -all -ele "brtype(mybranch) && !brtype(main)" -print
(supposing "main dev" means "branch 'main'")
cleartool find -all -type f -ele "brtype(mybranch) && !brtype(main)" -print
would limit that to files only (not directories)

Resources