nowox
nowox

Reputation: 29096

Sync a ClearCase tree to Git (downward sync only)

I already found numerous solutions that may answer my question, but they all appear very obscure to me. Most of them are inadequately documented and I am not ready to deep dive into the code to understand how they exactly work. So I decided write a program to sync a ClearCase tree into a Git repository.

On ClearCase non UCM, only labels are relevant because they are the only information that allow to glue files together. Later I can also look at the timestamp of each file and guess from their comment if they belong to the same commit.

So my first step is to dump a ClearCase tree history with these information:

I think it can be done with this command:

cleartool find . \
    -exec 'ct lshistory \
        -fmt "[%n]\nHost:\t%h\nLabel:\t%l\nUser:\t%u\nComment:\t%c\n" \         
        %CLEARCASE_XPN% \
    '

Once I have a good dump I can write my Git Sync Tool that will import everything into a Git repository with all the branches and the labels.

Unfortunately I am not satisfied of my ClearCase dump command yep. Does anyone can help me?

From the solutions found on the Internet I considered git-cc that looked promising. Unfortunately there is no documentation and after hours spent on it I still did not understand how it works. Perhaps charleso can help me with it :)

Upvotes: 1

Views: 141

Answers (2)

nowox
nowox

Reputation: 29096

You can use clearcase-gitcc which works on ClearCase non UCM. The command:

git ccpull 

fetch the changes made on your ClearCase repository and the command

git ccpush 

submit your HEAD to your ClearCase view in a similar way as clearfsimport.

Upvotes: 1

VonC
VonC

Reputation: 1323953

You could add the branch (with fmt_ccase) which seems to be missing from your output (and that you mentioned in your list):

%Sn

Short name: For a version, a short form of the version ID: branch-pathname/version-number. For other objects, the null string.

Couple of comments:

  • A non-UCM label doesn't have to be put on all the files: a modification could have been done at the same time of the label, and yet not have been labelled (only a baseline full would set a label on all files of a component)

  • a cleartool find will list only visible elements in the view: you might miss the history of deleted elements in past revisions.

Upvotes: 1

Related Questions