 My name is Jordy. I'm going to show you something about Mercurial ref sets. It's a feature of Mercurial that I think is kind of cool and doesn't get as much exposure as it should. So I actually work with Octave. So I'm going to show you these things on the Octave repository where we use Mercurial. But I know that Octave is not as popular as NumPy and pandas around here. But I also like Python, so OK. So this is the Octave repo. Right now, this MTLpy just happens to be the active bookmark that I have here. Let's take a look around this repo. As you can see, we are very GNU. GNU. We have here like GNU, GNU, GNUlib. And we have usual GNU stuff. Right now, I am standing on this revision. Parent of my working directory is 173095. I have an active bookmark MTLpy right here. OK. And my log right now graphically looks like this. I have three revisions that I've made here. The top one has the MTLpy bookmark. This little at here at top that you see, that's where I'm standing right now. And below me, there's another bookmark, the at bookmark. This is a special bookmark that indicates where upstream is right now. So I'm actually ahead of upstream by three commits. These three commits that are there. OK. So there are many ways, and I just want to show you one more thing. This bookmark here, I have three bookmarks. There's a ky bookmark that I haven't used, the at bookmark, and the MTLpy bookmark. OK. So there are many ways to refer to a revision in Mercurial. One is by bookmark. So this is going to give me this one right here. Another way is by its revision number, which is, oops. Sorry. It is this thing right here. The first part is that a revision number. I can just refer to this by the revision number. It gives me the same thing. Or I can refer to it by its hash, same thing. Or even by its tag. It's got a tag there called tip. I can refer to it by that way as well. However, there are more advanced ways to refer to revisions. And there's various reasons to use each one of them. You can also use negative revision numbers, which is comfortable. You can go from the back. So this is the one on top. Negative one is just like indexing in Python. You can index backwards. Same one. If I index with minus 2, I will get, instead of 17395, I get 17394 when I index by minus 2. Now, this in itself is not really a revision, a rev set. You can do more advanced things where you can do ranges like that. Or the dot refers to the current revision. The tilde refers to one before that. The caret hat refers to also the parent. Now, I know what you're thinking. This looks a lot like the git revisions. And if you look at the git revisions, there is a bunch of things here. I can never find my way through these man pages of git. But there's a tilde there, for example, that looks similar. So there is a little bit of inspiration, but it's not really different. Rev sets have a whole language. It's really a functional language for selecting a set of revisions. And it has predicates. So it's a lot more rich than just git revisions. So for example, the last one, the one with a hat, can be done with a P1. Those brackets indicate it's a function of the functional language. Now, we can also find the descendants of the app, which would be the three commits that I had at the beginning. Oh, but something's wrong here. It's also including the at itself. Well, I don't want that one. I want the descendants, but not the at itself. And it gives me those, just those three without the at. And I can find the minimum of those. And it gives me just one, which is the first one. I can also give them in reverse order. Gives me that. So this looks like I've been doing this one, and not that a bunch of times, so I can alias it. So let's alias it. It's right here. I'm going to alias it to be called just children. And wherever I can put a revision, I can also put a ref set like this one. So I can just edit those three that are there. I'm not actually going to do any history thing right now. So I just left the plan as it was. So here is another example of a revision set, ref set. I can tell by section to work on all files except those that are touching this one. So skip all the revisions that are not touching this revision, which means just bisect on this file. For some reason, I know by section, only go past this file, I can do it like this. And it's actually marking it right now. I'll take a little while. Okay. Now I want to show you another example of a ref set, this time on the Mercurial repo itself. Now this is a pretty complicated ref set. What it's doing, let me show you it by itself. What this ref set is doing is looking at all the revisions that are touching this file, the hist edit, and have a tag and are the first one, which means so have a tag here and are the first one. So what this tells me actually is on which revision, sorry, on which release, on which tag release did I first have this file, which happens to be in this one. It happens to be on version 2.3 is when we first have the hist edit extension in core. So now I actually want to show you how to write a ref set. So a revision, a Python is, I mean, Mercurial is just a Python library. So writing a revision, a ref set is very simple. Here I am actually writing the LOL ref set. The LOL ref set will select changes that are loasy. It's very simple. You just do, you call the ref set function from Mercurial, you update it in your symbols, and you import it, which means you just mark it as an extension here. And I'm gonna go back to my octave repo and I'm gonna see what the loasy numbers are from that ref set that I just wrote. It takes a little while because loasy numbers are difficult to compute. They happen to be two, three, five, seven, 11, 13, 17. You guys recognize these numbers? So I wrote a ref set to actually get the prime numbers. And I wanna see which one of my revisions have prime numbers. So these do. Oops, I shouldn't have done that. I'm done.