navaneethsuresh's Blog

Coding period: week #7

navaneethsuresh
Published: 07/12/2019

This is a blog post about how I finished adding a new feature I have been working for the last two weeks.

 

What did I do this week?

I had sent this[1] patch last week and I finally got succeeded on adding an interactive mode to unshelve. There is already an interactive mode in shelve. The first step I took was to make unshelve selected files only. I had almost completed this in the last week itself. Unfortunately, I got sick this week. So, I wasn't able to work for more hours. However, I managed to finish my work this week. I had to create two changesets. One with changes requested by the user to unshelve at the given time and the latter is shelved for later. The first is done interactively by the user. They can select changes chunk by chunk. This received good reviews from the community.

 

What is coming up next?

My old patch on my project which does a lot of things is inactive for a while. I shall ask people to review that. Also, my mentor is actively giving new things outside the project sample space which the community has an interest. I shall try to work more on them. Since my college is opening this Monday, I will be concentrating to work on that within a short period of time.

 

Did you get stuck anywhere?

I thought we have to manually code everything in the interactive mode. I spent quite a lot of time investigating and try to code up that from scratch. Later, @av6 advised me to look at shelve interactive and it was much easier to implement. I learnt that quite often we need to think clearly rather than deeply. An interesting thing about a large codebase is that it might be hard to look up but, almost all of the things are implemented in it. We often have samples to look for motivation.

View Blog Post

Coding period: week #6

navaneethsuresh
Published: 07/06/2019

This is a blog post about how I sent a patch to a new feature and fixed old patches of mine by sending follow-ups this week.

 

What did I do this week?

I sent a patch[1] to make `hg unshelve` accept files. It added a `--files` flag to perform unshelve on selected files. My end-goal is to add interactive mode to the command. This interactive mode should work the same as it works for `revert`, et al. It also has to support curses ui. I borrowed a function from `uncommit` extension called `_commitfiltered()`. This will generate another commit changeset with selected files only. I had to modify it a little. The original funcition was written to exclude files. I modified it to include the selected files. I sent another patch[2] as a follow-up to rename a function after shelve landed on core. I also had to rebase changes from this[3] patch on the top of the commit which made land shelve on core. This led to enormous conflicts and I had to resolve that.

 

What is coming up next?

This[4] patch is trying to add interactive mode to `unshelve` as an end-goal. Hopefully, I will complete this by next week. If time permits, I will also work on things on the project sample space.

 

Did you get stuck anywhere?

On adding a `--files` flag to `unshelve` it wasn't recognising the files selected. I spent quite a long time on this. Finally, I realized that I had to change one of the arguments in the function definition to a list. It was a string by default. 

View Blog Post

Coding period: week #5

navaneethsuresh
Published: 06/29/2019

This is a blog post about how I spent this week addressing reviews and started working on an interesting feature outside the sample space of the project.

 

What did I do this week?

I started getting reviews on a patch[1] that I had sent last week. I had to rebase my changes on the top of the tip of the default branch. I got enormous conflicts because, my project interfered with another GSoC project within my org. So, I solved the conflicts and ran tests. There were still some issues. I fixed those and amended the changes. I also sent a patch[2] to make shelve independent of rebase and it got merged. Then, I started working on adding interactive mode to unshelve which can make selected files unshelve from the stored shelve. Here[3] is the feature request of it.

 

What is coming up next?

I just started working on adding interactive mode to unshelve. I hope to complete this by next week. If time permits, I'll work on adding `--unresolved` flag to `hg commit` and test exchanging shelves. However, plans can get changed.

 

Did you get stuck anywhere?

When I was told to rebase my changes on top of tip of default, I got enormous conflicts. It wasn't easy for me to solve them. But, I started small and made progress. Some part of the rebase caused bugs. So, I made the changes on top of the rebase and amended those changes. Thus, all tests started running successfully.

View Blog Post

Coding period: week #4

navaneethsuresh
Published: 06/21/2019

I had already done the things planned in this week last week itself. This is going to be a blog post about how I still utilized this time to do things which was worth investing time.

 

What did I do this week?

I was waiting for reviews for the first few days. I was contacting my mentor consistently and he told me that he'll pick something for me to work on from the sample space outside the project idea. We also had a video chat in which he told me things regarding my project which I can work on near future. As promised, he gave me a list of things to work on from which I can select whatever I like to work on. Here are those things:

  • Moving shelve extension to core.
  • Moving show extension to core.
  • Improvements around bookmarks.
  • Functionality to exchange shelves.

All of them were interesting to me. So, I decided to work on everything starting from the first one. It was relatively easy. All I had to do was to make sure that all tests are running successfully after moving shelve code from `hgext/shelve.py` to `mercurial/commands.py`. I sent a patch to phabricator regarding that. It can be found here[1].

 

What is coming up next?

Things coming up next week will mainly depend upon the reviews of my this week's patch. If there is time, I plan to extend the functionality of storing unresolved mergestate to multistep commands like `rebase`, `histedit`, etc.

 

Did you get stuck anywhere?

Some of the tests were failing when I moved shelve to core. One of the interesting ones was `test-check-module-imports.t`. I realized that I was importing `rebase` extension for `shelve` in `commands.py` and this `rebase` was itself depend on `commands`. This resulted in an import cycle. Technically, `shelve` will work. But, this `test-check-module-imports.t` will fail as it's not a good programming practice. I fixed this by only importing `rebase` whenever necessary inside the helper functions which shelve was depend upon. Other test fixes were relatively simple.

View Blog Post

Coding period: week #3

navaneethsuresh
Published: 06/15/2019

This is a blog post about how I spent this week addressing the reviews of last week PRs and added a new storage method for the existing functionality.

 

What did I do this week?

I got more reviews on the two PRs that I had sent last week. I worked first three days solving those nit-picks in the reviews. Then, my mentor advised me to fold those two patches into one and update the description. I did that. Also, the very first PR that I sent on the very first day of coding period got merged but, broken two tests. I sent another patch to fix those broken tests and it got merged. Then, I worked on adding a storage method for the mergestate information in changeset extras. Until then, the usual mergestate information was just moved from `$HGRCPATH/merge` to `$HGRCPATH/merge-unresolved`. I had to write two functions in which one is an encoder and other is a decoder to store the list of merge records in extra mapping as it only parses strings. I haven't sent a new patch for this functionality. Instead, I amended it on top of the old patch as my mentor suggested. All work that I did was included here[1]. If you are interested in my work of this week only, then refer to this[2] changeset on my bitbucket hg clone. I also added an experimental config option to make sure that we have all tests running successfully for both storage methods at the same time successfully.

 

What is coming up next?

Now, I have also written storage in changeset level with the help of extra mapping. But, haven't received much reviews. The upcoming work will mostly based on reviews. However, this is a minimal implementation. I have used a storage format of mergestate which works for hg versions 3.7 and above. Also, I have omitted the storage of local version content of conflicted files. I'll try to explore more corner cases and work on that. I'll think upon transmitting these conflicted changesets across repositories.

 

Did you get stuck anywhere?

When storing mergestate records in changeset extras, I couldn't parse the information correctly. This was due to the absence of an encoder and a decoder. These mergestate records are a list of tuples. Since we can only read/write strings in extra, we needed to encode. I came to know this from my mentor and did code that functionality right away then. Also, two of my tests of my first merged patch were failing. I fixed that with the help of my mentor and another member.

View Blog Post