How to find all checkedout files with ClearCase cleartool? - version-control

I'm trying to setup our ClearCase with Hudson for a continuous integration (and deployment later).
I finally got a UCM view for the build, but unfortunatly our build process checks out files to store the build number. Now the build broke and the file is still checked out, preventing the next build.
I already now about cleartool find . -type f, but I can't figure out how to find checked out files. I know the syntax of UNIX' find, so that isn't a problem.
Can someone point me to a documentation of the query language or maybe give an example to find checked out or hijacked files?

You can start by this SO question on how to list private files.
Then it depends on the nature of your ClearCase view.
On a dynamic view for instance, a simple ct lsprivate list private files (including hijacked ones) and checkout files.
The official command is cleartool lscheckout (or 'lsco').
If you are within the right vob within your view:
$/path/to/view/vobs/aVob
cleartool lsco -rec -cview
,should list all checked out files from any user in any sub-directories of said vob.
But if your build is broken because of files checked out in several vobs, then you need to widen the scope:
$/path/to/view/
cleartool lsco -avobs -cview
(you don't need to be in a specific vob in this case)
As Manjunath K Mayya points out in the comments:
To list only the file names, without the version details, we can use "short":
cleartool lsco -short -avobs -cview

Related

ClearCase equivalent of git status

With git (and other revision control apps like mercurial), you have a "status" functionality for a repository, which lists the repo files which are Modified, Deleted, Moved, Added or Missing.
How do we achieve the same in ClearCase (relative to the non-checked-out version chosen by the configspec currently in effect)?
The best I have so far is listing the files with modifications using ct diff and grep'ping for ---'s.
Anything related to file status is usually managed by cleartool ls
cleartool ls -r -l -vis
You can also add --view-only to restricts the listing to objects that belong logically to the view: view-private files, view-private directories, and view-private links; checked-out versions; and all derived objects visible in the view.
But I suspect some kind of post-processing (grep/awk) will be needed to get exactly what you want.
You have an example in bmpenuelas/gfcc
gfcc status
clearcase actions: List all new or modified files.
cleartool ls -rec -view_only to get new files.
cleartool lsco -cview -a -s to get all the checked out files, then find those which have been actually modified with cleartool diff -predecessor.
So a better git status equivalent is, according to this project, a bit more involved.

ClearCase: I am not able to get the files from Clearcase

I'm using the ClearCase as version control tool.
When I am creating view in a particular VOB, all the folders has been downloaded from the server. But files are not getting downloaded.
For that I am doing as a workaround a 'checkout' of the current vob and then UNDO checkout the same. Then only I am getting files.
Is there any fix for this?
all the folders has been downloaded from the server.
"Downloaded" means probably this is a ClearCase snapshot view, which reads the config spec:
"selection rules"
"loading rules"
and download the elements (files and directories) whose version matches the selection rules, and whose path matches the loading rules.
You need to do a cleartool ls in a folder where you see only subfolders in order to understand what selection rules was used to download those folders (and not the files)
cd /path/to/my/view/(vobs/)myVob
cleartool ls
From there, you can edit the config spec (cleartool edcs) in order to fix the selection or loading rules, ensuring that folders and files are downloaded when you update the snapshot view.
Maybe those folders are considered as hijacked: see "Locating hijacked files in snapshot views".
If there is a .cc_loading directory it looks like a wev view. Cleartool claims that it doesn't work in those views (if if the command has nothing to do with a view context!).
You should you "rcleartool ls", but you can also see what version of the directory is used with the help of CTE.
I guess that you see version /main/0 of the directories.
As this is a snapshot view, create a dynamic view with the same configspec and see what it sees. If you see directories and not files in the dynamic view, what is the configspec? And what does cleartool ls show you?

What is the svn equivalent to winkin in clearcase?

I am new to svn, however I am at present making the transition of some Perl scripts from ClearCase. I know that Clearcase have dynamic views, so it can access one or more derived objects (DOs) from a dynamic view, or convert a nonshareable derived object to a shareable (promoted) derived object by the cleartool command winkin. How do I replace it with an equivalent svn command, knowing that svn is static.
You don't: Those notion of derived object are very specific to ClearCase dynamic view. cleartool winkin accesses the data of any existing DO, and a DO does not exist in Subversion.
That is similar to "Is there a git equivalent to cleartool catcr": gcc (meaning the tool using the sources to compile) might have some information, but the source control tool itself (Subversion) won't have any.
flag
1) I had to get rid of the omake concept of calling the makefile (I got a makefile.bat for the same)
This has nothing to do with SVN or git.
A third-party tool (OmpenMake, graddle or Bazel (see "e") would be needed here.
2) The cleartool commands like winkin, endview should be changed so that this becomes svn compatible.
There is no notion of dynamic view in any other tool but ClearCase.
3) this changes will stir up changes in the *.LOG file that gets generated on successfully running the *.BAT, I need to have a list of files (URL and revision no. which will be stored in the *.LOG file, for this I need to change the cleartool describe command)
That depends on the language and build mechanism you will chose, and not on SVN.
With a modern language like go (golang), you wouldn't be concerned anymore by the list of files built: only the one with changes would be recompiled.

How can I add a directory tree to my github repo?

I've been working on a project that's fairly far a long now and I decided it's time to use some sort of version control etc. I decided to go with github. Before I get in too deep let me state explicitly that I am new to github.
My project resides in a directory that contains myriad subdirectories and files of all different kinds. I'd like to take my project directory as is (structure and all) and put it in my github repo.
I followed the tutorials on github's webpage, created the repo, and manually added some files. Obviously I don't want to manually add every file (there are several hundred). I'd like to know how I can add the root directory or for that matter any parent directory and all files/folders in said said directory. In other words I'm looking for a recursive add.
I read on this SO page (How to create folder in github repository?) that you can just use
git add directory/
That works fine for me when I'm dealing with the lowest level directory, but when I try the same command on a directory with subdirectories my terminal just sits there and I have to ctrl-c. I can't tell if it's just taking a long time (as I mentioned there are lots of files) or if this is just the wrong way to add a directory with subdirectories.
Apologies in advance if this is a super ignorant question -- I have looked at a lot of blogs/posts/etc and I cannot find a solution that seems to work.
Use the Current Working Directory
Assuming you're on Linux or OS X, from the command line you would do the following:
git add .
from the root of your repository tree. That will add all non-ignored files, including non-empty directories, into the repository.
From the root directory (the one with all the subdirectories), use git add -A.
If you have a ton of subdirectories and files, it may take a long while, so just let it sit there until it's done.

Use perforce to capture current state of external directory

I have a directory outside the repository. I put generated sources in there. These generated sources take FOREVER to create. Rather than have everyone on the team generate these sources, I would like to use our build machine to generate the sources, and check them in to perforce. How do I do this and ensure that the source controlled directory only has only the most recent files and not any that were generated previously but not in the most recent build?
I was thinking of doing a p4 edit on all the files in the generated directory (for existing files), then doing a p4 add using wildcards to get any files that are new, but I do not know how to handle files that were previously generated, but not generated in the most recent build (should be deleted).
Start as you suggested - p4 edit and p4 add to capture all changes, then call
p4 revert -a
Which will revert any file in the depot that is open for edit but is actually unchanged or missing.
I found this on the perforce blog and it is exactly what I was looking for. Automating folder replacement using P4Java and Apache Ant
One idea is to, before the build, removing everything in this area manually (not through Perforce, but through the OS). After doing the build, do a "Reconcile Offline Work". This will reconcile in Perforce what you have in this area by adding new files, deleting ones that are not there anymore, and editing those that have changed.
You can reconcile offline work through P4V, as seen here. In your workspace browser, right-click the folder and choose "Reconcile Offline Work".
Or, you can do it through the command line if you prefer a more automated solution, as seen here. (Note: this link also talks about reconciling through p4v, but this is superseded by the previous link)
p4 diff -se //myclient/... | p4 -x - edit
to checkout changed files.
p4 diff -sd //myclient/... | p4 -x - delete
to delete files.
find . -type f -print | p4 -x - add
find . -type l -print | p4 -x - add
to add files and symlinks in Unix, or
dir /s /b /a-d | p4 -x - add
to add files in Windows.
For Binary files in Perforce you can set a FileType flag that only stores 1 (or a set number ) of revisions for the file in the repository. This way you will have history of the file but your other users will only have access to the binary for the latest version of the file and also your server will only store one copy which is much more storage efficient if you dont need to store multiple copies.
To make the change.
Add the files you are interested in to the repository.
Check out the file.
Right click in P4V and select Change Filetype
On the dialog pops up select +S "Server limits the number of revisions stored" at the bottom of the screen, which will restrict the number of files stored.
Hope this helps.