-;;; vc-cvs.el --- non-resident support for CVS version-control
+;;; vc-cvs.el --- non-resident support for CVS version-control -*- lexical-binding: t -*-
-;; Copyright (C) 1995, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
-;; 2006, 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
+;; Copyright (C) 1995, 1998-2013 Free Software Foundation, Inc.
;; Author: FSF (see vc.el for full credits)
;; Maintainer: Andre Spiegel <spiegel@gnu.org>
;;; Code:
-(eval-when-compile (require 'cl) (require 'vc))
+(eval-when-compile (require 'vc))
;; Clear up the cache to force vc-call to check again and discover
;; new functions when we reload this file.
;;; Customization options
;;;
+(defgroup vc-cvs nil
+ "VC CVS backend."
+ :version "24.1"
+ :group 'vc)
+
(defcustom vc-cvs-global-switches nil
"Global switches to pass to any CVS command."
:type '(choice (const :tag "None" nil)
:value ("")
string))
:version "22.1"
- :group 'vc)
+ :group 'vc-cvs)
(defcustom vc-cvs-register-switches nil
"Switches for registering a file into CVS.
(string :tag "Argument String")
(repeat :tag "Argument List" :value ("") string))
:version "21.1"
- :group 'vc)
+ :group 'vc-cvs)
(defcustom vc-cvs-diff-switches nil
"String or list of strings specifying switches for CVS diff under VC.
(string :tag "Argument String")
(repeat :tag "Argument List" :value ("") string))
:version "21.1"
- :group 'vc)
+ :group 'vc-cvs)
(defcustom vc-cvs-header '("\$Id\$")
"Header keywords to be inserted by `vc-insert-headers'."
:version "24.1" ; no longer consult the obsolete vc-header-alist
:type '(repeat string)
- :group 'vc)
+ :group 'vc-cvs)
(defcustom vc-cvs-use-edit t
"Non-nil means to use `cvs edit' to \"check out\" a file.
\(i.e. if you have $CVSREAD set)."
:type 'boolean
:version "21.1"
- :group 'vc)
+ :group 'vc-cvs)
(defcustom vc-cvs-stay-local 'only-file
"Non-nil means use local operations when possible for remote repositories.
:tag "if it matches")
(repeat :format "%v%i\n" :inline t (regexp :tag "or"))))
:version "23.1"
- :group 'vc)
+ :group 'vc-cvs)
(defcustom vc-cvs-sticky-date-format-string "%c"
"Format string for mode-line display of sticky date.
`vc-cvs-sticky-tag-display' is t."
:type '(string)
:version "22.1"
- :group 'vc)
+ :group 'vc-cvs)
(defcustom vc-cvs-sticky-tag-display t
"Specify the mode-line display of sticky tags.
See also variable `vc-cvs-sticky-date-format-string'."
:type '(choice boolean function)
:version "22.1"
- :group 'vc)
+ :group 'vc-cvs)
;;;
;;; Internal variables
;;; State-querying functions
;;;
-;;;###autoload (defun vc-cvs-registered (f)
+;;;###autoload(defun vc-cvs-registered (f)
+;;;###autoload "Return non-nil if file F is registered with CVS."
;;;###autoload (when (file-readable-p (expand-file-name
;;;###autoload "CVS/Entries" (file-name-directory f)))
-;;;###autoload (load "vc-cvs")
+;;;###autoload (load "vc-cvs" nil t)
;;;###autoload (vc-cvs-registered f)))
(defun vc-cvs-registered (file)
(vc-file-getprop file 'vc-working-revision))
(defun vc-cvs-mode-line-string (file)
- "Return string for placement into the modeline for FILE.
+ "Return a string for `vc-mode-line' to put in the mode line for FILE.
Compared to the default implementation, this function does two things:
Handle the special case of a CVS file that is added but not yet
committed and support display of sticky tags."
;;; State-changing functions
;;;
-(defun vc-cvs-register (files &optional rev comment)
+(defun vc-cvs-register (files &optional _rev comment)
"Register FILES into the CVS version-control system.
COMMENT can be used to provide an initial description of FILES.
Passes either `vc-cvs-register-switches' or `vc-register-switches'
(unless (or (not rev) (vc-cvs-valid-revision-number-p rev))
(if (not (vc-cvs-valid-symbolic-tag-name-p rev))
(error "%s is not a valid symbolic tag name" rev)
- ;; If the input revison is a valid symbolic tag name, we create it
+ ;; If the input revision is a valid symbolic tag name, we create it
;; as a branch, commit and switch to it.
(apply 'vc-cvs-command nil 0 files "tag" "-b" (list rev))
(apply 'vc-cvs-command nil 0 files "update" "-r" (list rev))
(if vc-cvs-use-edit
(vc-cvs-command nil 0 file "edit")
(set-file-modes file (logior (file-modes file) 128))
- (if (equal file buffer-file-name) (toggle-read-only -1))))
+ (if (equal file buffer-file-name) (read-only-mode -1))))
;; Check out a particular revision (or recreate the file).
(vc-file-setprop file 'vc-working-revision nil)
(apply 'vc-cvs-command nil 0 file
(declare-function vc-rcs-print-log-cleanup "vc-rcs" ())
-(defun vc-cvs-print-log (files buffer &optional shortlog start-revision-ignored limit)
+(defun vc-cvs-print-log (files buffer &optional _shortlog _start-revision limit)
"Get change logs associated with FILES."
(require 'vc-rcs)
;; It's just the catenation of the individual logs.
((= len 3)
;; :METHOD:PATH or :METHOD:USER@HOSTNAME/PATH
(cons (cadr root-list)
- (vc-cvs-parse-uhp (caddr root-list))))
+ (vc-cvs-parse-uhp (nth 2 root-list))))
(t
;; :METHOD:[USER@]HOST:PATH
(cdr root-list)))))
(vc-exec-after
`(vc-cvs-after-dir-status (quote ,update-function))))))
-(defun vc-cvs-dir-status-files (dir files default-state update-function)
+(defun vc-cvs-dir-status-files (dir files _default-state update-function)
"Create a list of conses (file . state) for DIR."
(apply 'vc-cvs-command (current-buffer) 'async dir "-f" "status" files)
(vc-exec-after
(buffer-substring (point) (point-max)))
(file-error nil)))
-(defun vc-cvs-dir-extra-headers (dir)
+(defun vc-cvs-dir-extra-headers (_dir)
"Extract and represent per-directory properties of a CVS working copy."
(let ((repo
(condition-case nil
(parse-time-string (concat time " +0000")))))
(cond ((and (not (string-match "\\+" time))
(car parsed-time)
- (equal mtime (apply 'encode-time parsed-time)))
+ ;; Compare just the seconds part of the file time,
+ ;; since CVS file time stamp resolution is just 1 second.
+ (let ((ptime (apply 'encode-time parsed-time)))
+ (and (eq (car mtime) (car ptime))
+ (eq (cadr mtime) (cadr ptime)))))
(vc-file-setprop file 'vc-checkout-time mtime)
(if set-state (vc-file-setprop file 'vc-state 'up-to-date)))
(t
res)))
(defun vc-cvs-revision-completion-table (files)
- (lexical-let ((files files)
- table)
- (setq table (lazy-completion-table
- table (lambda () (vc-cvs-revision-table (car files)))))
+ (letrec ((table (lazy-completion-table
+ table (lambda () (vc-cvs-revision-table (car files))))))
table))
(provide 'vc-cvs)
-;; arch-tag: 60e1402a-aa53-4607-927a-cf74f144b432
;;; vc-cvs.el ends here