Friday, August 27, 2010

Integrating GDCM 2.x to ITK (the hard way)

Let's start from the begining:

$ git clone git://itk.org/ITK.git

install hooks and pushurl...

$ git checkout -b integration-gdcm-2-0-16

git status reval I now on branch integration-gdcm-2-0-16

HACK HACK
$ git commit
...

Now in order to share code with Mark Roden. I decided to push to my github account:

$ git remote add perso git@github.com:malaterre/ITK.git
$ git push perso integration-gdcm-2-0-16

After a couple of exchange the branch was properly compiling on Linux/Win32/MacOSX.
I was ready to push GDCM 2.x to ITK. As suggested by Brad Lowekamp I pushed to stage first:

$ git remote add stage git://itk.org/stage/ITK.git
$ git config remote.stage.pushurl git@itk.org:stage/ITK.git
$ git fetch stage --prune
$ git checkout integration-gdcm-2-0-16
$ git push stage HEAD

one can then print it:

$ ssh git@itk.org stage ITK print

I pushed it also to gerrit for review.

$ git log gerrit/master..
$ git push gerrit HEAD:refs/for/master/integration-gdcm-2-0-16

This lead to some discussion with Brad King.

$ git add CMake/ExportConfiguration/CMakeLists.txt CMakeLists.txt
$ git commit
$ git push gerrit d2ee19d:refs/changes/24
Counting objects: 14, done.
Delta compression using up to 16 threads.
Compressing objects: 100% (8/8), done.
Writing objects: 100% (8/8), 9.84 KiB, done.
Total 8 (delta 6), reused 0 (delta 0)
To malaterre@review.source.kitware.com:ITK
! [remote rejected] d2ee19d -> refs/changes/24 (squash commits first)
error: failed to push some refs to 'malaterre@review.source.kitware.com:ITK'

This was not quite right, I had to squash the last two commits:

$ git commit --amend
$ git push gerrit 1ddc92d:refs/changes/24
Counting objects: 14, done.
Delta compression using up to 16 threads.
Compressing objects: 100% (8/8), done.
Writing objects: 100% (8/8), 9.85 KiB, done.
Total 8 (delta 6), reused 0 (delta 0)
To malaterre@review.source.kitware.com:ITK
! [remote rejected] 1ddc92d -> refs/changes/24 (squash commits first)
error: failed to push some refs to 'malaterre@review.source.kitware.com:ITK'

Still not ! I need to actually edit the word 'pick' and change it to 'squash':

$ git rebase -i HEAD~2
$ git push gerrit 448bcde:refs/changes/24
Counting objects: 62, done.
Delta compression using up to 16 threads.
Compressing objects: 100% (35/35), done.
Writing objects: 100% (38/38), 21.88 KiB, done.
Total 38 (delta 25), reused 0 (delta 0)
To malaterre@review.source.kitware.com:ITK
* [new branch] 448bcde -> refs/changes/24

Now that the change are on gerrit, push them to stage too:

$ git push stage HEAD
To git@itk.org:stage/ITK.git
! [rejected] HEAD -> integration-gdcm-2-0-16 (non-fast-forward)
error: failed to push some refs to 'git@itk.org:stage/ITK.git'
To prevent you from losing history, non-fast-forward updates were rejected
Merge the remote changes before pushing again. See the 'Note about
fast-forwards' section of 'git push --help' for details.

Hum, something happen during the squash that made the push non-trivial on stage.

Meanwhile, let's push to my github account:

$ git push perso integration-gdcm-2-0-16

Thanks to Brad L., I tried it again:

$ git checkout integration-gdcm-2-0-16
$ git log master..
$ git push -f stage integration-gdcm-2-0-16
$ ssh git@itk.org stage ITK print
$ ssh git@itk.org stage ITK merge integration-gdcm-2-0-16

Finally all set ! Thanks to Brad K. and Brad L. !

References:
* http://www.itk.org/Wiki/ITK/Gerrit
* http://www.itk.org/Wiki/ITK/Git#Topic_Stage
* http://www.itk.org/Wiki/ITK/Git#Pushing

No comments: