How to load a ClearCase snapshot view preserving timestamps - clearcase

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.

Related

ClearCase checkout version not selected by config spec

From a snapshot view using base ClearCase, I want to checkout the latest version of a file from a branch that is NOT selected in my snapshot view. I would expect this to be possible, because you can do it from the version tree browser tool.
However, the documentation for the checkout command claims that you can't do this in a snapshot (emphasis mine): [edit: Yes you can! See below.]
Nonstandard checkouts
By default, the checkout command checks out
these versions:
The most recent version on a branch, if you are using a dynamic view
The version currently loaded in the view, if you are using a snapshot view
To modify a different version, you can either use the –version option or create a subbranch at that version. (See the mkbranch
reference page). Furthermore, from a single view, you can have only
one checkout per element at a time.
Note: When you work in a snapshot view, the only version of a
directory element that can be checked out is the version currently
loaded in the view. Therefore, the –version and –branch options do not
work.
How can I check out an unselected version from the command line?
[edit: Here I misread the "Note:" section. What the help means is that directories can't be checked out using the -version or -branch args, but normal files can be.]
The actual solution selected by the OP dss539 is to use cleartool checkout directly (see cleartool checkout man page)
cleartool checkout -bra/nch branch-pname | -ver/sion
It would work for files (not directories) in dynamic or snapshot view.
If you don't want to modify the config spec of your current snapshot file, then you can:
either use a separate view (a dynamic one in order to have the right version immediately selected), and modify at will the config spec of that other (dynamic view),
And copy the version back to your snapshot view.
See also "How would you select versions from a specific branch in ClearCase?" for config spec example.
...
Actually, you don't even need to modify the config spec of that dynamic view:
You can use the extended pathname of the version you want to directly access and copy the right version.
or use the cleartool get command (which is what "Send To" is doing on the version Tree).
See "clearcase command to backup predecessor version of a file?"
(You don't need a separate view here)

Unable to add to source control as load state is update cancelled

we are using snapshot view (UCM).
While we tried to add source control a folder it fails with following error.
Rational ClearCase Explorer
---------------------------
Error adding 'D:\cc_view\IS-Dev1\Impl\Install\ViewDeployment' to source control.
Checkout is currently disabled for element "D:\cc_view\IS-Dev1\Impl\Install". An update appears to have been aborted or errors were encountered during an update. An update must be performed on the element to enable a checkout. Checkout is currently disabled for element "D:\cc_view\IS-Dev1\Impl\Install". Its config spec rule information is currently unavailable due to either an aborted update or an update in progress.
We have updated the view once again and stop and start the clearcase related services.
But still no improvement. When we look at properties of view-> advanced tab . it show Load state: Update cancelled.
I think this state may play a role. How to solve this and allow it to add to source code control?
You need to make sure to launch the update at the root directory of the snapshot view (above the vobs), because UCM might complain because of the configuration change.
If the Stream has been rebased, then an update would ask for you to accept the new configuration and launch a full update, but only if done from the root directory of the view.
Check also the logs of those updates (file *.updt in the root folder of the view), any error in it would mean a "Update cancelled" for the view.
A way to get a full update in your case would be (still at the root folder, as in this technote -- for CCRC but also valid for a full ClearCase installation):
cleartool setcs -current
Previous update or checkout is uncompleted. You have to update your snapshot view. You can run
cleartool setcs -current
OR
ClearCase Explorer->(on left panel--snapshot_name) right click-> Update View->Yes
that operation take a long time. That operation completed after this problem fixed.
Warning: Dont stop updating processing. You shouldn't start this operation while starting. Because you cant do progress while clear case updating to view.

How to update clearcase view via windows command line?

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.

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.

ClearCase: Is it possible to cancel checkouts not made from your own view?

Can the project manager force cancellation of checkouts of files/directories made in any view/stream/project? How?
A ClearCase administrator can force all files of a given view to be considered as "not checked out" (which is the equivalent of canceling their checkout status), with cleartool rmview:
cleartool rmview -force -uuid (uuid_of_the_view) -vob \aVob
You can get the uuid by grepping the user in the output of:
cleartool descr -l vob:\aVob
See technote "Removing checked-out references of a view from a VOB".
It will work for any view (snapshot or dynamic views, base ClearCase or UCM views)
I would recommend limiting that command to a specific vob.
Anyway, that doesn't concern the Project manager unless he/she is also a ClearCase administrator (ie, he/she is in the same group than the ClearCase administrators group on Windows, or if he/she is root on Unix)
Regarding a cleartool unco (which you can attempt on a dynamic view only), keep in mind if will only work for:
Version creator
Element owner
VOB owner
root (UNIX and Linux)
Member of the ClearCase administrators group (ClearCase on Windows)
Local administrator of the ClearCase LT server host (ClearCase LT on Windows)
So, unless your project manager has created the Vob in which those checked out files are managed, he/she won't be able to undo checkout them.
As commented below, all checkout files of the associated vob \avob are no longer considered checked out (their status is reset, not their modified content, which is untouched).
In order to restore those checked out files, a user can:
for a snapshot view, list hijacked files (as in this technote)
for a dynamic view list eclipsed files (see technote on eclipsed files)
Each filename found can be piped to a clearcase checkout command.
So restoring the checked out files is fairly easy for a given view and vob.
You can't if it was checked out in a snapshot view. You may be able to if it was checked out in a dynamic view. You can use Find Checkouts to find checked out files and attempt to undo the checkouts from there.
Ideally, if it is a view that is accessible by someone with higher privilege, e.g. Clearcase administrator who possesses the VOB owner account, it is best to ask him to perform the checkin (if you are sure the file can be checked in) or a saving of the checkedout file followed by a "cleartool unco".
If it is not the case, the command
cleartool rmview -force -uuid (uuid_of_the_view) -vob <vob-tag-where-checkout-is>
should do the trick as mentionned previously by VonC.
However, be aware that this command cancel ALL the checkout in .
So if you have say :
\avob\file1.c
\avob\file2.c
Say both files are checkedout by the same view of the same user and you want to uncheckout only file1.c. The "cleartool rmview" command described above cancels ALL the checkout in the VOB. So file2.c will also be uncheckedout.
The good news is that the checkedout version will not be lost as they will stay locally in the absent user's view. He will be able to access them once he is back.
There is still another strategy how to handle other persons checkouts as an administrator. Gain access to the users snapshot view. If the computer is reachable, mount the snapshot location and use it as yours. In this case you may even checkin these checkouts as you see the changed files. Is the computer is unreachable, you can construct a new view.dat with the view UUID and populate your view with a cleartool update command for the critial files and directories. Changes in directory versions you will see and be able to checkin, file element changes are not reachable, so you have always to unco file versions.

Resources