-
`hg view` and meld
-
Sometimes I need to review a series of changesets in Mercurial. Like when I pull from Diego’s or Christos’ branch, and they had committed a couple of things in a row. I’d like to graphically review these changesets along with the whole code’s context.
hg viewis a nice visual tool (albeit in tk without a Refresh functionality), but it only shows the diff, the context is not there. What I’d like to see is the diff along with the whole file to get a better picture of the architecture and the classes, to judge whether what I see makes sense. Does moving this method outside of the class make sense with the rest of the classes in the module?meldis a very nice visual tool, but it only shows one revision. I need to review 7 of them.
Until meld supports long-awaited changeset browsing, what I came up with is this:
for i in $(seq 97 105); do hg extdiff -r $i^:$i -p meld; done
It requires enabling hg’s extensions
parentrevspecandextdiff.Better solutions welcome!
1 σχόλιο »
Comment!
- ← On being right
- 70s mood →
- ↑ Return

It’s trivial to add an option to “hg export” that includes more context lines. The code to pass-through all the diff specific options is already there, so all you have to do is to modify “mercurial/commands.py” a bit, to allow the extra options of the diffopts[] vector in “hg export”.
I have just patched my crew-based snapshot of Mercurial and pushed a patch that does precisely this at:
http://hg.hellug.gr/mercurial/gker/rev/8dfab511e9b2
Don’t pull *all* the changes from that branch, because I have some local changes that affect “hg manifest” output and other bits that are probably a bit unsafe for general consumption.
Changeset 8dfab511e9b2 should be moderately “safe” though.
With this patch installed, it should be easy to review the full file by specifying a context size that is large enough, i.e.:
$ hg export -U100000 97:105 | lessIf you still like seeing the changes in meld, I’m sure there is some way to feed patches with much larger context to meld, kdiff or some other patch viewer.
I’ll try to add an option to the web interface too, so that one can “hg serve -p 9000″, fire up a browser, and be able to “expand” a file in the changeset viewer. This may be nice to push upstream too :D