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: Re: limit the number of log entries displayed by C-x v l Date: Tue, 17 Nov 2009 05:44:54 -0800 (PST) Message-ID: <200911171344.nAHDis0c026133@godzilla.ics.uci.edu> References: <200911122319.nACNJvUn006154@godzilla.ics.uci.edu> <200911130221.nAD2Lu4q007527@godzilla.ics.uci.edu> <200911130502.nAD52OVv008802@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 1258467189 4723 80.91.229.12 (17 Nov 2009 14:13:09 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 17 Nov 2009 14:13:09 +0000 (UTC) Cc: emacs-devel@gnu.org To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Nov 17 15:13:02 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 1NAOms-0005Xx-2o for ged-emacs-devel@m.gmane.org; Tue, 17 Nov 2009 15:12:06 +0100 Original-Received: from localhost ([127.0.0.1]:41458 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NAOmr-0002WQ-1f for ged-emacs-devel@m.gmane.org; Tue, 17 Nov 2009 09:12:05 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NAOOJ-000406-0U for emacs-devel@gnu.org; Tue, 17 Nov 2009 08:46:43 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NAOOB-0003yg-AN for emacs-devel@gnu.org; Tue, 17 Nov 2009 08:46:40 -0500 Original-Received: from [199.232.76.173] (port=55878 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NAOOA-0003yR-CQ for emacs-devel@gnu.org; Tue, 17 Nov 2009 08:46:34 -0500 Original-Received: from colin-baker-v0.ics.uci.edu ([128.195.1.153]:39476) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1NAOO9-0005wA-Lq for emacs-devel@gnu.org; Tue, 17 Nov 2009 08:46:34 -0500 Original-Received: from godzilla.ics.uci.edu (godzilla.ics.uci.edu [128.195.10.101]) by colin-baker-v0.ics.uci.edu (8.13.8/8.13.8) with ESMTP id nAHDitqa025257 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 17 Nov 2009 05:44:55 -0800 Original-Received: (from dann@localhost) by godzilla.ics.uci.edu (8.13.8+Sun/8.13.6/Submit) id nAHDis0c026133; Tue, 17 Nov 2009 05:44:54 -0800 (PST) In-Reply-To: (Stefan Monnier's message of "Fri, 13 Nov 2009 09:10:55 -0500") Original-Lines: 164 X-ICS-MailScanner-Information: Please send mail to helpdesk@ics.uci.edu or more information X-ICS-MailScanner-ID: nAHDitqa025257 X-ICS-MailScanner: Found to be clean X-ICS-MailScanner-SpamCheck: not spam, SpamAssassin (not cached, score=-1.363, required 5, autolearn=disabled, ALL_TRUSTED -1.44, TW_BZ 0.08) 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:117090 Archived-At: Stefan Monnier writes: > >> > With the proposed backend change that just needs > >> > vc-annotate-show-log-revision-at-line to pass a 1 as the last argument > >> > to vc-print-log-internal. > >> Assuming we retarget the `working-revision' argument to specify the > >> "starting" revision, I guess. Yes, that could work. > > Actually, after looking a bit more we'd need more changes, the > > `working-revision' is not passed to the `print-log' VC method, so a bit > > more work would be needed for that :-( > > But this does not affect my original proposal, which is still needed. > > Yes, I'm not opposing it, I'm just trying to get a better general > picture. Some of the problems we may encounter is that some backends > don't support the `limit' argument. Hopefully all those backends can > easily turn a "print-log FILE REV LIMIT=1" request into "print-log FILE > REV1 REV2" instead, tho. Not sure what to do for other values of LIMIT, > but maybe that's doable as well. Here's a patch that implements only showing a single log entry from vc-annotate. It adds a START-REVISION argument to the print-log VC method. It adds a boolean argument to vc-print-log-internal, when set it means that the WORKING-REVISION argument is the start revision. What do you think? Index: vc-annotate.el =================================================================== RCS file: /cvsroot/emacs/emacs/lisp/vc-annotate.el,v retrieving revision 1.10 diff -u -3 -p -r1.10 vc-annotate.el --- vc-annotate.el 19 Oct 2009 05:04:28 -0000 1.10 +++ vc-annotate.el 17 Nov 2009 13:35:55 -0000 @@ -487,7 +487,7 @@ Return a cons (REV . FILENAME)." (if (not rev-at-line) (message "Cannot extract revision number from the current line") (vc-print-log-internal - vc-annotate-backend (list (cdr rev-at-line)) (car rev-at-line)))))) + vc-annotate-backend (list (cdr rev-at-line)) (car rev-at-line) 1 t))))) (defun vc-annotate-show-diff-revision-at-line-internal (filediff) (if (not (equal major-mode 'vc-annotate-mode)) Index: vc-bzr.el =================================================================== RCS file: /cvsroot/emacs/emacs/lisp/vc-bzr.el,v retrieving revision 1.85 diff -u -3 -p -r1.85 vc-bzr.el --- vc-bzr.el 15 Nov 2009 20:29:01 -0000 1.85 +++ vc-bzr.el 17 Nov 2009 13:35:55 -0000 @@ -481,7 +481,7 @@ REV non-nil gets an error." (2 'change-log-email)) ("^ *timestamp: \\(.*\\)" (1 'change-log-date-face))))))) -(defun vc-bzr-print-log (files buffer &optional shortlog limit) +(defun vc-bzr-print-log (files buffer &optional shortlog limit start-revision) "Get bzr change log for FILES into specified BUFFER." ;; `vc-do-command' creates the buffer, but we need it before running ;; the command. @@ -493,11 +493,13 @@ REV non-nil gets an error." ;; way of getting the above regexps working. (with-current-buffer buffer (apply 'vc-bzr-command "log" buffer 'async files - (when shortlog "--short") - (when limit (list "-l" (format "%s" limit))) - (if (stringp vc-bzr-log-switches) - (list vc-bzr-log-switches) - vc-bzr-log-switches)))) + (append + (when shortlog '("--short")) + (when start-revision (list (format "-r..%s" start-revision))) + (when limit (list "-l" (format "%s" limit))) + (if (stringp vc-bzr-log-switches) + (list vc-bzr-log-switches) + vc-bzr-log-switches))))) (defun vc-bzr-show-log-entry (revision) "Find entry for patch name REVISION in bzr change log buffer." Index: vc.el =================================================================== RCS file: /cvsroot/emacs/emacs/lisp/vc.el,v retrieving revision 1.740 diff -u -3 -p -r1.740 vc.el --- vc.el 16 Nov 2009 20:36:11 -0000 1.740 +++ vc.el 17 Nov 2009 13:35:55 -0000 @@ -333,13 +333,16 @@ ;; ;; HISTORY FUNCTIONS ;; -;; * print-log (files buffer &optional shortlog limit) +;; * print-log (files buffer &optional shortlog limit start-revision) ;; ;; Insert the revision log for FILES into BUFFER. ;; If SHORTLOG is true insert a short version of the log. ;; If LIMIT is true insert only insert LIMIT log entries. If the ;; backend does not support limiting the number of entries to show ;; it should return `limit-unsupported'. +;; If START-REVISION is given, then show the log starting from the +;; revision. At this point START-REVISION is only required to work +;; in conjunction with LIMIT = 1. ;; ;; - log-view-mode () ;; @@ -1847,7 +1850,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 limit) +(defun vc-print-log-internal (backend files working-revision limit is-start-revision) ;; 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. @@ -1863,7 +1866,8 @@ Not all VC backends support short logs!" (memq 'file vc-log-short-style))))) (setq pl-return (vc-call-backend backend 'print-log files "*vc-change-log*" - vc-short-log limit)) + vc-short-log limit + (when is-start-revision working-revision))) (pop-to-buffer "*vc-change-log*") (vc-exec-after `(let ((inhibit-read-only t) @@ -1872,19 +1876,20 @@ Not all VC backends support short logs!" (set (make-local-variable 'log-view-vc-backend) ',backend) (set (make-local-variable 'log-view-vc-fileset) ',files) - (when (and ,limit (not (eq 'limit-unsupported pl-return))) + (when (and ,limit (not (eq 'limit-unsupported pl-return)) + (not ,is-start-revision)) (goto-char (point-max)) (widget-create 'push-button :notify (lambda (&rest ignore) (vc-print-log-internal - ',backend ',files ',working-revision (* 2 ,limit))) + ',backend ',files ',working-revision (* 2 ,limit) nil)) :help-echo "Show the log again, and double the number of log entries shown" "Show 2X entries") (widget-insert " ") (widget-create 'push-button :notify (lambda (&rest ignore) (vc-print-log-internal - ',backend ',files ',working-revision nil)) + ',backend ',files ',working-revision nil nil)) :help-echo "Show the log again, showing all entries" "Show unlimited entries") (widget-setup)) @@ -1918,7 +1923,7 @@ If WORKING-REVISION is non-nil, leave th (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 limit))) + (vc-print-log-internal backend files working-revision limit nil))) ;;;###autoload (defun vc-print-root-log (&optional limit) @@ -1943,7 +1948,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 limit))) + (vc-print-log-internal backend (list rootdir) working-revision limit nil))) ;;;###autoload (defun vc-revert ()