charleso / git-cc

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

Multiple branches under one git repo #55

Open inglor opened 10 years ago

inglor commented 10 years ago

Hello Charles,

I'm trying to track 2 different branches of the same project in Clearcase under git-cc. I followed the documentation and I came up with this .git/gitcc file

[master] clearcase = V:\clearcase-prod-branch-view\path\to\project-src branches = prod_branch

[dev] clearcase = V:\clearcase-dev-branch-view\path\to\project-src branches = dev_branch

I initiated a gitcc rebase and loaded allt he history from prod branch to master. But there's no dev branch created to the git repository.

Did I understand the feature wrongly ?

charleso commented 10 years ago

Hi @inglor,

I'm afraid you have. Unfortunately, due to the way lshistory works (or at least the way I'm calling it), the history of files that aren't visible from your current view (eg. that are only exist on another branch) don't get returned, and so the history would be misleading/wrong.

This is how I remember the problem, although I vaguely wish I had an instance of Clearcase to confirm. (Although on the other hand I'm also happy if I never have to touch it again).

In any case, it's just a convenience feature when you want to maintain the mapping between a branch and view in a single repo, but it's not anything more than that. I'm sorry it doesn't the much more useful feature of fetching history across multiple branches, which would be extremely handy. The way I was using it, way back when, was to pull in the history of the master/main branch, and then create a new view/branch from that point, and having two branches in git and two views. Obviously at that point that branches in Git diverge - there's no merging/syncing between them.

It sucks. :(

If you can figure out a way to get lshistory to return history for files not in a view, adding the functionality wouldn't be that hard. I can't remember if I tried the -all flag, which might do the trick. But again I can't test it.

charleso commented 10 years ago

If you know if/when the dev branch is merged with master than you can manually create the ci_dev and cc_dev branches in Git and start using it. But as mentioned, there's no relationship at that point between master and dev, and you have to rebase both manually from that point onwards.

Not sure if that helps.

agusmba commented 9 years ago

This is what I've been doing for the past weeks. I created two local dynamic views, one on our production stream and another on our development streeam. I configured in .git/gitcc:

[develop]
clearcase = m:\my_project_view_sprint_86_int\vob_ccproject
branches = main*|ccproject_sprint_86*

[master]
clearcase =  m:\my_project_view_version_00.85.XX_int\vob_ccproject
branches = ccproject_00.85.XX*

(pay attention to the branches part, you can check the lshistory file to see what you should put into each one)

and at the git commits I wanted to start following clearcase, I created the additional branches master_cc, develop_cc and tags master_ci, develop_ci

I can now use gitcc in both my develop and master local branches, and they will be linked with the two different views.

A pity about not recognizing deliveries between clearcase streams, but I can live with it.

NOTE: sometimes I run gitcc update in order to make sure I have all the code in git, because I have seen that from time to time I miss some changes...

NOTE 2: bear in mind that adding manually the _cc and _ci branch and tag will tell gitcc not to look at older history from that point back, so depending on where you put them, your first gitcc rebase might not get all your files