Coding period: week #8

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.