all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Dan Nicolaescu <dann@ics.uci.edu>
To: Miles Bader <miles@gnu.org>
Cc: emacs-devel@gnu.org
Subject: Re: VC top of the tree diff and log
Date: Thu, 16 Jul 2009 14:38:52 -0700 (PDT)	[thread overview]
Message-ID: <200907162138.n6GLcq4i025189@godzilla.ics.uci.edu> (raw)
In-Reply-To: <87k52i93ug.fsf@catnip.gol.com> (Miles Bader's message of "Thu, 09 Jul 2009 08:01:27 +0900")

Miles Bader <miles@gnu.org> writes:

  > Dan Nicolaescu <dann@ics.uci.edu> writes:
  > > A related question: should we have an option (or default?) to show the
  > > short version (--pretty=oneline --graph) ?
  > 
  > Would be useful, though I dunno what you'd bind it too... at some point
  > having too many bindings for essentially-similar-commands becomes kind
  > of annoying/confusing.
  > 
  > I don't really like the default --pretty=oneline format though, as it
  > wastes too much space on the hash, and doesn't show a date (which I find
  > very useful in looking at logs).
  > 
  > Here's what I use (with my own "slog" alias):
  > 
  >    --date=short --pretty=format:"%h  %ad  %s" --abbrev-commit
  > 
  > [note there are _two_ spaces between fields, which makes the result much
  > more readable than one, I think]

Here's what I have now, it defaults to showing short log (and the graph
is shown in both the short and long versions).  It's git specific (no
integration with VC), there's no UI for switching between the long and
short version yet.

Ideas (or even better, code) on how to make all these fit together are
welcome. 


--- vc-git.el.~1.82.~	2009-06-26 18:46:22.000000000 -0700
+++ vc-git.el	2009-07-16 14:22:57.000000000 -0700
@@ -118,6 +118,13 @@ If nil, use the value of `vc-diff-switch
   :version "23.1"
   :group 'vc)
 
+(defcustom vc-git-add-signoff nil
+  "Add a Signoff-by line whn comitting."
+  :type 'boolean
+  :version "23.2"
+  :group 'vc)
+
+
 (defvar git-commits-coding-system 'utf-8
   "Default coding system for git commits.")
 
@@ -417,10 +424,10 @@ If nil, use the value of `vc-diff-switch
 (defun vc-git-unregister (file)
   (vc-git-command nil 0 file "rm" "-f" "--cached" "--"))
 
-
 (defun vc-git-checkin (files rev comment)
   (let ((coding-system-for-write git-commits-coding-system))
-    (vc-git-command nil 0 files "commit" "-m" comment "--only" "--")))
+    (vc-git-command nil 0 files "commit"
+		    (if vc-git-add-signoff "-s" "") "-m" comment "--only" "--")))
 
 (defun vc-git-find-revision (file rev buffer)
   (let ((coding-system-for-read 'binary)
@@ -444,6 +451,8 @@ If nil, use the value of `vc-diff-switch
 
 ;;; HISTORY FUNCTIONS
 
+(defvar vc-git-log-type 'short)
+
 (defun vc-git-print-log (files &optional buffer)
   "Get change log associated with FILES."
   (let ((coding-system-for-read git-commits-coding-system)
@@ -458,8 +467,13 @@ If nil, use the value of `vc-diff-switch
     (let ((inhibit-read-only t))
       (with-current-buffer
           buffer
-	(vc-git-command buffer 'async files
-			"rev-list" "--pretty" "HEAD" "--")))))
+	(if (eq vc-git-log-type 'short)
+	    (vc-git-command buffer 'async files
+			    "log" "--graph"
+			    "--date=short" "--pretty=format:%h  %ad  %s" "--abbrev-commit"
+			    "--")
+	  (vc-git-command buffer 'async files
+			  "rev-list" "--graph" "--pretty" "HEAD" "--"))))))
 
 (defvar log-view-message-re)
 (defvar log-view-file-re)
@@ -472,29 +486,37 @@ If nil, use the value of `vc-diff-switch
   (set (make-local-variable 'log-view-file-re) "\\`a\\`")
   (set (make-local-variable 'log-view-per-file-logs) nil)
   (set (make-local-variable 'log-view-message-re)
-       "^commit *\\([0-9a-z]+\\)")
+       (if (eq vc-git-log-type 'short)
+	 "^[*/\\| ]+ \\([0-9a-z]+\\)  \\([-a-z0-9]+\\)  \\(.*\\)"
+	 "^[ */\\|]+commit *\\([0-9a-z]+\\)"))
   (set (make-local-variable 'log-view-font-lock-keywords)
-       (append
-        `((,log-view-message-re  (1 'change-log-acknowledgement)))
-        ;; Handle the case:
-        ;; user: foo@bar
-        '(("^Author:[ \t]+\\([A-Za-z0-9_.+-]+@[A-Za-z0-9_.-]+\\)"
-           (1 'change-log-email))
-          ;; Handle the case:
-          ;; user: FirstName LastName <foo@bar>
-          ("^Author:[ \t]+\\([^<(]+?\\)[ \t]*[(<]\\([A-Za-z0-9_.+-]+@[A-Za-z0-9_.-]+\\)[>)]"
-           (1 'change-log-name)
-           (2 'change-log-email))
-          ("^ +\\(?:\\(?:[Aa]cked\\|[Ss]igned-[Oo]ff\\)-[Bb]y:\\)[ \t]+\\([A-Za-z0-9_.+-]+@[A-Za-z0-9_.-]+\\)"
-           (1 'change-log-name))
-          ("^ +\\(?:\\(?:[Aa]cked\\|[Ss]igned-[Oo]ff\\)-[Bb]y:\\)[ \t]+\\([^<(]+?\\)[ \t]*[(<]\\([A-Za-z0-9_.+-]+@[A-Za-z0-9_.-]+\\)[>)]"
-           (1 'change-log-name)
-           (2 'change-log-email))
-          ("^Merge: \\([0-9a-z]+\\) \\([0-9a-z]+\\)"
-           (1 'change-log-acknowledgement)
-           (2 'change-log-acknowledgement))
-          ("^Date:   \\(.+\\)" (1 'change-log-date))
-          ("^summary:[ \t]+\\(.+\\)" (1 'log-view-message))))))
+       (if (eq vc-git-log-type 'short)
+	   (append
+	    `((,log-view-message-re
+	       (1 'change-log-acknowledgement)
+	       (2 'change-log-date))))
+	 (append
+	  `((,log-view-message-re  (1 'change-log-acknowledgement)))
+	  ;; Handle the case:
+	  ;; user: foo@bar
+	  '((" Author:[ \t]+\\([A-Za-z0-9_.+-]+@[A-Za-z0-9_.-]+\\)"
+	     (1 'change-log-email))
+	    ;; Handle the case:
+	    ;; user: FirstName LastName <foo@bar>
+	    (" Author:[ \t]+\\([^<(]+?\\)[ \t]*[(<]\\([A-Za-z0-9_.+-]+@[A-Za-z0-9_.-]+\\)[>)]"
+	     (1 'change-log-name)
+	     (2 'change-log-email))
+	    ("^ +\\(?:\\(?:[Aa]cked\\|[Ss]igned-[Oo]ff\\)-[Bb]y:\\)[ \t]+\\([A-Za-z0-9_.+-]+@[A-Za-z0-9_.-]+\\)"
+	     (1 'change-log-name))
+	    ("^ +\\(?:\\(?:[Aa]cked\\|[Ss]igned-[Oo]ff\\)-[Bb]y:\\)[ \t]+\\([^<(]+?\\)[ \t]*[(<]\\([A-Za-z0-9_.+-]+@[A-Za-z0-9_.-]+\\)[>)]"
+	     (1 'change-log-name)
+	     (2 'change-log-email))
+	    (" Merge: \\([0-9a-z]+\\) \\([0-9a-z]+\\)"
+	     (1 'change-log-acknowledgement)
+	     (2 'change-log-acknowledgement))
+	    (" Date:   \\(.+\\)" (1 'change-log-date))
+	    (" summary:[ \t]+\\(.+\\)" (1 'log-view-message)))))))
+
 
 (defun vc-git-show-log-entry (revision)
   "Move to the log entry for REVISION.
@@ -633,12 +655,20 @@ or BRANCH^ (where \"^\" can be repeated)
     (define-key map [git-grep]
       '(menu-item "Git grep..." vc-git-grep
 		  :help "Run the `git grep' command"))
+    (define-key map [git-sig]
+      '(menu-item "Add Signoff-by on commit" vc-git-toggle-signoff
+	      :help "Add Add Signed-off-by when commiting (i.e. add the -s flag)"
+	      :button (:toggle . vc-git-add-signoff)))
     map))
 
 (defun vc-git-extra-menu () vc-git-extra-menu-map)
 
 (defun vc-git-extra-status-menu () vc-git-extra-menu-map)
 
+(defun vc-git-toggle-signoff ()
+  (interactive)
+  (setq vc-git-add-signoff (not vc-git-add-signoff)))
+
 ;; Derived from `lgrep'.
 (defun vc-git-grep (regexp &optional files dir)
   "Run git grep, searching for REGEXP in FILES in directory DIR.




  parent reply	other threads:[~2009-07-16 21:38 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-07-07 18:45 VC top of the tree diff and log Dan Nicolaescu
2009-07-08  2:50 ` Miles Bader
2009-07-08 21:10   ` Dan Nicolaescu
2009-07-08 23:01     ` Miles Bader
2009-07-09  0:29       ` Dan Nicolaescu
2009-07-09  3:05         ` Miles Bader
2009-07-09  3:58           ` C-x v l in a dired buffer [was: Re: VC top of the tree diff and log] Dan Nicolaescu
2009-07-09  6:48           ` VC top of the tree diff and log Dan Nicolaescu
2009-07-16 21:38       ` Dan Nicolaescu [this message]
2009-07-18 21:45         ` Juri Linkov
2009-07-11 19:51 ` Stefan Monnier
2009-07-23  5:43   ` Dan Nicolaescu
2009-07-30  7:18     ` Dan Nicolaescu
2009-08-29 19:13       ` Dan Nicolaescu
2009-08-29 21:25         ` Stefan Monnier
2009-08-29 22:47           ` Juri Linkov
2009-08-29 23:10             ` Miles Bader
2009-09-01 21:36               ` Juri Linkov
2009-09-01 22:27                 ` Juri Linkov
2009-09-04  0:04                   ` Juri Linkov
2009-09-04  2:12                   ` Stefan Monnier
2009-08-30  6:16           ` Dan Nicolaescu
2009-09-01 21:35             ` Juri Linkov
2009-09-01 22:07               ` Dan Nicolaescu
2009-09-02  4:13                 ` Miles Bader
2009-09-02  4:34                   ` Dan Nicolaescu
2009-09-04  0:05                     ` Juri Linkov
2009-09-04  0:33                       ` Miles Bader
2009-09-01 21:41         ` Juri Linkov
2009-09-01 22:46           ` Dan Nicolaescu
2009-09-04  0:06             ` Juri Linkov
2009-12-06 22:37           ` Dan Nicolaescu
2009-09-04  0:36         ` Juri Linkov
2009-09-04  3:42           ` Miles Bader

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200907162138.n6GLcq4i025189@godzilla.ics.uci.edu \
    --to=dann@ics.uci.edu \
    --cc=emacs-devel@gnu.org \
    --cc=miles@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.