Ventures of an ex indie game developer

Homebrew FTP server

I had yet another shortage of internetz in the last few weeks, the ISP fucked up, which resulted in me having to reinvent the 3-way merge wheel instead of just using something complete and tested. The algorithm was a lot more complicated than I had anticipated and I had to rewrite it once to get it working. The final version is 126 lines of Python and works for most corner cases.

I also thought I would be making some type of 2-way merge. Anybody who has ever thought about these things quickly realize that there is no such thing. During merge/synchronization I need to keep three versions of the file: base, mine and theirs. Pretty much the same was as any versioning system I guess.

On the device side I need some type of FTP server. I don't want actual FTP, I just need to list files and transfer contents. Those things are just too easy in Python, so I built a prototype in 36 lines of server code and as many minutes. The client will probably run in Python (started from the computer IDE), but when done I'll just re-implement the server code in C++ for the iOS device.

I've tried to come up with good ways to:
  • synchronize sources without losing time, and
  • handle merge conflicts
but failed in both respects. I don't want to wait for complete "repository" synchronization to complete before running the application, but on the other hand I don't want to risk not having the source on the device when you run off with your cell. My solution is to use two key bindings: F6 = run + synchronize in background; F7 = synchronize + run.

Regarding the conflicts I'll simply synchronize them to the device, and if they're resolved on either end the next synchronization will remove the conflict. I suppose the corresponding thing in git would be to actually check in the conflicts, but since it really simplifies usability I'm content with that.

The components and overall architecture is pretty broad and interesting to build. Soon the basics are done and Trabant goes to beta.

Editor + versioning + merging + "FTP" + remote exec + Python + API
=
Great multi-platform prototyping IDE!

About the author

Mitt foto
Gothenburg, Sweden