Friday, May 30, 2014

hg log --graph --template

Some differences in the --graph behaviour with modified code. Let's see the Mercurial code:

$ clone http://selenic.com/hg
$ cd hg

First with the default log command:

$ hg log --graph --template='{rev}' -r 19655:19645
o  19655
|
o    19654
|\
| o    19653
| |\
| | o  19652
| | |
| | o  19651
| | |
| | o  19650
| | |
o | |  19649
|\| |
o | |  19648
| | |
o | |  19647
| | |
o | |  19646
| | |
| o |  19645
|/|/

Nice. A little stretched. Now with one CR/LF '\n':

$ hg log --graph --template='{rev}\n' -r 19655:19645
o  19655
|
o    19654
|\
| o    19653
| |\
| | o  19652
| | |
| | o  19651
| | |
| | o  19650
| | |
o | |  19649
|\| |
o | |  19648
| | |
o | |  19647
| | |
o | |  19646
| | |
| o |  19645
|/|/

Equal. More CR/LF:

$ hg log --graph --template='{rev}\n\n' -r 19655:19645
o  19655
|
o    19654
|\
| o    19653
| |\
| | o  19652
| | |
| | o  19651
| | |
| | o  19650
| | |
o | |  19649
|\| |
o | |  19648
| | |
o | |  19647
| | |
o | |  19646
| | |
| o |  19645
|/|/

Ups! Equal again. And last:

$ hg log --graph --template='{rev}\n\n\n' -r 19655:19645
o  19655
|
|
o    19654
|\
| |
| o    19653
| |\
| | |
| | o  19652
| | |
| | |
| | o  19651
| | |
| | |
| | o  19650
| | |
| | |
o | |  19649
|\| |
| | |
o | |  19648
| | |
| | |
o | |  19647
| | |
| | |
o | |  19646
| | |
| | |
| o |  19645
|/|/
| |

Ok.

Second with the modified command:

$ ./hg log --graph --template='{rev}' -r 19655:19645
o  19655
o    19654
|\
| o    19653
| |\
| | o  19652
| | o  19651
| | o  19650
o | |  19649
|\| |
o | |  19648
o | |  19647
o | |  19646
| o |  19645
|/|/

Nice. Adjusted.

$ ./hg log --graph --template='{rev}\n' -r 19655:19645
o  19655
o    19654
|\
| o    19653
| |\
| | o  19652
| | o  19651
| | o  19650
o | |  19649
|\| |
o | |  19648
o | |  19647
o | |  19646
| o |  19645
|/|/

Ok, as '\n' is there.

$ ./hg log --graph --template='{rev}\n\n' -r 19655:19645
o  19655
|
o    19654
|\
| o    19653
| |\
| | o  19652
| | |
| | o  19651
| | |
| | o  19650
| | |
o | |  19649
|\| |
o | |  19648
| | |
o | |  19647
| | |
o | |  19646
| | |
| o |  19645
|/|/

Better.

$ ./hg log --graph --template='{rev}\n\n\n' -r 19655:19645
o  19655
|
|
o    19654
|\
| |
| o    19653
| |\
| | |
| | o  19652
| | |
| | |
| | o  19651
| | |
| | |
| | o  19650
| | |
| | |
o | |  19649
|\| |
| | |
o | |  19648
| | |
| | |
o | |  19647
| | |
| | |
o | |  19646
| | |
| | |
| o |  19645
|/|/
| |

As expected.

That's all.

Thursday, May 29, 2014

vc-hg.el

Sometimes I use GNU/Emacs.

Last time because I need to connect to a GNU/Debian box remotely and code there, from Windoze (Putty and so, no X). Sometimes I use Mercurial. That code is in a Mercurial repository so I need Emacs to manage it. But the default vc-hg.el requires some improvements.

So started coding.





















Going to the git clone of Emacs code can see the log with C-x v d and l:





















Nice.
Going to the hg clone of Mercurial code and doing the same:





















Ups! No --graph log ... Mercurial 2.3 admits the this option in core. Let's improve:

Modifying Emacs with this entry:





















Modifying Mercurial with this entry:





















And that's all !!

By the way, where does emacs hides the merge changesets ??

$ ./hg log --graph --template='{rev} {desc|firstline}'