1

Clearcase sucks a lot. It seems I cannot just save modifications to my project quickly. By quickly I mean in less than 1 second.

The solution I have found is to use the combo clearcase + git. I'm using snapshots views because I can easily hijack my files without having to checkout all the files in my project every time I want to do refactoring.

The problem is, when I play with git and navigate between new and old versions, clearcase think all the files are hijacked. Then I need to do the following.

  1. cleartool update
  2. cleartool ls -recurse | grep "hijacked" | xargs cleartool diff -prev [...] > changed
  3. cat changed | xargs cleartool co -nc
  4. cat changed | xargs cleartool ci -c 'some words...'
  5. rm **/*.keep
  6. git checkout .

The operation consisting of "clearcase push" which takes about 2 seconds with git will last for at least 10 minutes. I see only two explanation regarding this issue:

  1. I really do not know how to use clearcase
  2. Clearcase really sucks!

Does somebody knows how to quickly checkout then checkin modified hijacked files with Clearcase not UCM version ?

Edit:

Following the advices of Vonc I made a script that uses clearfsimport:

#!/bin/bash/
OUT="$(mktemp -d)"
DST=/vob/project_root/
echo -e "\nCreating temporary folder..."
echo $OUT

echo -e "\nCopying relevant elements..."
find . | grep -E '.*?\.(c|h|inc|asm|mac|def|ldf|rst)$' | xargs -I % cp --parents % $OUT
DOUT=$(cygpath -d $OUT/*)
DDST=$(cygpath -d $DST)
echo -e "\nImporting new elements to cleacase..."
clearfsimport -rec -unco -nset $DOUT $DDST

echo -e "\nRemoving temporary files..."
rm -rf $OUT   

The reason why I need to make a copy of my repository is that clearfsimport cannot directly exclude files or directories and wildcard options does not work with this tool. It takes a directory tree as is. Also I do not want to remove all my unversionned files such as object files or even the .git from my working directory.

I think I can make this script much better by identifying with git all the files that changed since the last execution of my script. Might be a bit tricky to do...

Also I can set my matching files pattern using .gitignore

Perhaps others already made such scripts...

Community
  • 1
  • 1
nowox
  • 25,978
  • 39
  • 143
  • 293
  • Great script and feedback. Regarding the modified files, maybe http://stackoverflow.com/a/1552353/6309 or http://stackoverflow.com/a/8016831/6309 could help? – VonC May 23 '14 at 11:11

1 Answers1

1

Your sequence for updating ClearCase file from a git working tree is pretty much the "optimal" one, meaning it won't get much faster.

One alternative I have been playing with when using ClearCase and Git is clearfsimport, with 2 ClearCase views.

  • one snapshot view is for updating a set of files which are then make hijacked (for a git working tree to use)
  • one snapshot (or dynamic actually) view to be the recipient, the destination of the changes done in the first working tree.

clearfsimport allows you to take any working tree (managed or not by ClearCase, it doesn't care), and import it in a ClearCase view (it can be a dynamic view, by the way), and:

  • checkout only the modified files
  • leave the identical files alone
  • remove / add the files in the ClearCase view, which were deleted/created in the working tree

It is a process more efficient than diff'ing everything, and it should be much faster.
That doesn't mean it is fast.
It is still, after all, ClearCase.

Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • I'm confused with `clearfsimport`. It tries to check all the thousands files in my .git folder. How can I ignore .git and obj/ folders ? – nowox May 23 '14 at 08:58
  • @coin simply make sure the .git isn't store in a working tree you intent to import in ClearCase. Remember that `GIT_DIR` can be set up in order to reference a .git outside of a working tree. See also http://stackoverflow.com/a/10824664/6309 – VonC May 23 '14 at 09:08
  • This doesn't solve the case of obj/*.o and all temp files. I made a HUGE list with wildcard. This is ugly but it seems to works... – nowox May 23 '14 at 09:17
  • And I agree with you "It is much faster. That doesn't mean it is fast" :( – nowox May 23 '14 at 09:17
  • @coin or you could do *several* clearfsimport, in order to not import the wrong subfolders. – VonC May 23 '14 at 09:18
  • Arf! If I use the syntax: `clearfsimport -rec -unco -nset ~/.../*.c /ccase/vob/project/` it will put all the new elements to the root of my dest folder. `...` doesn't work as I expected. Any suggestion? – nowox May 23 '14 at 09:27
  • 1
    @coin yes, `clearfsimport` is made to import a directory tree as is (cleaned up beforehand), not to be used as you want: cleanup first the tree structure, then you can use the `clearfsimport`. As said in the man page http://publib.boulder.ibm.com/infocenter/cchelp/v7r0m1/index.jsp?topic=/com.ibm.rational.clearcase.cc_ref.doc/topics/clearfsimport.htm: "For each path name, the leaf of the path name is imported into the target VOB. For example, `/usr/src/lib/foo.c` is imported into the VOB `/vobs/mylib` as `/vobs/mylib/foo.c` or into the VOB `/bigvob` as `/bigvob/foo.c`." – VonC May 23 '14 at 09:31