How execute cleartool command in Rational ClearCase? - clearcase

I would like to run a command in cleartool.
I am, however, unable to understand how do I launch this cleartool from Rational Clearcase.
Is it a plugin for ClearCase?
(I am using Clearcase explorer on Windows 7)

It is a command line interface (see IBM man page, and "Working at the command line").
It supposes that your $PATH (or %PATH% on Windows) environment variable references the <ClearCase installation directory>/bin.
Open a shell (like a DOS windows in windows, or ksh/bash/zsh on Unix/Linux) and type:
cleartool
That will open a sub-shell in which you can type cleartool command like lsvob.
I prefer, however, typing cleartool in the native shell:
cleartool --ver
cleartool lsvob
...
(instead of typing those commands within a cleartool session)
That allows for a better error trapping and recovering process, directly handled in the native shell.
Note: above is for ClearCase 7.x.
For CCRC, or ClearCase 8.x (which is using ClearTeam Explorer, a modern version of CCRC), you would be using rcleartool.

Even I am using clearcase explorer on Windows 7.
Access the machine using a ssh client like putty and run cleartool it should take you into that command line interface. if not, you need to set cleartool in path.
Let me know what more you need.

Related

Replacement of cleartool setview exec

For some reason, our company don't support clearcase anymore.So I need to remove it from scripts,use folder to replace it.
For the command
Cleartool setview -exec "$RUN_SCRIPT paramter1 paramter2" $MY_CC_VIEW
$RUN_SCRIPT=/vobs/sw/ecomps/tools/script_remote.sh (a script located in view path)
how to replace it?
cd a path that script located in ,then execute the command?
cd $MY_CC_VIEW_PATH/vobs/sw/ecomps && tools/script_remote.sh paramter1 paramter2
cleartool setview is for setting the view content of dynamic views, so if ClearCase is not running anymore, you would not be able to access any dynamic view anyway.
As I mentioned in "Python and ClearCase setview", never use setview in a script anyway: always use the full /view/viewTag/vobs/aVobTag/... path.
But again, if ClearCase is stopped, that dynamic view path would not be accessible: you should at least checkout snapshot views, whose content would remain accessible even if there is no ClearCase server running.

'ls' is not recognized as an internal or external command, operable program or batch file

'ls' is not recognized as an internal or external command, operable program or batch file.
I get this error when I try to glance at the files of my folder.
cmd opened regularly(not as an admin).
I've recently downloaded anaconda for python.During the installation process, there was a time when I allowed to add a PATH which was not recommended.
'ls' used to work well be
Here are the paths
I'm fairly certain that the ls command is for Linux, not Windows (I'm assuming you're using Windows as you referred to cmd, which is the command line for the Windows OS).
You should use dir instead, which is the Windows equivalent of ls.
Edit (since this post seems to be getting so many views :) ):
You can't use ls on cmd as it's not shipped with Windows, but you can use it on other terminal programs (such as GitBash). Note, ls might work on some FTP servers if the servers are linux based and the FTP is being used from cmd.
dir on Windows is similar to ls. To find out the various options available, just do dir/?.
If you really want to use ls, you could install 3rd party tools to allow you to run unix commands on Windows. Such a program is Microsoft Windows Subsystem for Linux (link to docs).
We can use ls and many other Linux commands in Windows cmd. Just follow these steps.
Steps:
1) Install Git in your computer - https://git-scm.com/downloads.
2) After installing Git, go to the folder in which Git is installed.
Mostly it will be in C drive and then Program Files Folder.
3) In Program Files folder, you will find the folder named Git, find the bin folder
which is inside usr folder in the Git folder.
In my case, the location for bin folder was - C:\Program Files\Git\usr\bin
4) Add this location (C:\Program Files\Git\usr\bin) in path variable, in system
environment variables.
5) You are done. Restart cmd and try to run ls and other Linux commands.
you can use dir instead of ls in cmd
If you want to use Unix shell commands on Windows, you can use Windows Powershell, which includes both Windows and Unix commands as aliases. You can find more info on it in the documentation.
PowerShell supports aliases to refer to commands by alternate names.
Aliasing allows users with experience in other shells to use common
command names that they already know for similar operations in
PowerShell.
The PowerShell equivalents may not produce identical results. However,
the results are close enough that users can do work without knowing
the PowerShell command name.
when you use windows as operating system you should write dir
and you will find all folders including empty folders and their data bytes storage
and you can use git ls-files to show all folders but not including hidden folders
The reason you cannot run the ls command is because it does not exist on windows. The windows equivalent is the dir command, however it does not work the same way. The solution, Winls. It is
The ls command, written for windows.
According the the Winls github.
Had this error because i was using command prompt to access my files.
how did i solve it...
i opened my folder with vscode, and used bash from the terminal...the "ls" command worked as it should from bash.

Cleartool changes config spec, but does not update view

I am using Cleartool in a build script to update a dynamic view's config spec. The script is a perl script being run on Cygwin. The Cleartool command successfully changes the config spec of the dynamic view, but it does not update the view itself. In the script we use the following commands:
cleartool setcs -tag <view_name> <config_spec_file1>
cleartool catcs -tag <view_name>
The catcs command outputs the expected config spec, and opening up the view's config spec in ClearCase Explorer shows the expected config spec. It is not until we open up the config spec, and simply hit apply, that we see the expected view files (we don't change anything in the config spec, we just open, apply, and close).
We have also tried forcing the view to stop/start after the setcs command, but that didn't work either.
I would expect that the setcs command alone would be enough, as the documentation says that's all that is needed.
setcs documentation
If possible, avoid Cygwin, and run the perl script in a simple CMD session.
You have some resources for getting Unix commands without having to use Cygwin.
Gnu On Windows includes 100+ Unix commands,
Git for Windows has more than 200 of them, plus a msys2 modern bash shell.
If you really have to use Cygwin, add at least a cleartool ls (done in the vob of the view whose config spec just was updated).
An ls should force the files to be updated.

Using ClearCase tool or java code, how to get the entire version of a particular file?

I need to get the version (entire version like main/branch1/branch2/1) of a particular file using ClearCase tool or java code.
Can some one please help me on this ?
The command to use is cleartool get:
On a UNIX or Linux system, copy /dev/hello_world/foo.c##/main/2 into the current directory.
cleartool get -to foo.c.temp /dev/hello_world/foo.c##/main/2
On a Windows system, copy \dev\hello_world\foo.c##\main\2 into the C:\build directory.
cleartool get -to C:\build\foo.c.temp \dev\hello_world\foo.c##\main\2
You can see more at "In ClearCase, how can I view old version of a file in a static view, from the command line?":
cleartool get don't do stdout (it only copies to a file)
in a dynamic view, you can directly access any version you want
cd /view/MyView/vobs/myVobs/myPath/myFile##/main/[...]/maBranch
cat 1

Is it possible to find a list of all hijacked files in a view in CCRC?

In the ClearCase Remote Client is it possible to find a list of all hijacked files in a given view?
Right-click on your view and select Show Pending Changes. All of your hijacked files will be displayed at the top of the list under the heading Hijacked Resources.
It's also possible through the UI, albeit indirectly.
If you run "Refresh > Update from Repository..." off the context menu, the UI will present you with a list of files it did not update upon completion. This will include all hijacked files.
If you're looking to check out the hijacked files, you can select them all and check them out from that display.
In a snapshot view, it is possible to do so using 'cleartool ls -recurse | grep hijacked' (Unix/Linux) or 'cleartool ls -recurse | findstr "hijacked"' (for Windows)
See the link Identifying hijacked files in a snapshot view
In a Web view or CCRC view, I would think that you should be able to do the same if you have installed rcleartool.
The command "rcleartool ls -recurse | grep hijacked" should work the same way.
Note: Depending on the version of CC on your server, rcleartool you need to use is either a separate zip or either included in the CCRC rich client. It is not included by default in the CCRC plugin for eclipse.
Detecting hijacked files in a web or CCRC view can be tricky, depending on the state of the view itself.
For instance, the .COPYAREA.DB file, if missing or corrupt, means that all or some of the loaded files will appear to be hijacked. (see "About the .copyarea.dat and .copyarea.db files")
Other bugs (swg1PK64597, swg21433085) can affect the list of hijacked files as well, depending on your ClearCase version and your OS.
Another way to list hijacked files it to look for "skipped object" after an rcleartool update:
rcleartool update -noverwrite
(with -nov/erwrite leaving all hijacked files in the view with their current modifications)
Hijacking an element in a snapshot view involves making it writable and making a change to it. There is no lshijack or lsprivate -hijacked command to list the files. While the cleartool update operation does generate a log identifying hijacked files, the best way is to use cleartool ls command which identifies hijacked versions in much less time than an update would take.
Use cleartool ls from the command line and look for the [hijacked] tag on objects.
Example output:
%> cleartool ls
archive.ppt##\main\1 [hijacked] Rule: \main\LATEST
project.doc##\main\1 Rule: \main\LATEST
doc_resources.ppt##\main\2 [hijacked] Rule: \main\LATEST
To obtain a list of all hijacked files in a snapshot view, use the following command:
On UNIX® and Linux® you can run the following command from a snapshot view:
cleartool ls -recurse | grep "hijacked"
On Microsoft® Windows® you can run the following command from a snapshot view:
cleartool ls -recurse | findstr "hijacked"
This command will perform a recursive "cleartool ls" and then use "grep" or
"findstr"command respectively to filter any lines that have the [hijacked] line associated with them.
Note: GREP is a native UNIX command; however, it can be run on Windows if the utility is installed. The grep tool comes with applications like GNU, Free Software Foundation or Cygwin

Resources