Proposing compact graph log

Santiago Payà i Miralta santiagopim at gmail.com
Sun Jun 1 15:58:24 CDT 2014


Hello,

I would ask for a review of the --graph log option. When using --graph with
a --template the resulting DAG chain always shows the changesets connected
by a row of vertical edges '|', regardless of using '\n' or not in the
--template parameter:

$ hg log -G --template={rev} -l 3
@  21644
|
o  21643
|
o  21642
|

And what is proposed is:

$ hg log -G --template={rev} -l 3
@  21644
o  21643
o  21642

You can see my point of view detailed in this blog [1].

There are some problems with this change:

* Breaks some (57) tests :(
* Could depend from an option to the log command, some as --compact or
similar, in this way the previous behavior would not be broken.
* Works filtering the resulting graph, may be should work in the graph
generation (?). About the code be aware that, in my opinion, the comment in
line graphmod:327[2] is not true, the `shift_interline' list contains all
non-vertical _and_ vertical edges.

Well, this is just a proposal that if deemed correct should be developed.
Was it discussed at some point when the graphlog extension ?

Best regards,

Santiago

[1] http://print--hello--world.blogspot.com.es/2014_05_01_archive.html
[2] http://selenic.com/hg/file/9c35f3a8cac4/mercurial/graphmod.py#l327

- - - -

diff -r 76a347bcdb33 -r 9c5a8e65386a mercurial/graphmod.py
--- a/mercurial/graphmod.py Thu May 29 16:01:39 2014 -0700
+++ b/mercurial/graphmod.py Fri May 30 22:09:31 2014 +0200
@@ -346,7 +346,14 @@
     lines = [nodeline]
     if add_padding_line:
         lines.append(_getpaddingline(idx, ncols, edges))
-    lines.append(shift_interline)
+
+    # do not add shift_interline if are all vertical edges '|'
+    add_shift_interline = False
+    for token in shift_interline:
+        if token not in ['|', ' ']:
+            add_shift_interline = True
+    if add_shift_interline:
+        lines.append(shift_interline)

     # make sure that there are as many graph lines as there are
     # log strings
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://selenic.com/pipermail/mercurial-devel/attachments/20140601/2d272ed1/attachment.html>


More information about the Mercurial-devel mailing list