How to update clearcase view via windows command line? - clearcase

I have a view named "Dev_view" in ClearCase and want to update the view via windows command line. Is there a way to do that?
In particular, what other command can trigger a view update?

See cleartool update command (for full ClearCase client, not for CCRC)
cd /path/of/your/snapshot/view
cleartool update .
You cal also add the following options:
-ove/rwrite
Overwrites all hijacked files with the version selected by the config spec.
-nov/erwrite
Leaves all hijacked files in the view with their current modifications.
-ren/ame/
Renames hijacked files to filename.keep and copies the version in the VOB selected by the config spec into the view.
Note that updating the root directory of an UCM view have side-effect: it will re-evaluate the config spec of the view against its associate UCM stream, and will propose to update said config-spec (and proceed with the update).
This isn't the case for a non-UCM view, where a cleartool setcs will always trigger the update after chaging the config spec.

Related

How to load a ClearCase snapshot view preserving timestamps

I'm trying to create a new snapshot view (from the command line) and load the vob, preserving timestamps. After the view has been created, I edit the config spec as needed, followed by the line:
load /vob/myvob
On save, it prompts me:
Set config spec and load snapshot view "myviewname"? [yes]
Upon typing "yes", the vob gets loaded with the current timestamp. Since I prefer it to be loaded with the timestamps preserved, my workaround is to delete the contents of the vob, and then from the command line call:
cleartool update -rename -ptime -force
where the "ptime" flag tells it to preserve the timestamp of the file.
Is there a simpler way to do this with the "load" command within the config spec?
EDIT: I'm using ClearCase 7.1.2.4 on Solaris 8
You can use the '-ptime' option to 'cleartool mkview'. See:
http://www-01.ibm.com/support/knowledgecenter/SSSH27_8.0.1/com.ibm.rational.clearcase.cc_ref.doc/topics/ct_mkview.htm
You can check the Clearteam Explorer preferences:
Preserve version creation time when files are updated or loaded from the server
By default, the last modified time of a ClearCase element is the time when the element was last loaded, updated, or restored.
To specify the modified time of the element as the last modified time of that version in the VOB, click the Preserve version creation time when files are updated or loaded from the server preference.
Note that this preference setting can also affect an Undo Checkout or Undo Hijack operation.
Undoing a hijack operation reloads the corresponding version from the server and restores the last modified time as specified by this preference setting.
Likewise, undoing a checkout operation restores the corresponding version of the element and also restores the last modified time according to this preference setting.
Note: you have the same option for ClearCase 7.1.x.
From the main menu bar, click Window > Preferences to open the Preferences dialog box.
If you are using the Rational ClearCase Remote Client for Eclipse, select Team > ClearCase Remote Client > ClearCase Explorer,
If you are using the Rational ClearCase Remote Client, select ClearCase Remote Client > ClearCase Explorer.
To specify the modified time of the element as the last modified time of that version in the VOB (instead of the time when the element was last loaded, updated, or restored), click the Preserve version creation time when files are updated or loaded from the server preference
On command line firstly, create empty view with the following command:
cleartool mkview -snapshot -tag <tag_name> -vws \\<computer_name>\<views_folder>\<view_name> <path_of_localstorage>
Then load it based on the config spec with the following command:
cleartool setcs -force -overwrite -ptime <CS_Folder_Path>\<CS_File_Name>
For details you may follow this link.

UCM: How to create dynamic view (base clearcase) on arbitrary incremental baseline

Currently we use ClearCase UCM.. I am trying to evaluate possibility of using git in our project. I decided to create large repo with past three years changes from an integration stream. The pvob has 12 vobs under it. For purpose of evaluation(creating a worst case), I am putting all changes into single repository.
I want to create a base clearcase view and then adjust its spec for every baseline on the pvob. This will then synched to git repository.
Question in short: How can I create a base clearcase view given a pvob base line and keep changing its config spec to match every baseline?
(academic note : A picture of what I am trying to achieve.. )
(Approach discussed in ClearCase UCM: Is it possible to have a temporary view on any given baseline? is kind of work around in my case. I guess I can avoid the step of creating many temporary streams- not sure how!)
I am putting all changes into single repository.
This isn't the right granularity for a git repo.
Having done multiple ClearCase to Git migration, the right scale usually is one UCM component equals one Git repo.
How can I create a base clearcase view given a pvob base line and keep changing its config spec to match every baseline?
You don't have to create a base ClearCase view.
You can create a sub-stream to the Int stream, and manage the baselines you want to see there.
(cleartool rebase -bas xxx#\YourPVob)
You can then use an UCM view to that sub-stream as a source for your git import.
If that approach isn't possible (as I explained in my previous answer you mention, because for instance all baselines haven't been created in the same parent stream), then you can create a base ClearCase view and modify its config spec in order to select the baseline complete ids:
element * BaselineId1
element * BaselineId2
...
(A dynamic view here is more useful to tweak the config spec.
Once the config spec is set, you can update a snapshot view with the same config spec, and appropriate load rules, to use it as a source for your git import).
You need to make sure those baselines are:
full baselines (you can promote an incremental one to a full one)
referenced with their id (not their title, which is their visible name).
See also "Display Current Baseline with Cleartool":
cleartool describe -l baseline:aBaseline#\aPVob
cleartool descr -fmt "%[found_bls]CXp" stream:myStream#\myPVob
The second command would give you all baselines in a stream.
In both cases, you would see the baseline ids in addition of their names.
I have mention the ClearCase to Git migration aspect in :
"Migration from UCM ClearCase to GIT"
"How to integrate ClearCase development history into Git?"
"Save history from ClearCase to Git?"
"How to bridge git to ClearCase?"
"Sync GIT and ClearCase"
A good trick is to use:
git --git-dir=/path/to/git/repo/.git --work-tree=/path/to/ClearCase/view add .
That allows you to consider the ClearCase view as the working tree of your git repo (which is the destination of your import).
I generally don't try to import all baselines from all streams because it is too complex too soon (in order to get the sequence of those histories right).
I just get a few baselines from the main stream, import them and go from there (keeping the ClearCase referential as a read-only archive source for history research).

How do I check if I have a base clearcase or UCM?

I am new to ClearCase . I have used rational synergy before.
We use ClearCase in our project for version control.
In my old project, I have used rational synergy, in which we used to create "tasks" for any modifications in the files.
I got to know that we have activities in ClearCase, which I want to use in our projects.
As of now, we just check-out the files and modify and checkin the changes.
But when I check my ClearCase --> Actions, I don't see the option ->WorkOn to start creating an activity.
We are currently using the following version of ClearCase:
Version: 7.0.1.D061004
Build id: BALTIC_MR1.D070516
Please tell me if i need to install anything else?
The "work on" would be (setact man page):
cd /path/to/your/ucm/view
cleartool setact anActivity#\yourPVob
To check on what activity you are currently working (lsact man page):
cd /path/to/your/ucm/view
cleartool lsact -cact
To check if a view is an UCM one or not:
cd /path/to/your/view
cleartool lsstream -cview
If there is a stream attached to your view, it is an UCM one. If not, it is a base ClearCase one (not this is separate for the nature of the view: dynamic or snapshot: you can have dynamic or snapshot view both for UCM or for base ClearCase).
another way is:
cleartool catcs
The config spec for an UCM view is automatically generated and quite more complex than the one for a base ClearCase view.

How can I view only a set of files in clearcase

I need to create a tar of only a set of files (a.c, b.c, c.c) obtained from the ClearCase repository.
I need all latest versions of those files, and I am writing a script to do this.
How can I do it?
Should I create a new static view with a modified config spec and then do a tar?
If so, how can I select only those files to appear in the view and not the entire code base?
You can create a snapshot view with a config spec like:
element * /main/LATEST
load /vob/path/to/a.c
load /vob/path/to/b.c
load /vob/path/to/c.c
(I am assuming here base ClearCase, not UCM ClearCase)
That would only load the relevant files, with the LATEST version selected.
You can script the creation of a snapshot view (to do only once) with the cleartool mkview command.
See examples in this answer.
See also "What are the differences between a snapshot view and a dynamic view?":
if you have a dynamic view with a simple config spec:
element * /main/LATEST
Then you wouldn't need to load files, only to mount the vob: all the files would be available.
That can be a solution too.

ClearCase: Creating baseline in snapshot view

with ClearCase UCM I can create a baseline in a snapshot view directory. When not all files are up-to-date, which version of a file is included in the baseline?
Example: version 3 of foo.txt is located in the snapshot view directory and there already exists a version 4 of this file. Which version of the file is referenced by the baseline?
Does this depends on the version of ClearCase (I am using ClearCase 7.1)? Do I have to consider something?
Background of the question: for a continuous integration build I want to use a snapshot view. When during creating or updating the snapshot view an other user checks in a file to the same stream this new version may or may not be part of the snapshot. At least I want be to be able to identify which files in my snapshot directory have been used by the build.
About Baselines: A mkbl depends on the selection mechanism (the config spec)
of the local access mechanism (snapshot or dynamic view) providing said selection mechanism.
For each element in the component, the baseline records the version of that element selected by the stream's configuration at the time mkbl is executed.
So the -view parameter is only there to reference the Stream (and its associated config spec):
-vie/w view-tag
Specifies the view from which to create baselines. Baselines are created in the stream that the view is attached to.
For example, if you are working in coyne_dev_view, but want to create a baseline from the configuration specified by the view coyne_integration_view, use -view coyne_integration_view.
This option creates a baseline in the project's integration stream that includes all the checked-in versions contained in coyne_integration_view.
If you do not specify view-tag, the current view is used.
In your case, if your UCM view is supposed to select v4, but is currently selecting v3 because that snapshot view hasn't been updated yet, the baseline should reference v3 (what is currently selected by the view).
So for your background question, best to perform a cleartool update before the mkbl.

Resources