Mercurial GSoC 2013: happy ending

Giovanni Gherdovich g.gherdovich at gmail.com
Tue Oct 15 23:25:45 UTC 2013


Hi all,

three weeks ago the Google Summer of Code ended.
For mercurial, triumphantly!
All our three students (Alexander Plavin, Iulian Stana
and Sean Farley) has completed their projects successfully.

High five to everybody involved!

I had the privilege of living all of this from the "machine room",
being actively involved in Iulian's project, and I can tell
it has been a very rewarding experience and a lot of fun.

What follows is an overview of the projects' achievements.
I tried to be brief but, as usual, I failed.
Please feel free to comment and correct me if
what I write is not accurate.


= Alexander: hgweb on steroids =

You're on a train, and suddenly want to know what
version of python includes a bugfix you care about.
Your phone runs Android, and you haven't hg installed on it (yet).
What to do?

If CPython friends had equipped their hgweb with
Alexander's recent changes, you could run a search with
a revset expression[1] directly on hgweb, on your web browser.

[1] `hg help revset`

Alexander did an impressive make-up to our beloved hgweb;
here my list of favourites:

* Revset search on hgweb: the aforementioned. This is so much very good.
* Code selection: drag your mouse on some code source in hgweb,
  and not only you won't get line numbers into your selection,
  but also tabs and all blanks are preserved.
* Wrap lines in file source view: too long? it goes
  on the next line. No more need to navigate the page with
  an xbox joystick.
* Infinite scrolling of the changeset list. Enough said.

For a running instance of a bleeding edge hgweb,
see https://hg.plav.in/hg/
More details at http://blog.plav.in/tags/GSoC


= Iulian: C API for mercurial =

After Python and Java, now C has native mercurial bindings too,
equipped with the permissive MIT license.

Is this important? Yes sir: a rather large fraction of the Linux world
is still C/C++, and moreover the use of C opens the door
to all kinds of FFI madness towards other languages.

Of the three projects, this is the only one that
started out of an empty file (well, large inspiration
was taken from the Python and Java libraries, but still
C has its idioms and peculiarities).

The C API is factored in two layers:

* raw level: nuts and bolts,
    open/close connection with the underlying hg instance,
    send command / read result
* command level: a C function for each mercurial command.

The official repository lives here at Bitbucket:
https://bitbucket.org/mpmselenic/c-hglib

but not all of Iulian's work has landed yet; there is still
a gigantic series of ~50 csets to digest (all command level basically)
http://markmail.org/thread/vrq243asw6tdep3c

Given determination, focus and time a third level of abstraction
could be achieved: "object" level, i.e. emulating important Mercurial
internal APIs like contexts with a native C paradigm.


= Sean: refactoring of context.py =

Sean's project was to improve the commit record interface;
(never heard of the Record extension? go check it out! [2])
basically, select parts of existing changes with hunk or greater granularity.
(what's a hunk: go read [3]).

[2] http://mercurial.selenic.com/wiki/RecordExtension
[3] http://hgbook.red-bean.com/read/managing-change-with-mercurial-queues.html#sec:mq:patch

In case you're wandering why does this deserve your attention,
well, it will enable tight and powerful integration with external tools
like text editors, think of something as slick as magit and better than monky.

During the three months of GSoC, Sean completely refactored
context.py in a way that will also enable another important
milestone in the near future of mercurial: in-memory merges.

If you had any familiarity with the file context.py,
you might want to see what it is now -- you'll see that
quite a lot of things have changed.
Key commits are the introduction of the basectx[4] and
basefilectx[5] classes.

[4] http://selenic.com/hg/rev/6e3e8575276d
[5] http://selenic.com/hg/rev/c19f46b904b9

The original project is ambitious,
and what we've seen is promising.


Cheers,
GGhh



More information about the Mercurial mailing list