Kiln 2.0 brings a new feature for understanding and exploring your code’s history. We call it the Electric DAG.

Mercurial is called a “DAG-based DVCS” because the relationship of each changeset with its parents (the changeset that it is based on) forms a directed acyclic graph. A mathematical understanding of this isn’t necessary to use Kiln, of course, but the DAG nature of your repository’s history exposes some interesting facts.

You can find the DAG view of your repository by clicking “History” at the top of any repository. You’ll see your complete repository history, with the tip at the top. Each changeset is connected to its parent (or parents, for merges) by a colored line. By following these lines, you can trace a changeset’s ancestry down the page, all the way back to the beginning of your repository. You can also trace a changeset’s line up the DAG, to find what other changesets include those changes.

Of course, tracing lines on a screen isn’t the easiest way to track your code’s history. This is where the Electric DAG comes in. Click the background of any changeset in that list, and—zap!—the ancestors and descendants of that changeset are highlighted. Changesets that aren’t related, that is, which aren’t an ancestor of the selected changeset and don’t descend from the selected changeset, are shown in gray. Only the bright changesets are related to the selected one.

The Electric DAG can reveal what changes are included in a tagged changeset, such as a specific build version. Select the tagged changeset, and look at the highlighted changes below it:

All the highlighted changesets were included in Version 1.7. Any gray changesets aren’t ancestors of the changeset tagged Version-1.7. For example, Patrick’s change with the message “sort diffbookmarks() output” is included in the new version, but David’s fix to “remove unused variable” isn’t.

The electric DAG can also tell you what tagged changeset a given changeset is included in. For instance, let’s select David’s “remove unused variable” changeset, which we saw didn’t make it into Version 1.7:

Now looking at the descendants of that changeset (which are above it on the DAG), we see that the first tagged changesets that’s highlighted is Version-1.7.1. So David’s fix will be included in that release—go ahead and tell that frantic customer that his fix is on the way (I’ll wait here). As you expect, the Version-1.7 changeset is gray, because David’s changeset wasn’t included in that release.

The electric DAG has one more trick up its glowing blue sleeve. First, click any changeset to electrify it. Then, hold the Control (ctrl) key on your keyboard and click another changeset. Here, I’ve clicked the changesets tagged Version-1.7.1 and Version-1.7:

What’s going on here? Kiln has highlighted all the changesets that are different between the ancestries of the two tags. In other words, every highlighted changeset is included in version 1.7.1 but not in version 1.7. The changeset we were just looking at, “remove unused variable”, is highlighted, because it made the 1.7.1 release but not the 1.7 release. All the other highlighted changesets are in the same situation: ready to go for the next release.

Think how easy it would be to write release notes for 1.7.1, or for QA to know just which bugs have been fixed between releases. Wonder no more about when a vital fix was merged into the main repository, or when a customer will be able to use a new feature. Kiln’s Electric DAG leverages the power of Mercurial to delve deep into your repository’s history, so you can know your code.