GNU bug report logs - #17515
* lisp/vc/vc-hg.el (vc-hg-root-log-format): New format supports graph, branches and bookmarks.

Previous Next

Package: emacs;

Reported by: Santiago Payà i Miralta <santiagopim <at> gmail.com>

Date: Fri, 16 May 2014 22:11:02 UTC

Severity: wishlist

Tags: patch

Done: Stefan Monnier <monnier <at> iro.umontreal.ca>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 17515 in the body.
You can then email your comments to 17515 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#17515; Package emacs. (Fri, 16 May 2014 22:11:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Santiago Payà i Miralta <santiagopim <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Fri, 16 May 2014 22:11:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Santiago Payà i Miralta <santiagopim <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: * lisp/vc/vc-hg.el (vc-hg-root-log-format): New format supports
 graph, branches and bookmarks.
Date: Sat, 17 May 2014 00:09:52 +0200
[Message part 1 (text/plain, inline)]
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 <santiagopim <at> gmail.com>

        * 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?= <santiagopim <at> gmail.com>
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
[Message part 2 (text/html, inline)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#17515; Package emacs. (Sun, 18 May 2014 23:24:01 GMT) Full text and rfc822 format available.

Message #8 received at 17515 <at> debbugs.gnu.org (full text, mbox):

From: Santiago Payà i Miralta <santiagopim <at> gmail.com>
To: 17515 <at> debbugs.gnu.org
Subject: Correction: using log-switch causes normal non shortlog use fail
 format
Date: Mon, 19 May 2014 01:23:00 +0200
[Message part 1 (text/plain, inline)]
Hi emacs,

There is a fail in my previous patch. Using '--graph' in the
vc-hg-log-switches causes the normal non SHORTLOG log print to use it, and
the resulting long log is as broken. Please use this patch corrected where
the '--graph' option is into the shortlog condition in vc-hg-print-log.

Apologies.

From 72963f6dc7d754e525d5df7e4d2a4d0b8896d814 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Santiago=20Pay=C3=A0=20i=20Miralta?= <santiagopim <at> gmail.com>
Date: Mon, 19 May 2014 01:20:14 +0200
Subject: [PATCH 2/2] [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
when using SHORTLOG in vc-hg-print-log function. The vc-hg-root-log-format
is compatible with or without the graph view.

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

diff --git a/lisp/vc/vc-hg.el b/lisp/vc/vc-hg.el
index 05b53a3..3323628 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,
@@ -264,7 +266,7 @@ If LIMIT is non-nil, show no more than this many
entries."
      (nconc
       (when start-revision (list (format "-r%s:0" start-revision)))
       (when limit (list "-l" (format "%s" limit)))
-      (when shortlog (list "--template" (car vc-hg-root-log-format)))
+      (when shortlog (list "--graph" "--template" (car
vc-hg-root-log-format)))
       vc-hg-log-switches)))))

 (defvar log-view-message-re)
-- 
1.7.9.5
[Message part 2 (text/html, inline)]

Reply sent to Stefan Monnier <monnier <at> iro.umontreal.ca>:
You have taken responsibility. (Fri, 06 Jun 2014 16:13:02 GMT) Full text and rfc822 format available.

Notification sent to Santiago Payà i Miralta <santiagopim <at> gmail.com>:
bug acknowledged by developer. (Fri, 06 Jun 2014 16:13:03 GMT) Full text and rfc822 format available.

Message #13 received at 17515-done <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Santiago Payà i Miralta <santiagopim <at> gmail.com>
Cc: 17515-done <at> debbugs.gnu.org
Subject: Re: bug#17515: Correction: using log-switch causes normal non
 shortlog use fail format
Date: Fri, 06 Jun 2014 12:12:09 -0400
OK, I see your papers are in.  Now that I'm looking at your patch,
I have one more comment.  The previous version of your patch said:

   Using --graph needs Mercurial 3.0+ or the graphlog extension.

Yet my Debian install is still at 2.9.2, so using --graph by default
seems risky.  Is there a way to test whether "hg" supports "--graph"?

Oh, and your patch was mangled.  Try to use a MUA that doesn't wrap
lines for you.

I installed the tweaked patch below, which avoids going over
80-columns, updates the :version info, and introduces a config var to
enable the --graph (this var should be set automatically depending on
whether --graph is supported, but for now it just defaults to nil).


        Stefan


=== modified file 'lisp/ChangeLog'
--- lisp/ChangeLog	2014-06-06 14:37:05 +0000
+++ lisp/ChangeLog	2014-06-06 16:11:32 +0000
@@ -1,3 +1,10 @@
+2014-06-06  Santiago Payà i Miralta  <santiagopim <at> gmail.com>
+
+	* vc/vc-hg.el (vc-hg-log-graph): New var.
+	(vc-hg-print-log): Use it.
+	(vc-hg-root-log-format): Include branch name and bookmarks; ignore
+	graph output (bug#17515).
+
 2014-06-06  Stefan Monnier  <monnier <at> iro.umontreal.ca>
 
 	* mouse.el (mouse-posn-property): Ignore buffer position info when the
@@ -631,7 +638,7 @@
 	* emacs-lisp/nadvice.el (advice--interactive-form): Don't get fooled
 	into autoloading just because of a silly indirection.
 
-2014-05-12  Santiago Payà i Miralta  <santiagopim <at> gmail.com>  (tiny change)
+2014-05-12  Santiago Payà i Miralta  <santiagopim <at> gmail.com>
 
 	* vc/vc-hg.el (vc-hg-unregister): New function.  (Bug#17454)
 

=== modified file 'lisp/vc/vc-hg.el'
--- lisp/vc/vc-hg.el	2014-05-11 02:01:08 +0000
+++ lisp/vc/vc-hg.el	2014-06-06 16:07:59 +0000
@@ -146,12 +146,19 @@
   :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\\}\\)"
+  `(,(concat "{rev}:{ifeq(branch, 'default','', '{branch}')}"
+             ":{bookmarks}:{tags}:{author|person}"
+             " {date|shortdate} {desc|firstline}\\n")
+    ,(concat "^\\(?:[+@o x|-]*\\)"      ;Graph data.
+             "\\([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)))
+     (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,
@@ -160,7 +167,7 @@
 highlighting the Log View buffer."
   :type '(list string string (repeat sexp))
   :group 'vc-hg
-  :version "24.1")
+  :version "24.5")
 
 
 ;;; Properties of the backend
@@ -247,6 +254,9 @@
 
 (autoload 'vc-setup-buffer "vc-dispatcher")
 
+(defvar vc-hg-log-graph nil
+  "If non-nil, use `--graph' in the short log output.")
+
 (defun vc-hg-print-log (files buffer &optional shortlog start-revision limit)
   "Print commit log associated with FILES into specified BUFFER.
 If SHORTLOG is non-nil, use a short format based on `vc-hg-root-log-format'.
@@ -264,7 +274,9 @@
 	     (nconc
 	      (when start-revision (list (format "-r%s:0" start-revision)))
 	      (when limit (list "-l" (format "%s" limit)))
-	      (when shortlog (list "--template" (car vc-hg-root-log-format)))
+	      (when shortlog `(,@(if vc-hg-log-graph '("--graph"))
+                               "--template"
+                               ,(car vc-hg-root-log-format)))
 	      vc-hg-log-switches)))))
 
 (defvar log-view-message-re)





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#17515; Package emacs. (Sat, 07 Jun 2014 20:25:01 GMT) Full text and rfc822 format available.

Message #16 received at 17515-done <at> debbugs.gnu.org (full text, mbox):

From: Santiago <santiagopim <at> gmail.com>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: 17515-done <at> debbugs.gnu.org
Subject: Re: bug#17515: Correction: using log-switch causes normal non
 shortlog use fail format
Date: Sat, 07 Jun 2014 22:24:36 +0200
[Message part 1 (text/plain, inline)]
Hello,

Many many thanks for all the corrections. I am sorry for alignment problems, I fear that the gmail web client is not preferred email client to send patches. I will review the next 'shipment'.

Best regards,

Santiago

--
Smartphoning

---- Stefan Monnier wrote ----

>OK, I see your papers are in.  Now that I'm looking at your patch,
>I have one more comment.  The previous version of your patch said:
>
>   Using --graph needs Mercurial 3.0+ or the graphlog extension.
>
>Yet my Debian install is still at 2.9.2, so using --graph by default
>seems risky.  Is there a way to test whether "hg" supports "--graph"?
>
>Oh, and your patch was mangled.  Try to use a MUA that doesn't wrap
>lines for you.
>
>I installed the tweaked patch below, which avoids going over
>80-columns, updates the :version info, and introduces a config var to
>enable the --graph (this var should be set automatically depending on
>whether --graph is supported, but for now it just defaults to nil).
>
>
>        Stefan
>
>
>=== modified file 'lisp/ChangeLog'
>--- lisp/ChangeLog	2014-06-06 14:37:05 +0000
>+++ lisp/ChangeLog	2014-06-06 16:11:32 +0000
>@@ -1,3 +1,10 @@
>+2014-06-06  Santiago Payà i Miralta  <santiagopim <at> gmail.com>
>+
>+	* vc/vc-hg.el (vc-hg-log-graph): New var.
>+	(vc-hg-print-log): Use it.
>+	(vc-hg-root-log-format): Include branch name and bookmarks; ignore
>+	graph output (bug#17515).
>+
> 2014-06-06  Stefan Monnier  <monnier <at> iro.umontreal.ca>
> 
> 	* mouse.el (mouse-posn-property): Ignore buffer position info when the
>@@ -631,7 +638,7 @@
> 	* emacs-lisp/nadvice.el (advice--interactive-form): Don't get fooled
> 	into autoloading just because of a silly indirection.
> 
>-2014-05-12  Santiago Payà i Miralta  <santiagopim <at> gmail.com>  (tiny change)
>+2014-05-12  Santiago Payà i Miralta  <santiagopim <at> gmail.com>
> 
> 	* vc/vc-hg.el (vc-hg-unregister): New function.  (Bug#17454)
> 
>
>=== modified file 'lisp/vc/vc-hg.el'
>--- lisp/vc/vc-hg.el	2014-05-11 02:01:08 +0000
>+++ lisp/vc/vc-hg.el	2014-06-06 16:07:59 +0000
>@@ -146,12 +146,19 @@
>   :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\\}\\)"
>+  `(,(concat "{rev}:{ifeq(branch, 'default','', '{branch}')}"
>+             ":{bookmarks}:{tags}:{author|person}"
>+             " {date|shortdate} {desc|firstline}\\n")
>+    ,(concat "^\\(?:[+@o x|-]*\\)"      ;Graph data.
>+             "\\([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)))
>+     (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,
>@@ -160,7 +167,7 @@
> highlighting the Log View buffer."
>   :type '(list string string (repeat sexp))
>   :group 'vc-hg
>-  :version "24.1")
>+  :version "24.5")
> 
> >
> ;;; Properties of the backend
>@@ -247,6 +254,9 @@
> 
> (autoload 'vc-setup-buffer "vc-dispatcher")
> 
>+(defvar vc-hg-log-graph nil
>+  "If non-nil, use `--graph' in the short log output.")
>+
> (defun vc-hg-print-log (files buffer &optional shortlog start-revision limit)
>   "Print commit log associated with FILES into specified BUFFER.
> If SHORTLOG is non-nil, use a short format based on `vc-hg-root-log-format'.
>@@ -264,7 +274,9 @@
> 	     (nconc
> 	      (when start-revision (list (format "-r%s:0" start-revision)))
> 	      (when limit (list "-l" (format "%s" limit)))
>-	      (when shortlog (list "--template" (car vc-hg-root-log-format)))
>+	      (when shortlog `(,@(if vc-hg-log-graph '("--graph"))
>+                               "--template"
>+                               ,(car vc-hg-root-log-format)))
> 	      vc-hg-log-switches)))))
> 
> (defvar log-view-message-re)
>
[Message part 2 (text/html, inline)]

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sun, 06 Jul 2014 11:24:04 GMT) Full text and rfc822 format available.

bug unarchived. Request was from Dmitry Gutov <dgutov <at> yandex.ru> to control <at> debbugs.gnu.org. (Fri, 18 Dec 2015 05:07:01 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#17515; Package emacs. (Fri, 18 Dec 2015 05:09:02 GMT) Full text and rfc822 format available.

Message #23 received at 17515 <at> debbugs.gnu.org (full text, mbox):

From: Dmitry Gutov <dgutov <at> yandex.ru>
To: Santiago <santiagopim <at> gmail.com>
Cc: 17515 <at> debbugs.gnu.org, Stefan Monnier <monnier <at> iro.umontreal.ca>
Subject: Re: bug#17515: Correction: using log-switch causes normal non
 shortlog use fail format
Date: Fri, 18 Dec 2015 07:08:36 +0200
> ---- Stefan Monnier wrote ----
>
>>OK, I see your papers are in.  Now that I'm looking at your patch,
>>I have one more comment.  The previous version of your patch said:
>>
>>   Using --graph needs Mercurial 3.0+ or the graphlog extension.
>>
>>Yet my Debian install is still at 2.9.2, so using --graph by default
>>seems risky.  Is there a way to test whether "hg" supports "--graph"?

Could someone double-check whether --graph actually needs Mercurial 3.0?

https://www.mercurial-scm.org/wiki/GraphlogExtension says that the
minimum version is only 2.3.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Fri, 15 Jan 2016 12:24:03 GMT) Full text and rfc822 format available.

This bug report was last modified 9 years and 158 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.