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.
Related
The command $ darcs whatsnew lists unrecorded changes in the working tree. However, often the full list of changes is too cluttered to see in one screen which files have changed.
How can I list only the names of changed files?
In git I do this via $ git diff --name-only.
darcs whatsnew -ls should work I think
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?
I have a file that needs to be brought into a different branch. How do I do this from the command line. Everything seems to be geared to merging, where the file already exists in both branches.
You have to merge the parent directory first, so that the file shows up in the directory in the destination branch. At this point the new file will have zero size. You can then merge the file itself. The easiest way to do both of these operations is via the Version Tree view - much less error-prone than doing it via the command line.
Much simpler:
1/ rmname the file in the destination directory
ct co -nc .
ct rmname -force file.txt
2/ merge the directory
ct findmerge . -ftag view_tag
with 'view_tag' a view on the source directory
I no longer have access to a clearcase environment, so this is from memory, but what you want is to link in a version from another branch into the one that you are working with.
Let's assume that you have a file new_file that have been added on the branch new_feature (the latest version is new_file##/main/new_feature/5) which you want to merge/bring into the branch maintenance.
prompt>cleartool checkout -nc .
checking out some_dir##/main/maintenance/2
...
prompt>cleartool ln .##/main/new_feature/LATEST/new_file/main/new_feature/5 .
...
prompt>cleartool ci -c "linked in .##/main/new_feature/LATEST/new_file/main/new_feature/5"
prompt>
The commands above are probably not 100% correct, but should give you the idea. You want to use cleartool ln to avoid evil twins, because that will bring in a version from the already existing element (i.e. not creating a new twin).
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.
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