[Insight-developers] C# wrapping for SimpleITK

Dan Mueller dan.muel at gmail.com
Tue Sep 21 01:17:33 EDT 2010


Thanks Dan. Git is so cool! Just need to keep learning I guess...

I sent the review to you and Gaëtan (figured he might be interested
due to upcoming work to add C# to WrapITK).

Cheers, Dan (M)

On 20 September 2010 21:07, Daniel Blezek <Blezek.Daniel at mayo.edu> wrote:
> Hi Dan (M),
>
>  Don't sweat it, we're all newbie's here.
>
>  I would have thought this would work, even if you pushed from your master
> branch...
>
>  To be safe, create a clone of your local work. (this is a very cool
> feature of git).
>
> cd /new/directory/
> git clone /path/to/SimpleITK
>
> cd SimpleITK
>
>  Now, any changes you make in this new directory are independent from your
> original SimpleITK repository.  If you screw it up, just delete it and try
> again.  Neat huh?
>
>
> *In the new directory*
>
>  I _think_ you can get out of this by creating a topic branch.  First keep
> your current commit SHA1 handy:
>
> git log
>
> (grab the SHA1 of the commit you just made).
>
> From where you rebased your two commits, try:
>
> git checkout HEAD~1
>
> This _should_ move your current checkout back one commit, before your C#
> commits.  You will get a very scary sounding message about being in a
> "detached HEAD" state (sort of like a headless chicken running around).  You
> could also enter a branch name, or a SHA1 rather than HEAD~1.  Incidentally,
> HEAD~1 means the commit before the HEAD, a sort of shorthand for relative
> commits.
>
> The next thing I would try is to create a branch here:
>
> git checkout -b SimpleITKCSharpWrapping
>
> This should create the branch and move you onto it.  Then you'll need to
> pull your commits from the master:
>
> git cherry-pick <previous SHA1>
>
> If I understand correctly, cherry-pick will take the patch from <previous
> SHA1> and apply it to your current branch.  cherry-pick is designed to pull
> commits from branch to branch (just like picking cherries).  It will also
> commit those changes so your branch should be in exactly the same state as
> your master.
>
> Then you should be able to push to Gerrit.
>
> Also, don't worry about messing up your remote.  Unless people have cloned
> from it, they shouldn't be effected.  If we start re-writing history on
> "official" repos, then we might have problems and angry people.
>
> Cheers,
> -dan (b)
>
> P.S.  Notice I used a lot of "should"s.  I hope this works, I tried it out
> on a clone of my SimpleITK.
>
>
> On 9/20/10 1:11 AM, "Dan Mueller" <dan.muel at gmail.com> wrote:
>
>> Hi Dan (B), (others),
>>
>> I'm a total git newbie and struggling a bit to send my SimpleITK C#
>> wrapping changes to gerrit.
>>
>> I am following the steps you describe here:
>>     http://www.itk.org/Wiki/ITK/Gerrit/Primer
>>
>> Firstly I rebased two commits into a single commit:
>>     $ git rebase -i HEAD~2
>>     [detached HEAD 6f6a4df] Add initial support for C# wrapping
>>      13 files changed, 407 insertions(+), 20 deletions(-)
>>      create mode 100644 Examples/SimpleGaussian.cs
>>      create mode 100644 Wrapping/AssemblyInfo.cs.in
>>      create mode 100644 Wrapping/CSharpModules/FindCSharp.cmake
>>      create mode 100644 Wrapping/CSharpModules/FindDotNetFrameworkSdk.cmake
>>      create mode 100644 Wrapping/CSharpModules/FindMono.cmake
>>      create mode 100644 Wrapping/CSharpModules/UseCSharp.cmake
>>      create mode 100644 Wrapping/CSharpModules/UseDotNetFrameworkSdk.cmake
>>      create mode 100644 Wrapping/CSharpModules/UseMono.cmake
>>      create mode 100644 Wrapping/CSharpTypemapHelper.i
>>     Successfully rebased and updated refs/heads/master.
>>
>> Success. Then I tried to push to gerrit, but encountered my first
>> problem: I did not create a topic branch for this work, but committed
>> everything to the master of my github local repository. So the step:
>>     $ git push gerrit topic_branch_name:refs/for/master/remote_name
>> does not work because I don't have topic_branch_name.
>>
>> Instead I just tried to push "master" (though not sure if this is
>> right). Anyhow, I got the following error:
>>     $ git push gerrit master:refs/for/master/SimpleITKCSharpWrapping
>>     Counting objects: 159, done.
>>     Delta compression using up to 2 threads.
>>     Compressing objects: 100% (87/87), done.
>>     Writing objects: 100% (159/159), 234.51 KiB, done.
>>     Total 159 (delta 79), reused 134 (delta 70)
>>     To danmuel at review.source.kitware.com:ITK
>>      ! [remote rejected] master ->
>> refs/for/master/SimpleITKCSharpWrapping (no common ancestry)
>>     error: failed to push some refs to 'danmuel at review.source.kitware.com:ITK'
>>
>> I think my problem is that I need to add a remote to the SimpleITK
>> project (not the ITK project described in the primer), so I did this:
>>     $ git remote add gerritsimpleitk
>> danmuel at review.source.kitware.com:SimpleITK
>>
>> Questions: Is this correct? Will pushing my "master" work, or do I
>> need a topic branch? If I need a topic branch, how can I create one
>> when I have already committed the changes to the master?
>>
>> Next issue: as described above, I rebased two commits into one.
>> However, before I did the rebase, I had previously pushed those single
>> commits to my remote repository on github. I was reading here
>>    http://progit.org/book/ch3-6.html#the_perils_of_rebasing
>> that pushing again will cause people to hate me. I don't really want
>> people to hate me...
>>
>> Does that mean I should send two reviews to gerrit: one for each
>> pushed commit? (And revert the rebase to make sure I don't push it?).
>>
>> Sorry for all the newbie questions...
>>
>> Cheers, Dan
>>
>> On 16 September 2010 22:07, Daniel Blezek <Blezek.Daniel at mayo.edu> wrote:
>>> Hi Dan,
>>>
>>>  I just finished writing a primer for Gerrit / git.  It is based on ITK,
>>> but if you substitute SimpleITK, it should be identical.  The last step is
>>> also different, as I simply push to my Github repo any final changes.
>>>
>>> http://www.itk.org/Wiki/ITK/Gerrit/Primer
>>>
>>> Best,
>>> -dan
>>>
>>>
>>> On 9/15/10 1:10 AM, "Dan Mueller" <dan.muel at gmail.com> wrote:
>>>
>>>> Hi Dan (B),
>>>>
>>>>>  Would you mind pushing this to Gerrit?
>>>> Sure. Once you're ready, just point me to the wiki page describing the
>>>> process.
>>>>
>>>> Cheers, Dan (M)
>>>>
>>>> On 14 September 2010 22:23, Daniel Blezek <Blezek.Daniel at mayo.edu> wrote:
>>>>> Hi Dan,
>>>>>
>>>>>  Would you mind pushing this to Gerrit?  I have not yet had time to put
>>>>> together a primer on how to assemble a Gerrit push, so if you want to wait
>>>>> a
>>>>> bit I can get that together and you can test it the process.
>>>>>
>>>>> Thanks,
>>>>> -dan
>>>>>
>>>>>
>>>>> On 9/14/10 2:21 PM, "Dan Mueller" <dan.muel at gmail.com> wrote:
>>>>>
>>>>>> Hi all,
>>>>>>
>>>>>> For your reference: I've finally had the time to finish my first
>>>>>> attempt adding C# wrapping to SimpleITK:
>>>>>>
>>>>>> http://github.com/danmuel/SimpleITK/commit/a851b4c8f185f9c97b95739de8e39a4
>>>>>> c4
>>>>>> 2c
>>>>>> bca60
>>>>>>
>>>>>> I based the CMake modules on those in GDCM. The refactored CMake
>>>>>> modules may be useful for WrapITK. Currently only .NET on Windows is
>>>>>> supported; I still need to add support for Mono. Also, there is lots
>>>>>> more work required in the SWIG .i file, but at least it's a start...
>>>>>>
>>>>>> Cheers, Dan
>>>>>
>>>>> --
>>>>> Daniel Blezek, PhD


More information about the Insight-developers mailing list