charleso / git-cc

Bridge for Git and Clearcase
Other
182 stars 95 forks source link

Only CC main branch code is migrated for all the branches. #96

Open yogeshdimble opened 4 years ago

yogeshdimble commented 4 years ago

Hi,

I am moving many branches from CC to GIT, one by one manually. This task is completed for all branches. Now while validation what I found is that all branch code in GIT is same. After checking deeper it is found that gitcc lists full history of a file, but while migration only main branch code is copied to GIT. It does not contains that branch specific code. If "branch is created from main branch" OR "created from other branch which is created from main", then only versions from main branch are checked in to GIT but the versions from that branch are not part of the migration. I have not made any changes to config file.

Config file .git/gitcc looks like:

[master] Clearcase=

Could you please help me on this? My aim is copy the branch specific code. i.e. From the branch is created from other/main branch upto the end of that branch.

Let me know if you need more information.

Thanks and Regards, Yogesh Dimble

charleso commented 4 years ago

@yogeshdimble do you mind expanding on how you're migrating each branch one by one?

I should warn you, git-cc isn't really multi-branch aware. You can add the following to your gitcc config to try and include changes to both main and branch_1, but I don't know if that's what you're looking for.

branches = main|branch_1

Each branch ends up as a completely different git commit tree, so there's no easy way (that I know) of merging all the branches in to a single repo correctly. :(

yogeshdimble commented 4 years ago

Hi charleso,

Thanks for quick reply. There are lot of branches we want to migrate. We are doing one by one means when one branch is migrated to git from CC then we start manually second one. This is how we are doing. It is not in one shot. Also different branches will be migrated to different branches & not in one directory. so there is no question of merging.

Now 1st thing I did not understood how the clearcase lists the history. CC lists the full branch history (including branching history) of the file and not limits it upto that file. E.g. in my project abcd.java is currently at main/60 level. But CC lists the history upto main/100 & beyond this point it also shows branching history. So while gitcc runs it commits the code in GIT with main/100. It should have stopped at main/100 but it checks in the code upto main/100. That is why the code in GIT is not matching with the code in CC. So this is my 1st question that how I can stop the checkin versions till main/60?

I tried running gitcc by adding branches =main|branch_1 in the .git/gitcc cofig file. It worked little bit. the files modified from branch_1 are now correctly came to the migrated code. But not rest of the files. In my work there is high level of branching used. The code is derived and merged from multiple branches. So do I need to mention multiple branches in the config file?

Thanks!!

charleso commented 4 years ago

Hi @yogeshdimble .

Firstly I should warn you that I probably can't do much to help you with this. I don't really maintain this library any more, and it's been a very long time since I used Clearcase.

My only suggestion in this case would be to grab a copy of the lshistory stream for a particular file, and maybe a copy of the config spec, and post it here for analysis.

Sorry I can't help any more than that.

kendegemaro commented 5 months ago

Hello @yogeshdimble , I might be late to help but still want to share my approach of "customizing" the rebase process with git-cc.

At first execution, git-cc creates a file .git/lshistory.bak in your repository, which holds the CC history. In subsequent runs, you can re-use this file with the parameter --load .git/lshistory.bak . You could do the following to filter the changes that you want to rebase:

  1. Create the .git/lshistory.bak manually with lsh [...] (you can find the exact command in the Python code)
  2. Modify lshistory.bak : Delete the lines you don't want. You could automate this process.
  3. Run git-cc with parameter --load .git/lshistory.bak

The modding of lshistory.bak turns out to be also very useful in some other edge-cases as well :)