Subject: * lisp/vc/vc-hg.el (vc-hg-root-log-format): New format supports graph, branches and bookmarks.

From: Santiago Payà i Miralta <[email-masked]>
Date: Sat, 17 May 2014 00:09:52 +0200

Hi emacs,

I wish to improve the vc-change-log buffer in vc-hg with the graph view. My
proposal is a change in default configuration. The vc-hg-root-log-format is
compatible with or without the graph view. Also added branches and
bookmarks.

2014-05-17 Santiago Payà i Miralta <[email-masked]>

        * lisp/vc/vc-hg.el (vc-hg-root-log-format): New format
 supports graph, branches and bookmarks.

>From a917e85f083907030daea6d1cf70ba524f5bbab9 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Santiago=20Pay=C3=A0=20i=20Miralta?= <[email-masked]>
Date: Fri, 16 May 2014 23:58:57 +0200
Subject: [PATCH] * lisp/vc/vc-hg.el (vc-hg-root-log-format): New format
 supports graph, branches and bookmarks.

Modern Mercurial log command supports --graph, also the graphlog extension
is widely used in ancient Mercurial. So with adding this default
configuration vc-hg users may see the graph DAG in the vc-change-log
buffer. Users have the choice to define vc-hg-log-switches as nil again,
the vc-hg-root-log-format is compatible with no graph switch.

Also added branches and bookmarks to the log format, with some different
but existing faces from add-log.
---
 lisp/vc/vc-hg.el | 19 +++++++++++--------
 1 file changed, 11 insertions(+), 8 deletions(-)

diff --git a/lisp/vc/vc-hg.el b/lisp/vc/vc-hg.el
index 05b53a3..649c736 100644
--- a/lisp/vc/vc-hg.el
+++ b/lisp/vc/vc-hg.el
@@ -146,12 +146,14 @@ If nil, use the value of `vc-diff-switches'.  If t,
use no switches."
   :group 'vc-hg)

 (defcustom vc-hg-root-log-format
-  '("{rev}:{tags}: {author|person} {date|shortdate} {desc|firstline}\\n"
-    "^\\([0-9]+\\):\\([^:]*\\): \\(.*?\\)[
\t]+\\([0-9]\\{4\\}-[0-9]\\{2\\}-[0-9]\\{2\\}\\)"
-    ((1 'log-view-message-face)
-     (2 'change-log-list)
-     (3 'change-log-name)
-     (4 'change-log-date)))
+  '("{rev}:{ifeq(branch, 'default','', '{branch}')}:{bookmarks}:{tags}:
{author|person} {date|shortdate} {desc|firstline}\\n"
+    "^\\(?:[+@o x|-]*\\)\\([0-9]+\\):\\([^:]*\\):\\([^:]*\\):\\([^:]*\\):
\\(.*?\\)[ \t]+\\([0-9]\\{4\\}-[0-9]\\{2\\}-[0-9]\\{2\\}\\)"
+((1 'log-view-message-face)
+     (2 'change-log-file)
+     (3 'change-log-list)
+     (4 'change-log-conditionals)
+     (5 'change-log-name)
+     (6 'change-log-date)))
   "Mercurial log template for `vc-hg-print-log' short format.
 This should be a list (TEMPLATE REGEXP KEYWORDS), where TEMPLATE
 is the \"--template\" argument string to pass to Mercurial,
@@ -238,8 +240,9 @@ highlighting the Log View buffer."

 ;;; History functions

-(defcustom vc-hg-log-switches nil
-  "String or list of strings specifying switches for hg log under VC."
+(defcustom vc-hg-log-switches (list "--graph")
+  "String or list of strings specifying switches for hg log under VC.
+Using --graph needs Mercurial 3.0+ or the graphlog extension."
   :type '(choice (const :tag "None" nil)
                  (string :tag "Argument String")
                  (repeat :tag "Argument List" :value ("") string))
-- 
2.0.0.rc0