Coding period: week #8
navaneethsuresh
Published: 07/21/2019
This is a blog post about unfortunately getting a bug in the feature I thought I had written properly and fixing that.
What did I do this week?
I have been working on adding an interactive mode to unshelve for a really long time. It was not easy like I had thought. My mentor reminded me that my code won't work for unshelve which can lead to conflicts. So, I had to modify a function called `shelvecontinue()` to work on interactive mode. unshelve with conflicts is aborted and user had to do `hg unshelve --continue` to continue the unshelve after conflict resolution. I had to modify the function `shelvecontinue()` and the main function `dounshelve()`. It took me enough time to modify both the functions and to get the tests running successfully. Later, the patch[1] got merged. But, then my mentor informed me that I had to mark this feature as `EXPERIMENTAL` as unshelve interactive logic completely lies on `_rebaserestorecommit()` which will do a graft. So, the user will get conflicts even if there are conflicts in the changes other than those requested by the user. I sent two[2][3] follow up patches for simple fixes and those got merged. But, now working on the main fix.
What is coming up next?
I am trying to modify `_rebaserestorecommit()` so that when there are conflicts, the user should only get conflicts when there are only conflicts in the changes which are requested by the user. This may take time.
Did you get stuck anywhere?
Yes. While trying to modify `_rebaserestorecommit()` function so that there should be conflicts only when there are conflicts on changes requested by the user, I couldn't get this to work. `cmdutil.dorecord()` cannot be called directly. Since we are already committing the changes as `shelvectx` and not doing anything, we need to rethink how to interactively select changes from a stored commit. Now, we are doing a graft and changes are there in the repo. So, `cmdutil.dorecord()` will work successfully. I haven't got a solution for this till now. Will work the next week on this.
View Blog Post
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