Pijul 0.10

Saturday, April 21, 2018

I’m pleased to announce the new release of Pijul, version 0.10. This release has been a long time coming, but brings in an important number of new features and stability enhancements.

Stabilisation of the new patch format

Pijul 0.9 introduced a breaking change in the patch format. Even though the representation of data on disk did not change much, the representation of certain kinds of conflict resolutions changed, in a way that wasn’t easy to convert automatically (we have a converter though, which will be released soon).

We put a big effort in stabilising this format for Pijul 0.10, by extending our test suite with the help of kcov (we’re over 90% of test coverage at the time of writing this post).

Implementation of the entire theory: welcome rollback

By simplifying the algorithm and the representation of patches, that change in patch format allowed us to go ahead and get a clearer understanding of what it would take to finish implementing the full set of operations we wanted. The missing bit was rollback, which allows one to create a patch that “does” the opposite of another patch, as far as the working copy is concerned.

The convoluted formulation of the previous sentence is due to the fact that the main datastructure in Pijul is append-only (the implementation is append-only too, even though it mutates stuff for performance reasons), so nothing is really reversible.

However, in all cases, a repository containing a patch p and another patch q created with pijul rollback p, will have the exact same working copy (including conflicts), as a repository containing neither p nor q. (This is modulo possible remaining bugs).

Better SSH support

Pijul 0.10 improves the support of different SSH key formats, and support for agents. I’d like to thank all the Pijul enthusiasts who have generated and sent SSH keys using many different kinds of obsolete crypto algorithms and encodings.

One remaining challenge is SSH agents on Windows. Thrussh-keys implements an agent (client and server), but it currently only works on Unix, due to the use of Unix sockets.

VT100 line editing

The previous versions of Pijul used different line editing crates, which were more or less abandonned by their owners in the last six months. These crates caused the input line to blink in the terminal anyway, for some reason.

Just before releasing Pijul 0.10 this week, I read some VT100 documentation, and decided to write my own library to solve this. It is certainly not the most complete things, but it at least compiles and works at least on Windows, Linux and FreeBSD, handles arrow keys, deletes and backspaces without blinking.

Image of a VT100 Terminal by Jason Scott

A VT100 Terminal

Image of a VT100 Terminal by Jason Scott

Also, I’ve started to know and love the VT100, a very cool machine released in 1978, on which most terminal emulators we have today are based.

The road ahead

Aside from more testing, there are still a few things we’d like to have before announcing our first 1.0 version.

  • More robust command-line IO, not all things work correctly with Unix pipes (for instance). My line crate is probably a bit young, and would need more polishing and more features. Contributions welcome!

  • Partial repository checkouts. This is one the coolest features of Pijul, which will hopefully allow it to scale to much bigger repositories than others.

  • Faster and more general diff. The diff currently implemented is a naive one, in O(n^2), and this is slow. We’d love to implement Myers Diff. Since the things added to a Pijul patch for each line addition or deletion are not obvious, we’d like a more generic interface to this, so that diff algorithms could be written in a more standard way.

Get involved!

There are many good first tasks to get acquainted with the Pijul project. Some, mentionned in this post, are almost independent from the main project:

  • Implement SSH agents on Windows.
  • Improve line, maybe using the new cool VT100 feature of Windows 10.
  • Review Thrussh, and help us get it to the highest standards of security, speed and ease of use. This is currently blocked on us converting the repository on the Nest to the last patch format, which will be done very soon.
  • Add Serde support to Sanakirja.

Others are related to the command-line, and don’t touch the theory very much:

  • Help us implement a more consistent CLI, see the ongoing discussion about this.
  • Once we have a trait for diffs, implement different diff algorithms. They’re among the most fun things to write.