From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Dan Nicolaescu Newsgroups: gmane.emacs.devel Subject: limit the number of log entries displayed by C-x v l Date: Thu, 12 Nov 2009 15:19:57 -0800 (PST) Message-ID: <200911122319.nACNJvUn006154@godzilla.ics.uci.edu> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1258068117 26281 80.91.229.12 (12 Nov 2009 23:21:57 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 12 Nov 2009 23:21:57 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Nov 13 00:21:50 2009 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1N8iz3-0003d8-Ss for ged-emacs-devel@m.gmane.org; Fri, 13 Nov 2009 00:21:46 +0100 Original-Received: from localhost ([127.0.0.1]:55800 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1N8iz3-0006F8-0W for ged-emacs-devel@m.gmane.org; Thu, 12 Nov 2009 18:21:45 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1N8iyy-0006DW-9S for emacs-devel@gnu.org; Thu, 12 Nov 2009 18:21:40 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1N8iyt-00063z-HF for emacs-devel@gnu.org; Thu, 12 Nov 2009 18:21:39 -0500 Original-Received: from [199.232.76.173] (port=48940 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1N8iyt-00063r-DL for emacs-devel@gnu.org; Thu, 12 Nov 2009 18:21:35 -0500 Original-Received: from paul-mcgann-v0.ics.uci.edu ([128.195.1.147]:60671) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1N8iys-000780-NC for emacs-devel@gnu.org; Thu, 12 Nov 2009 18:21:35 -0500 Original-Received: from godzilla.ics.uci.edu (godzilla.ics.uci.edu [128.195.10.101]) by paul-mcgann-v0.ics.uci.edu (8.13.8/8.13.8) with ESMTP id nACNJvOw001845 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Thu, 12 Nov 2009 15:19:57 -0800 Original-Received: (from dann@localhost) by godzilla.ics.uci.edu (8.13.8+Sun/8.13.6/Submit) id nACNJvUn006154; Thu, 12 Nov 2009 15:19:57 -0800 (PST) Original-Lines: 106 X-ICS-MailScanner-Information: Please send mail to helpdesk@ics.uci.edu or more information X-ICS-MailScanner-ID: nACNJvOw001845 X-ICS-MailScanner: Found to be clean X-ICS-MailScanner-SpamCheck: not spam, SpamAssassin (not cached, score=-0.025, required 5, autolearn=disabled, ALL_TRUSTED -1.44, FM_MULTI_ODD2 1.10, SARE_MILLIONSOF 0.32) X-ICS-MailScanner-From: dann@godzilla.ics.uci.edu X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 3) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:116913 Archived-At: Logs for some big trees can be huge, the Linux one is millions of lines. It would be nice if C-x v l could limit the number of items displayed because it takes too long to compute, and very seldom anybody wants to look at so many lines. Modern VCS can limit the number of item displayed by using a command line argument. So the print-log VC method can be changed to do that, Here's how to do that for Mercurial: --- vc-hg.el.~1.105.~ 2009-10-29 21:46:20.000000000 -0700 +++ vc-hg.el 2009-11-12 05:29:06.000000000 -0800 @@ -219,5 +219,5 @@ If nil, use the value of `vc-diff-switch (repeat :tag "Argument List" :value ("") string)) :group 'vc-hg) -(defun vc-hg-print-log (files &optional buffer shortlog) +(defun vc-hg-print-log (files &optional buffer shortlog limit) "Get change log associated with FILES." @@ -236,7 +232,9 @@ If nil, use the value of `vc-diff-switch (apply 'vc-hg-command buffer 0 files "log" (if shortlog (append '("--style" "compact") vc-hg-log-switches) - vc-hg-log-switches))))) + vc-hg-log-switches) + (when limit + (list "-l" limit)))))) (defvar log-view-message-re) (defvar log-view-file-re) One way to set the limit is to ask the user for a limit when using a prefix argument so that it does not change the current default behavior, like so: --- vc.el.~1.738.~ 2009-10-24 03:59:40.000000000 -0700 +++ vc.el 2009-11-12 06:35:20.000000000 -0800 @@ -1839,7 +1839,7 @@ If it contains `directory' then if the f If it contains `file' then show short logs for files. Not all VC backends support short logs!") -(defun vc-print-log-internal (backend files working-revision) +(defun vc-print-log-internal (backend files working-revision limit) ;; Don't switch to the output buffer before running the command, ;; so that any buffer-local settings in the vc-controlled ;; buffer can be accessed by the command. @@ -1852,7 +1852,7 @@ Not all VC backends support short logs!" (not (null (if dir-present (memq 'directory vc-log-short-style) (memq 'file vc-log-short-style))))) - (vc-call-backend backend 'print-log files "*vc-change-log*" vc-short-log) + (vc-call-backend backend 'print-log files "*vc-change-log*" vc-short-log limit) (pop-to-buffer "*vc-change-log*") (vc-exec-after `(let ((inhibit-read-only t) @@ -1868,15 +1868,27 @@ Not all VC backends support short logs!" (set-buffer-modified-p nil))))) ;;;###autoload -(defun vc-print-log (&optional working-revision) +(defun vc-print-log (&optional working-revision limit) "List the change log of the current fileset in a window. If WORKING-REVISION is non-nil, leave the point at that revision." - (interactive) + (interactive + (progn + (cond + (current-prefix-arg + (let ((rev (read-from-minibuffer "Log from revision (default: last revision): " nil + nil nil nil)) + (lim (read-from-minibuffer "Limit display (default: unlimited): " "" + nil nil nil))) + (when (string= rev "") (setq rev nil)) + (when (string= lim "") (setq lim nil)) + (list rev lim))) + (t + (list nil nil))))) (let* ((vc-fileset (vc-deduce-fileset t)) ;FIXME: Why t? --Stef (backend (car vc-fileset)) (files (cadr vc-fileset)) (working-revision (or working-revision (vc-working-revision (car files))))) - (vc-print-log-internal backend files working-revision))) + (vc-print-log-internal backend files working-revision limit))) ;;;###autoload (defun vc-print-root-log () @@ -1890,7 +1902,7 @@ If WORKING-REVISION is non-nil, leave th (error "Buffer is not version controlled")) (setq rootdir (vc-call-backend backend 'root default-directory)) (setq working-revision (vc-working-revision rootdir)) - (vc-print-log-internal backend (list rootdir) working-revision))) + (vc-print-log-internal backend (list rootdir) working-revision nil))) ;;;###autoload (defun vc-revert () Any reason not to check this in? The backend part is straight forward, so that should be OK. If some VCS does not support limiting, it can just ignore the argument. Maybe we could limit the number of entries displayed by default, maybe a few thousands? But that's a separate issue...