Function: vc-annotate-warp-revision

vc-annotate-warp-revision is a byte-compiled function defined in vc-annotate.el.gz.

Signature

(vc-annotate-warp-revision REVSPEC &optional FILE)

Documentation

Annotate the revision described by REVSPEC.

If REVSPEC is a positive integer, warp that many revisions forward, if possible, otherwise echo a warning message. If REVSPEC is a negative integer, warp that many revisions backward, if possible, otherwise echo a warning message. If REVSPEC is a string, then it describes a revision number, so warp to that revision.

Source Code

;; Defined in /usr/src/emacs/lisp/vc/vc-annotate.el.gz
(defun vc-annotate-warp-revision (revspec &optional file)
  "Annotate the revision described by REVSPEC.

If REVSPEC is a positive integer, warp that many revisions forward,
if possible, otherwise echo a warning message.  If REVSPEC is a
negative integer, warp that many revisions backward, if possible,
otherwise echo a warning message.  If REVSPEC is a string, then it
describes a revision number, so warp to that revision."
  (if (not (equal major-mode 'vc-annotate-mode))
      (message "Cannot be invoked outside of a vc annotate buffer")
    (let* ((buf (current-buffer))
	   (oldline (line-number-at-pos))
	   (revspeccopy revspec)
	   (newrev nil))
      (cond
       ((and (integerp revspec) (> revspec 0))
	(setq newrev vc-annotate-parent-rev)
	(while (and (> revspec 0) newrev)
          (setq newrev (vc-call-backend vc-annotate-backend 'next-revision
                                        (or file vc-annotate-parent-file) newrev))
          (setq revspec (1- revspec)))
	(unless newrev
	  (message "Cannot increment %d revisions from revision %s"
		   revspeccopy vc-annotate-parent-rev)))
       ((and (integerp revspec) (< revspec 0))
	(setq newrev vc-annotate-parent-rev)
	(while (and (< revspec 0) newrev)
          (setq newrev (vc-call-backend vc-annotate-backend 'previous-revision
                                        (or file vc-annotate-parent-file) newrev))
          (setq revspec (1+ revspec)))
	(unless newrev
	  (message "Cannot decrement %d revisions from revision %s"
		   (- 0 revspeccopy) vc-annotate-parent-rev)))
       ((stringp revspec) (setq newrev revspec))
       (t (error "Invalid argument to vc-annotate-warp-revision")))
      (when newrev
	(vc-annotate (or file vc-annotate-parent-file) newrev
                     vc-annotate-parent-display-mode
                     buf
		     ;; Pass the current line so that vc-annotate will
		     ;; place the point in the line.
		     (min oldline (progn (goto-char (point-max))
                                         (forward-line -1)
                                         (line-number-at-pos)))
		     vc-annotate-backend)))))