Function: vc-release-greater-or-equal
vc-release-greater-or-equal is a byte-compiled function defined in
vc-rcs.el.gz.
Signature
(vc-release-greater-or-equal R1 R2)
Documentation
Compare release numbers, represented as strings.
Release components are assumed cardinal numbers, not decimal fractions
(5.10 is a higher release than 5.9). Omitted fields are considered
lower (5.6.7 is earlier than 5.6.7.1). Comparison runs till the end
of the string is found, or a non-numeric component shows up (5.6.7 is
earlier than "5.6.7 beta", which is probably not what you want in
some cases). This code is suitable for existing RCS release numbers.
CVS releases are handled reasonably, too (1.3 < 1.4* < 1.5).
Source Code
;; Defined in /usr/src/emacs/lisp/vc/vc-rcs.el.gz
(defun vc-release-greater-or-equal (r1 r2)
"Compare release numbers, represented as strings.
Release components are assumed cardinal numbers, not decimal fractions
\(5.10 is a higher release than 5.9). Omitted fields are considered
lower \(5.6.7 is earlier than 5.6.7.1). Comparison runs till the end
of the string is found, or a non-numeric component shows up \(5.6.7 is
earlier than \"5.6.7 beta\", which is probably not what you want in
some cases). This code is suitable for existing RCS release numbers.
CVS releases are handled reasonably, too \(1.3 < 1.4* < 1.5)."
(let (v1 v2 i1 i2)
(catch 'done
(or (and (string-match "^\\.?\\([0-9]+\\)" r1)
(setq i1 (match-end 0))
(setq v1 (string-to-number (match-string 1 r1)))
(or (and (string-match "^\\.?\\([0-9]+\\)" r2)
(setq i2 (match-end 0))
(setq v2 (string-to-number (match-string 1 r2)))
(if (> v1 v2) (throw 'done t)
(if (< v1 v2) (throw 'done nil)
(throw 'done
(vc-release-greater-or-equal
(substring r1 i1)
(substring r2 i2)))))))
(throw 'done t)))
(or (and (string-match "^\\.?\\([0-9]+\\)" r2)
(throw 'done nil))
(throw 'done t)))))