I asked a couple of days ago how to commit an arbitrary directory tree in ClearCase and the answer I received was to use the clearfsimport
tool. This has worked flawlessly so far and can "import" into ClearCase (onto a dynamic view) arbitrary directory trees (from some external file-system directory):
clearfsimport -recu -nset /some/external/directory/foo .
My workflow is that I do all of my work and testing in that external directory (foo
) and when I am happy I commit my sources to ClearCase using the clearfsimport
tool as described above. This has worked so far in the initial commit but now I find myself wanting to import the modified sources. Effectively I need to import, in the place of the existing foo
directory a new directory tree. The changes may be pervasive: files / directories added, removed or renamed, files changed into directories or symlinks (and vice-versa). Effectively we may be talking about two very different directory trees with a very verbose diff -r
output.
I plan to use the following workflow:
ct co .
ct rm foo // remove existing dir from view
ct ci .
clearfsimport -recu -nset /some/external/directory/foo . // import the new dir version
Do you see any problems with the above approach in terms of history, etc?
For full disclosure I maintain my project (in /some/external/directory
) using git and so I create a "clean" copy of my project before running clearfsimport
(removing git-specific files like .git
, .gitignore
etc.). I typically have more detailed history in git but I am only interested in maintaining the history of specific noteworthy "milestones" in ClearCase for other team members that may want to look at my code and its evolution over time. That being said, I do not want (for the time being at least) to use any tools to bridge git to ClearCase and prefer to keep things simple.
I clarify that the workflow I am trying to establish is one way only (external directory to ClearCase) and that I am importing into a dynamic view.
Looking at the man page for clearfsimport
I see something like 'two passes' being mentioned and options like -rmname
that make me thing that it is possible to just run clearfsimport
with the target being an existing directory structure (i.e. without having to ct rm
it first). But I am not sure which incantation to use exactly and whether this would handle cases where a given name has changed in various ways (e.g. from file to directory or from directory to symlink or from symlink to file) or how renames are handled in terms of history.
Do you see any problems with the above approach in terms of history, etc?
Yes: you are not supposed to rm
anything when using clearfsimport
.
Simply import to the same view/destination folder and ClearCase will detect for you the new/modified/deleted file, will checkout, update or delete accordingly those files.
Add the -rmname
option to your clearfsimport
, and ClearCase will make sure to "mirror" your import, meaning a deleted file in the source folder will also be deleted in the destination folder.
The "incantation to use" is the same as before, just with an additional -rmname
parameter.