ClearCase transfers mastership of all objects in a directory? - clearcase

I know that we can transfer mastership of an object like this example:
At replica sanfran_hub, transfer mastership of element list.c to the sydney
replica.
multitool chmaster sydney list.c##/main
Changed mastership of ″list.c″ to ″sydney″
However, I do not know how to transfer mastership of all files in a directory. Example:
sydney/
sydney list1.c
sydney list2.c
sydney list3.c
...
If I run
multitool chmaster sydney sydney##/main
It only change mastership of the directory "sydney", not all the files inside it.

I don't believe there is a recursive option for chmaster.
That means you need to link this command to the result of a cleartool find query.
(Windows syntax)
cleartool find sydney -exec "multitool chmaster sydney \"%CLEARCASE_PN%##/main\""
(Unix syntax)
cleartool find sydney -exec 'multitool chmaster sydney "$CLEARCASE_PN##/main"'

Related

How to check last access ClearCase vob?

Can anyone help me how to find time and date when the ClearCase (UCM) VOBS are last accessed ?
I remember using cleartool lshistory to check the last events date occurred on a vob.
Something like:
cleartool lshis -fmt "%Xn\t%Sd\t%e\t%h\t%u \n" -since 01-Oct-2015 -all <vobname>| grep -v lock | head -1 | grep -o '20[0-9][0-9]-[0-9][0-9]-[0-9][0-9]'
That would give the events on the last 6 months (like "create version", "create branch", ...).
If there are none, the VOB has not been accessed recently (and I then consider archiving it).
This apply for any VOB (UCM or non-UCM).
'lshistory' will certainly give you the most recent change to the PVOB. If you are interested in the last-accessed time, you can look at the DB files for the PVOB. For instance,
% ls -ltur <pathname_to_VOB_storage_directory>/db
That will sort by last-accessed-time of each file and the latest of those files, which would be the last listed because of the '-tr' flags, should include the time close to the last time the PVOB was accessed. For example:
-rw-r--r-- 1 vob_owner vob_group 94830592 Mar 28 2016 vob_db.d05
This PVOB was last accessed on March 28, 2016.

ClearCase: How to Uncheckout Files in Shapshot View Deleted From File System

Four months ago a colleague had a shapshot view that he deleted from the file system while there were still directory checkouts on a certain branch, say branch 'A'. Now some of directories are obsolete and need to be rmname'd from other views, but this cannot happen apparently while they are still checked out on branch A.
What is the most direct way to unco these directories on branch a?
You can unregister completely this view (even if the actual view is gone from the filesystem).
See "ClearCase: Is it possible to cancel checkouts not made from your own view?":
cleartool rmview -force -uuid (uuid_of_the_view) -vob \aVob
That will trigger, as a side-effect, the removal of the checkout status of any file checked out by this view (referenced by its uuid) in this vob (the -vob option).
See more at "How to delete clearcase views created by other users?":
cleartool lsview -l theViewToRemove # get its uuid
cleartool rmtag -view theViewToRemove
cleartool unregister -view -uuid uuid_of_viewToRemove
You even can use the nuke_view.pl script.
Now some of directories are obsolete and need to be rmname'd from other views, but this cannot happen apparently while they are still checked out on branch A.
As I mention in "How do delete a file in ClearCase?", even if you don't unregister the view, you can still remove a file from a branch, even if it is checked out in another branch.
You simply need to do it from the command-line:
cleartool rmname -force /path/to/file
Eric Schnipke proposes in the comments:
(1) cleartool lsview -l theViewToRemove to get the view's UUID and then
(2) cleartool rmview -force -uuid (uuid_of_the_view) -vob \aVob to remove the view and offending file version.

how to find all the branch type created by one person in clearcase

I created a branch type one month ago , but for some reason delayed to use it until now. But now I just have a vague memory of the branch name but not very sure about it
. So I'm wondering if clearcase has the feature that list all the branch type create by a person, in my case just me, then I can find the exact name of the branch type I created one month ago . Need your help, thanks in advance .
You can list the brtype of a vob, displaying only what you need with fmt_ccase directives:
cleartool lstype -kind brtype -invob \myVob
would be enough to do some grep, but for a more compact output:
cleartool lstype -kind brtype -invob \myVob -fmt "%u %Ad %N\n"
You would only have the username, the date and the name of the brtype, for you to grep.
Note the %Ad parameter: age in days, to be able to quickly spot brtype created 30 days or so ago.
cleartool lstype -kind brtype | grep username works for me on Linux.

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