Function: vc-bzr-print-log

vc-bzr-print-log is a byte-compiled function defined in vc-bzr.el.gz.

Signature

(vc-bzr-print-log FILES BUFFER &optional SHORTLOG START-REVISION LIMIT)

Documentation

Print commit log associated with FILES into specified BUFFER.

If SHORTLOG is non-nil, use --line format. If START-REVISION is non-nil, it is the newest revision to show. If LIMIT is non-nil, show no more than this many entries.

Source Code

;; Defined in /usr/src/emacs/lisp/vc/vc-bzr.el.gz
(defun vc-bzr-print-log (files buffer &optional shortlog start-revision limit)
  "Print commit log associated with FILES into specified BUFFER.
If SHORTLOG is non-nil, use --line format.
If START-REVISION is non-nil, it is the newest revision to show.
If LIMIT is non-nil, show no more than this many entries."
  ;; `vc-do-command' creates the buffer, but we need it before running
  ;; the command.
  (vc-setup-buffer buffer)
  ;; If the buffer exists from a previous invocation it might be
  ;; read-only.
  ;; FIXME: `vc-bzr-command' runs `bzr log' with `LC_MESSAGES=C', so
  ;; the log display may not what the user wants - but I see no other
  ;; way of getting the above regexps working.
  (with-current-buffer buffer
    (apply #'vc-bzr-command "log" buffer 'async files
	   (append
	    (if shortlog '("--line") '("--long"))
	    ;; The extra complications here when start-revision and limit
	    ;; are set are due to bzr log's --forward argument, which
	    ;; could be enabled via an alias in bazaar.conf.
	    ;; Svn, for example, does not have this problem, because
	    ;; it doesn't have --forward.  Instead, you can use
	    ;; svn --log -r HEAD:0 or -r 0:HEAD as you prefer.
	    ;; Bzr, however, insists in -r X..Y that X come before Y.
	    (if start-revision
		(list (format
		       (if (and limit (= limit 1))
			   ;; This means we don't have to use --no-aliases.
			   ;; Is -c any different to -r in this case?
			   "-r%s"
			 "-r..%s")
		       start-revision)))
            (if (eq vc-log-view-type 'with-diff) (list "-p"))
	    (when limit (list "-l" (format "%s" limit)))
	    ;; There is no sensible way to combine --limit and --forward,
	    ;; and it breaks the meaning of START-REVISION as the
	    ;; _newest_ revision.  See bug#14168.
	    ;; Eg bzr log --forward -r ..100 --limit 50 prints
	    ;; revisions 1-50 rather than 50-100.  There
	    ;; seems no way in general to get bzr to print revisions
	    ;; 50-100 in --forward order in that case.
	    ;; FIXME There may be other alias stuff we want to keep.
	    ;; Is there a way to just suppress --forward?
	    ;; As of 2013/4 the only caller uses limit = 1, so it does
	    ;; not matter much.
	    (and start-revision limit (> limit 1) '("--no-aliases"))
	    (if (stringp vc-bzr-log-switches)
		(list vc-bzr-log-switches)
	      vc-bzr-log-switches)))))