Function: vc-rcs-previous-revision

vc-rcs-previous-revision is a byte-compiled function defined in vc-rcs.el.gz.

Signature

(vc-rcs-previous-revision FILE REV)

Documentation

Return the revision number immediately preceding REV for FILE, or nil if there is no previous revision. This default implementation works for MAJOR.MINOR-style revision numbers as used by RCS and CVS.

Source Code

;; Defined in /usr/src/emacs/lisp/vc/vc-rcs.el.gz
(defun vc-rcs-previous-revision (_file rev)
  "Return the revision number immediately preceding REV for FILE,
or nil if there is no previous revision.  This default
implementation works for MAJOR.MINOR-style revision numbers as
used by RCS and CVS."
  (let ((branch (vc-rcs-branch-part rev))
        (minor-num (string-to-number (vc-rcs-minor-part rev))))
    (when branch
      (if (> minor-num 1)
          ;; revision does probably not start a branch or release
          (concat branch "." (number-to-string (1- minor-num)))
        (if (vc-rcs-trunk-p rev)
            ;; we are at the beginning of the trunk --
            ;; don't know anything to return here
            nil
          ;; we are at the beginning of a branch --
          ;; return revision of starting point
          (vc-rcs-branch-part branch))))))