From: Dan Nicolaescu <dann@ics.uci.edu>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: emacs-devel@gnu.org
Subject: Re: limit the number of log entries displayed by C-x v l
Date: Tue, 17 Nov 2009 05:44:54 -0800 (PST) [thread overview]
Message-ID: <200911171344.nAHDis0c026133@godzilla.ics.uci.edu> (raw)
In-Reply-To: <jwveio2ikne.fsf-monnier+emacs@gnu.org> (Stefan Monnier's message of "Fri, 13 Nov 2009 09:10:55 -0500")
Stefan Monnier <monnier@iro.umontreal.ca> 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 ()
next prev parent reply other threads:[~2009-11-17 13:44 UTC|newest]
Thread overview: 38+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-11-12 23:19 limit the number of log entries displayed by C-x v l Dan Nicolaescu
2009-11-13 1:18 ` Stefan Monnier
2009-11-13 2:21 ` Dan Nicolaescu
2009-11-13 3:19 ` Stefan Monnier
2009-11-13 5:02 ` Dan Nicolaescu
2009-11-13 14:10 ` Stefan Monnier
2009-11-15 20:55 ` Dan Nicolaescu
2009-11-15 21:34 ` Chong Yidong
2009-11-16 9:40 ` Dan Nicolaescu
2009-11-16 14:22 ` Stefan Monnier
2009-11-16 15:10 ` Dan Nicolaescu
2009-11-16 15:41 ` Stefan Monnier
2009-11-16 20:40 ` Dan Nicolaescu
2009-11-17 13:44 ` Dan Nicolaescu [this message]
2009-11-17 19:54 ` Stefan Monnier
2009-11-18 18:19 ` Dan Nicolaescu
2009-11-19 0:52 ` Stefan Monnier
2009-11-19 7:23 ` Thierry Volpiatto
2009-11-20 6:59 ` Dan Nicolaescu
2009-11-20 7:19 ` Thierry Volpiatto
2009-11-20 14:11 ` Stefan Monnier
2009-11-20 15:26 ` Dan Nicolaescu
2009-11-21 4:27 ` Stephen J. Turnbull
2009-11-22 20:12 ` Stefan Monnier
2009-11-22 23:02 ` Štěpán Němec
2009-11-23 2:29 ` Stefan Monnier
2009-11-23 3:49 ` Bob Rogers
2009-11-23 5:17 ` Stefan Monnier
2009-11-22 20:10 ` Stefan Monnier
2009-12-06 17:43 ` Dan Nicolaescu
2009-12-07 2:12 ` Stefan Monnier
2009-11-13 6:59 ` Giorgos Keramidas
2009-11-14 10:10 ` Alfred M. Szmidt
2009-11-14 23:29 ` Richard Stallman
2009-11-14 23:34 ` Andreas Schwab
2009-11-15 22:38 ` Richard Stallman
2009-11-15 22:52 ` Andreas Schwab
2009-11-17 7:56 ` Richard Stallman
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
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200911171344.nAHDis0c026133@godzilla.ics.uci.edu \
--to=dann@ics.uci.edu \
--cc=emacs-devel@gnu.org \
--cc=monnier@iro.umontreal.ca \
/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 public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).