Week 1

“Here goes nothing”, I said to myself as I began the coding phase of GSoC 2019, unsure of what lay in store for me for the next 3 months. That’s not entirely true as I had already submitted my proposal ,so I was sure what I would be working on. The only question that remained was when I where to begin. I decided to start off with a simple issue, one that did not require coding as such, but rather a good understanding of Git and its features, namely merge and cherry pick.

The issue was that a GitHub Sugar repository had multiple histories in different places, and there was no one upstream repository from which other developers couls fork it from. The challenge was to merge the histories, but this would not be a simple merge, as the timeline had to be right. I tried the feature of cherry-picking, which is essentially applying a common patch across repositories (here, a patch is essentially a commit or set of commits). This is useful if the repositories had a common bug that had to be resolved. I could use another developer’s work instead of fixing it myself.

However, the user needs to be careful in deciding which commits to cherry-pick and which to ignore. Often is the case when cherry-picking is not requried at all, rather a simple merge operation would be sufficient. I found this YouTube tutorial, which really helped me understand, by the channel “Dab Gitschooldude”, whose link I have attached at the bottom. I highly recommend watching his set of tutorials to understand git better. Anyways, even after cherry-picking my mentor pointed out that the releases had to be accounted for in GitHub, and Git provides a very convinient way of making releases. This is done in the form of tagging, a specialised feature of Git. It works similar to a commit, it serves as a way to tell that a release was made at this point of time.

In my case, I had to add the annotated tags as well, to the repository I was merging with, which at that point I was not aware of. My mentor pointed out the way and I was able to merge it correctly.

The other activity I began to work on was Countries-activity. There were two issues that required attention. One was how double-click while the activity was running, resulted in a triple execution and the letter was being displayed thrice. The fix was interesting as it was based on how PyGame worked so I got to learn something new. PyGame is a wrapper for SDL (Simple DirectMedia Layer). SDL added a field to the mouse button down event for number of clicks, and began to detect double click events. But PyGame is not, as of 1.9.1, handling the clicks value, and is not passing it on to the application.

The solution was to replicate how GTK worked, i.e arming the buttons with MOUSEBUTTONDOWN, and activating the buttons with MOUSEBUTTONUP. So I did this by saving the last MOUSEBUTTONDOWN event and using that to determine when the MOUSEBUTTONUP event was triggered, whether the proximity of the events were within the threshold. After that, the issue was fixed. PyGame never kept track of double clicks, and hence a double click was being treated as a single click followed by a double click, which resulted in the letter being displayed thrice.

Links to PR Countries-activity PR: #11 Bichos-activity I: #9

Link to the YouTube video: Git Cherry-picking tutorial

Written on August 26, 2019