all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* [PATCH] Add switches for Git log command
@ 2021-06-01  8:53 Utkarsh Singh
  2021-06-07  0:00 ` Dmitry Gutov
  0 siblings, 1 reply; 9+ messages in thread
From: Utkarsh Singh @ 2021-06-01  8:53 UTC (permalink / raw)
  To: emacs-devel

Hi,

VC provides `vc-print-log' command to view changes in current fileset
which displays hash, author, date and commit message.  By default git
displays date in format 'Mon May 31 07:29:51 2021 +0200' but I wanted
'2021-05-31 07:29:51 +0200' which is supported by '--date=iso' switch.

Currently `vc-print-log' provides no option to tweak it's behaviour with
switches hence I am proposing a patch which introduces a variable
`vc-git-log-switches' to provide the necessary functionally.

diff --git a/lisp/vc/vc-git.el b/lisp/vc/vc-git.el
index e37c09df7c..335cb0a403 100644
--- a/lisp/vc/vc-git.el
+++ b/lisp/vc/vc-git.el
@@ -118,6 +118,12 @@ vc-git-diff-switches
 		 (repeat :tag "Argument List" :value ("") string))
   :version "23.1")
 
+(defcustom vc-git-log-switches t
+  "Strings or list of strings specifying switches for Git log under VC."
+  :type '(choice (const :tag "None" t)
+                 (string :tag "Argument String")
+                 (repeat :tag "Argument List" :value ("") string)))
+
 (defcustom vc-git-annotate-switches nil
   "String or list of strings specifying switches for Git blame under VC.
 If nil, use the value of `vc-annotate-switches'.  If t, use no switches."
@@ -1174,7 +1180,8 @@ vc-git-print-log
                     (list start-revision)))
                 (when (eq vc-log-view-type 'with-diff)
                   (list "-p"))
-		'("--")))))))
+                (append (vc-switches 'git 'log)
+		        '("--"))))))))
 
 (defun vc-git-log-outgoing (buffer remote-location)
   (vc-setup-buffer buffer)

-- 
Utkarsh Singh
http://utkarshsingh.xyz



^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH] Add switches for Git log command
  2021-06-01  8:53 [PATCH] Add switches for Git log command Utkarsh Singh
@ 2021-06-07  0:00 ` Dmitry Gutov
  2021-06-07  4:17   ` Utkarsh Singh
  0 siblings, 1 reply; 9+ messages in thread
From: Dmitry Gutov @ 2021-06-07  0:00 UTC (permalink / raw)
  To: Utkarsh Singh, emacs-devel

Hi!

On 01.06.2021 11:53, Utkarsh Singh wrote:
> VC provides `vc-print-log' command to view changes in current fileset
> which displays hash, author, date and commit message.  By default git
> displays date in format 'Mon May 31 07:29:51 2021 +0200' but I wanted
> '2021-05-31 07:29:51 +0200' which is supported by '--date=iso' switch.
> 
> Currently `vc-print-log' provides no option to tweak it's behaviour with
> switches hence I am proposing a patch which introduces a variable
> `vc-git-log-switches' to provide the necessary functionally.

I'm good with this.

Could you resend the change as attachment, preferably with a commit 
message written to our standard? 'git format-patch' can help.

Also see CONTRIBUTE.



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] Add switches for Git log command
  2021-06-07  0:00 ` Dmitry Gutov
@ 2021-06-07  4:17   ` Utkarsh Singh
  2021-06-07 12:41     ` Eli Zaretskii
  0 siblings, 1 reply; 9+ messages in thread
From: Utkarsh Singh @ 2021-06-07  4:17 UTC (permalink / raw)
  To: Dmitry Gutov, emacs-devel

[-- Attachment #1: Type: text/plain, Size: 873 bytes --]

On 2021-06-07, 03:00 +0300, Dmitry Gutov <dgutov@yandex.ru> wrote:

> On 01.06.2021 11:53, Utkarsh Singh wrote:
>> VC provides `vc-print-log' command to view changes in current fileset
>> which displays hash, author, date and commit message.  By default git
>> displays date in format 'Mon May 31 07:29:51 2021 +0200' but I wanted
>> '2021-05-31 07:29:51 +0200' which is supported by '--date=iso' switch.
>> 
>> Currently `vc-print-log' provides no option to tweak it's behaviour with
>> switches hence I am proposing a patch which introduces a variable
>> `vc-git-log-switches' to provide the necessary functionally.
>
> I'm good with this.

Thank you for accepting my feature request.

> Could you resend the change as attachment, preferably with a commit 
> message written to our standard? 'git format-patch' can help.

Yes!

-- 
Utkarsh Singh
http://utkarshsingh.xyz


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: patch --]
[-- Type: text/x-patch, Size: 2604 bytes --]

From e84cf00a367bded4489cd8defbcb36a5913d3f96 Mon Sep 17 00:00:00 2001
From: Utkarsh Singh <utkarsh190601@gmail.com>
Date: Tue, 1 Jun 2021 14:33:01 +0530
Subject: [PATCH] New user option for Git log switches

* lisp/vc/vc-git.el (vc-git-print-log): New defcustom
`vc-git-diff-switches'.

* etc/NEWS: Announce the new option.
---
 etc/NEWS          |  4 ++++
 lisp/vc/vc-git.el | 11 +++++++++--
 2 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/etc/NEWS b/etc/NEWS
index 6622861aaf..db4fc3e7fb 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -829,6 +829,10 @@ If non-nil, only branches and remotes are considered when doing
 completion over Git branch names.  The default is nil, which causes
 tags to be considered as well.
 
+---
+*** New user option 'vc-git-log-switches'.
+Strings or list of strings specifying switches for Git log under VC.
+
 ** Gnus
 
 +++
diff --git a/lisp/vc/vc-git.el b/lisp/vc/vc-git.el
index e37c09df7c..402685ad1c 100644
--- a/lisp/vc/vc-git.el
+++ b/lisp/vc/vc-git.el
@@ -118,6 +118,12 @@ vc-git-diff-switches
 		 (repeat :tag "Argument List" :value ("") string))
   :version "23.1")
 
+(defcustom vc-git-log-switches t
+  "Strings or list of strings specifying switches for Git log under VC."
+  :type '(choice (const :tag "None" t)
+                 (string :tag "Argument String")
+                 (repeat :tag "Argument List" :value ("") string)))
+
 (defcustom vc-git-annotate-switches nil
   "String or list of strings specifying switches for Git blame under VC.
 If nil, use the value of `vc-annotate-switches'.  If t, use no switches."
@@ -1131,6 +1137,8 @@ vc-git-print-log-follow
   :type 'boolean
   :version "26.1")
 
+(autoload 'vc-switches "vc")
+
 (defun vc-git-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-git-root-log-format'.
@@ -1164,6 +1172,7 @@ vc-git-print-log
                     ,(format "--pretty=tformat:%s"
 			     (car vc-git-root-log-format))
 		    "--abbrev-commit"))
+                (vc-switches 'git 'log)
 		(when (numberp limit)
                   (list "-n" (format "%s" limit)))
 		(when start-revision
@@ -1385,8 +1394,6 @@ vc-git--asciify-coding-system
                                 samp coding-system-for-read t)))
     (setq coding-system-for-read 'undecided)))
 
-(autoload 'vc-switches "vc")
-
 (defun vc-git-diff (files &optional rev1 rev2 buffer _async)
   "Get a difference report using Git between two revisions of FILES."
   (let (process-file-side-effects
-- 
2.31.1


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH] Add switches for Git log command
  2021-06-07  4:17   ` Utkarsh Singh
@ 2021-06-07 12:41     ` Eli Zaretskii
  2021-06-08  1:57       ` Utkarsh Singh
  0 siblings, 1 reply; 9+ messages in thread
From: Eli Zaretskii @ 2021-06-07 12:41 UTC (permalink / raw)
  To: Utkarsh Singh; +Cc: emacs-devel, dgutov

> From: Utkarsh Singh <utkarsh190601@gmail.com>
> Date: Mon, 07 Jun 2021 09:47:40 +0530
> 
> +(defcustom vc-git-log-switches t
> +  "Strings or list of strings specifying switches for Git log under VC."
> +  :type '(choice (const :tag "None" t)
> +                 (string :tag "Argument String")
> +                 (repeat :tag "Argument List" :value ("") string)))

New or changed defcustoms should have a :version tag.

Thanks.



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] Add switches for Git log command
  2021-06-07 12:41     ` Eli Zaretskii
@ 2021-06-08  1:57       ` Utkarsh Singh
  2021-06-08 11:27         ` Eli Zaretskii
  0 siblings, 1 reply; 9+ messages in thread
From: Utkarsh Singh @ 2021-06-08  1:57 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: emacs-devel, dgutov

[-- Attachment #1: Type: text/plain, Size: 550 bytes --]

On 2021-06-07, 15:41 +0300, Eli Zaretskii <eliz@gnu.org> wrote:

>> From: Utkarsh Singh <utkarsh190601@gmail.com>
>> Date: Mon, 07 Jun 2021 09:47:40 +0530
>> 
>> +(defcustom vc-git-log-switches t
>> +  "Strings or list of strings specifying switches for Git log under VC."
>> +  :type '(choice (const :tag "None" t)
>> +                 (string :tag "Argument String")
>> +                 (repeat :tag "Argument List" :value ("") string)))
>
> New or changed defcustoms should have a :version tag.

Done.

-- 
Utkarsh Singh
http://utkarshsingh.xyz


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: patch --]
[-- Type: text/x-patch, Size: 2624 bytes --]

From 0b22fdc37713de8fdfb489a10d38b960e166304b Mon Sep 17 00:00:00 2001
From: Utkarsh Singh <utkarsh190601@gmail.com>
Date: Tue, 1 Jun 2021 14:33:01 +0530
Subject: [PATCH] New user option for Git log switches

* lisp/vc/vc-git.el (vc-git-print-log): New defcustom
`vc-git-diff-switches'.

* etc/NEWS: Announce the new option.
---
 etc/NEWS          |  4 ++++
 lisp/vc/vc-git.el | 12 ++++++++++--
 2 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/etc/NEWS b/etc/NEWS
index 6622861aaf..db4fc3e7fb 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -829,6 +829,10 @@ If non-nil, only branches and remotes are considered when doing
 completion over Git branch names.  The default is nil, which causes
 tags to be considered as well.
 
+---
+*** New user option 'vc-git-log-switches'.
+Strings or list of strings specifying switches for Git log under VC.
+
 ** Gnus
 
 +++
diff --git a/lisp/vc/vc-git.el b/lisp/vc/vc-git.el
index e37c09df7c..eb9b701e2e 100644
--- a/lisp/vc/vc-git.el
+++ b/lisp/vc/vc-git.el
@@ -118,6 +118,13 @@ vc-git-diff-switches
 		 (repeat :tag "Argument List" :value ("") string))
   :version "23.1")
 
+(defcustom vc-git-log-switches t
+  "Strings or list of strings specifying switches for Git log under VC."
+  :type '(choice (const :tag "None" t)
+                 (string :tag "Argument String")
+                 (repeat :tag "Argument List" :value ("") string))
+  :version "28.1")
+
 (defcustom vc-git-annotate-switches nil
   "String or list of strings specifying switches for Git blame under VC.
 If nil, use the value of `vc-annotate-switches'.  If t, use no switches."
@@ -1131,6 +1138,8 @@ vc-git-print-log-follow
   :type 'boolean
   :version "26.1")
 
+(autoload 'vc-switches "vc")
+
 (defun vc-git-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-git-root-log-format'.
@@ -1164,6 +1173,7 @@ vc-git-print-log
                     ,(format "--pretty=tformat:%s"
 			     (car vc-git-root-log-format))
 		    "--abbrev-commit"))
+                (vc-switches 'git 'log)
 		(when (numberp limit)
                   (list "-n" (format "%s" limit)))
 		(when start-revision
@@ -1385,8 +1395,6 @@ vc-git--asciify-coding-system
                                 samp coding-system-for-read t)))
     (setq coding-system-for-read 'undecided)))
 
-(autoload 'vc-switches "vc")
-
 (defun vc-git-diff (files &optional rev1 rev2 buffer _async)
   "Get a difference report using Git between two revisions of FILES."
   (let (process-file-side-effects
-- 
2.31.1


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH] Add switches for Git log command
  2021-06-08  1:57       ` Utkarsh Singh
@ 2021-06-08 11:27         ` Eli Zaretskii
  2021-06-08 14:20           ` Utkarsh Singh
  0 siblings, 1 reply; 9+ messages in thread
From: Eli Zaretskii @ 2021-06-08 11:27 UTC (permalink / raw)
  To: Utkarsh Singh; +Cc: emacs-devel, dgutov

> From: Utkarsh Singh <utkarsh190601@gmail.com>
> Cc: dgutov@yandex.ru, emacs-devel@gnu.org
> Date: Tue, 08 Jun 2021 07:27:37 +0530
> 
> > New or changed defcustoms should have a :version tag.
> 
> Done.

Thanks.

> +---
> +*** New user option 'vc-git-log-switches'.
> +Strings or list of strings specifying switches for Git log under VC.
   ^^^^^^^
This should be "String", singular, right?

Otherwise LGTM.



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] Add switches for Git log command
  2021-06-08 11:27         ` Eli Zaretskii
@ 2021-06-08 14:20           ` Utkarsh Singh
  2021-06-08 23:38             ` Dmitry Gutov
  0 siblings, 1 reply; 9+ messages in thread
From: Utkarsh Singh @ 2021-06-08 14:20 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: emacs-devel, dgutov

[-- Attachment #1: Type: text/plain, Size: 301 bytes --]

On 2021-06-08, 14:27 +0300, Eli Zaretskii <eliz@gnu.org> wrote:

>> +---
>> +*** New user option 'vc-git-log-switches'.
>> +Strings or list of strings specifying switches for Git log under VC.
>    ^^^^^^^
> This should be "String", singular, right?

Oops!

-- 
Utkarsh Singh
http://utkarshsingh.xyz


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: patch --]
[-- Type: text/x-patch, Size: 2622 bytes --]

From 7f1d78f24fc02d8a5b800beca1f9906af4f339be Mon Sep 17 00:00:00 2001
From: Utkarsh Singh <utkarsh190601@gmail.com>
Date: Tue, 1 Jun 2021 14:33:01 +0530
Subject: [PATCH] New user option for Git log switches

* lisp/vc/vc-git.el (vc-git-print-log): New defcustom
`vc-git-diff-switches'.

* etc/NEWS: Announce the new option.
---
 etc/NEWS          |  4 ++++
 lisp/vc/vc-git.el | 12 ++++++++++--
 2 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/etc/NEWS b/etc/NEWS
index 6622861aaf..ffa243218d 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -829,6 +829,10 @@ If non-nil, only branches and remotes are considered when doing
 completion over Git branch names.  The default is nil, which causes
 tags to be considered as well.
 
+---
+*** New user option 'vc-git-log-switches'.
+String or list of strings specifying switches for Git log under VC.
+
 ** Gnus
 
 +++
diff --git a/lisp/vc/vc-git.el b/lisp/vc/vc-git.el
index e37c09df7c..f2d123db02 100644
--- a/lisp/vc/vc-git.el
+++ b/lisp/vc/vc-git.el
@@ -118,6 +118,13 @@ vc-git-diff-switches
 		 (repeat :tag "Argument List" :value ("") string))
   :version "23.1")
 
+(defcustom vc-git-log-switches t
+  "String or list of strings specifying switches for Git log under VC."
+  :type '(choice (const :tag "None" t)
+                 (string :tag "Argument String")
+                 (repeat :tag "Argument List" :value ("") string))
+  :version "28.1")
+
 (defcustom vc-git-annotate-switches nil
   "String or list of strings specifying switches for Git blame under VC.
 If nil, use the value of `vc-annotate-switches'.  If t, use no switches."
@@ -1131,6 +1138,8 @@ vc-git-print-log-follow
   :type 'boolean
   :version "26.1")
 
+(autoload 'vc-switches "vc")
+
 (defun vc-git-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-git-root-log-format'.
@@ -1164,6 +1173,7 @@ vc-git-print-log
                     ,(format "--pretty=tformat:%s"
 			     (car vc-git-root-log-format))
 		    "--abbrev-commit"))
+                (vc-switches 'git 'log)
 		(when (numberp limit)
                   (list "-n" (format "%s" limit)))
 		(when start-revision
@@ -1385,8 +1395,6 @@ vc-git--asciify-coding-system
                                 samp coding-system-for-read t)))
     (setq coding-system-for-read 'undecided)))
 
-(autoload 'vc-switches "vc")
-
 (defun vc-git-diff (files &optional rev1 rev2 buffer _async)
   "Get a difference report using Git between two revisions of FILES."
   (let (process-file-side-effects
-- 
2.31.1


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH] Add switches for Git log command
  2021-06-08 14:20           ` Utkarsh Singh
@ 2021-06-08 23:38             ` Dmitry Gutov
  2021-06-09  1:19               ` Utkarsh Singh
  0 siblings, 1 reply; 9+ messages in thread
From: Dmitry Gutov @ 2021-06-08 23:38 UTC (permalink / raw)
  To: Utkarsh Singh, Eli Zaretskii; +Cc: emacs-devel

On 08.06.2021 17:20, Utkarsh Singh wrote:
>>> +---
>>> +*** New user option 'vc-git-log-switches'.
>>> +Strings or list of strings specifying switches for Git log under VC.
>>     ^^^^^^^
>> This should be "String", singular, right?
> Oops!

Thanks, pushed as commit 4a1e97bea9.

Check out the log message, though: it still needed tweaking.

Speaking of copyright paperwork, would you like to sign it?

Looking at your past submissions, you seem to be approaching the allowed 
limit without assignment.



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] Add switches for Git log command
  2021-06-08 23:38             ` Dmitry Gutov
@ 2021-06-09  1:19               ` Utkarsh Singh
  0 siblings, 0 replies; 9+ messages in thread
From: Utkarsh Singh @ 2021-06-09  1:19 UTC (permalink / raw)
  To: Dmitry Gutov, Eli Zaretskii; +Cc: emacs-devel

On 2021-06-09, 02:38 +0300, Dmitry Gutov <dgutov@yandex.ru> wrote:

> On 08.06.2021 17:20, Utkarsh Singh wrote:
>>>> +---
>>>> +*** New user option 'vc-git-log-switches'.
>>>> +Strings or list of strings specifying switches for Git log under VC.
>>>     ^^^^^^^
>>> This should be "String", singular, right?
>> Oops!
>
> Thanks, pushed as commit 4a1e97bea9.

Thank you!

> Check out the log message, though: it still needed tweaking.

Yes, my log message was silly indeed.

> Speaking of copyright paperwork, would you like to sign it?
>
> Looking at your past submissions, you seem to be approaching the allowed 
> limit without assignment.

Why not?

I will update this thread once my copyright assignment is complete.

Thank you,
Utkarsh Singh

-- 
Utkarsh Singh
http://utkarshsingh.xyz



^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2021-06-09  1:19 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-06-01  8:53 [PATCH] Add switches for Git log command Utkarsh Singh
2021-06-07  0:00 ` Dmitry Gutov
2021-06-07  4:17   ` Utkarsh Singh
2021-06-07 12:41     ` Eli Zaretskii
2021-06-08  1:57       ` Utkarsh Singh
2021-06-08 11:27         ` Eli Zaretskii
2021-06-08 14:20           ` Utkarsh Singh
2021-06-08 23:38             ` Dmitry Gutov
2021-06-09  1:19               ` Utkarsh Singh

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.