Function: vc-hg-print-log
vc-hg-print-log is a byte-compiled function defined in vc-hg.el.gz.
Signature
(vc-hg-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 a short format based on vc-hg-root-log-format.
If LIMIT is a positive integer, show no more than that many entries.
If LIMIT is a non-empty string, use it as a base revision.
If START-REVISION is nil, print the commit log starting from the working directory parent (revset "."). If START-REVISION is a string, print the log starting from that revision.
Source Code
;; Defined in /usr/src/emacs/lisp/vc/vc-hg.el.gz
(defun vc-hg-print-log (files buffer &optional shortlog start-revision limit)
"Print commit log associated with FILES into specified BUFFER.
If SHORTLOG is non-nil, use a short format based on `vc-hg-root-log-format'.
If LIMIT is a positive integer, show no more than that many entries.
If LIMIT is a non-empty string, use it as a base revision.
If START-REVISION is nil, print the commit log starting from the working
directory parent (revset \".\"). If START-REVISION is a string, print
the log starting from that revision."
;; `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.
(let ((inhibit-read-only t)
;; Normalize START-REVISION parameter.
(start (if (member start-revision '(nil ""))
"."
start-revision)))
(with-current-buffer buffer
(apply #'vc-hg-command buffer 'async files "log"
;; With Mercurial logs there are are, broadly speaking, two
;; kinds of ranges of revisions for the log to show:
;; - ranges by revision number: -rN:M
;; - ranges according to the DAG: -rN::M or -rN..M
;; Note that N and M can be revision numbers or changeset
;; IDs (hashes). In either case a revision number range
;; includes those commits with revision numbers between the
;; revision numbers of the commits identified by N and M.
;; See <https://repo.mercurial-scm.org/hg/help/revsets>.
;;
;; DAG ranges are not the same as Git's double-dot ranges.
;; Git's 'x..y' is more like Mercurial's 'only(y, x)' than
;; it is like Mercurial's x::y. In addition, with -rN::M,
;; commits from other branches aren't included in the log.
;;
;; VC has always used ranges by revision numbers, such that
;; commits from all branches are included in the log.
(cond ((not (stringp limit))
(format "-r%s:0" start))
((cl-intersection vc-log-view-types
'(log-outgoing log-unintegrated))
(format "-rreverse(only(%s, %s))" start limit))
(t
(format "-r%s:%s & !%s" start limit limit)))
(nconc
(and (numberp limit)
(list "-l" (format "%s" limit)))
(and (memq 'with-diff vc-log-view-types)
(list "-p"))
(if shortlog
`(,@(and vc-hg-log-graph '("--graph"))
"--template"
,(car vc-hg-root-log-format))
`("--template" ,vc-hg-log-format))
vc-hg-log-switches)))))