;;; vc-src.el --- support for SRC version-control -*- lexical-binding:t -*-
-;; Copyright (C) 1992-2014 Free Software Foundation, Inc.
+;; Copyright (C) 1992-2016 Free Software Foundation, Inc.
;; Author: FSF (see vc.el for full credits)
;; Maintainer: Eric S. Raymond <esr@thyrsus.com>
;; STATE-QUERYING FUNCTIONS
;; * registered (file) OK
;; * state (file) OK
-;; * dir-status (dir update-function) OK
-;; - dir-status-files (dir files ds uf) ??
+;; - dir-status-files (dir files uf) OK
;; - dir-extra-headers (dir) NOT NEEDED
;; - dir-printer (fileinfo) ??
;; * working-revision (file) OK
-;; - latest-on-branch-p (file) ??
;; * checkout-model (files) OK
;; - mode-line-string (file) NOT NEEDED
;; STATE-CHANGING FUNCTIONS
;; * find-revision (file rev buffer) OK
;; * checkout (file &optional rev) OK
;; * revert (file &optional contents-done) OK
-;; - rollback (files) NOT NEEDED
;; - merge (file rev1 rev2) NOT NEEDED
;; - merge-news (file) NOT NEEDED
;; - steal-lock (file &optional revision) NOT NEEDED
;; - previous-revision (file rev) ??
;; - next-revision (file rev) ??
;; - check-headers () ??
-;; - clear-headers () ??
;; - delete-file (file) ??
;; * rename-file (old new) OK
;; - find-file-hook () NOT NEEDED
(autoload 'vc-expand-dirs "vc")
-(defun vc-src-dir-status (dir update-function)
- ;; FIXME: this function should be rewritten or `vc-expand-dirs'
- ;; should be changed to take a backend parameter. Using
- ;; `vc-expand-dirs' is not TRTD because it returns files from
- ;; multiple backends. It should also return 'unregistered files.
-
+(defun vc-src-dir-status-files (dir files update-function)
;; FIXME: Use one src status -a call for this
- (let ((flist (vc-expand-dirs (list dir)))
- (result nil))
- (dolist (file flist)
+ (if (not files) (setq files (vc-expand-dirs (list dir) 'RCS)))
+ (let ((result nil))
+ (dolist (file files)
(let ((state (vc-state file))
(frel (file-relative-name file)))
(when (and (eq (vc-backend file) 'SRC)
(defun vc-src-command (buffer file-or-list &rest flags)
"A wrapper around `vc-do-command' for use in vc-src.el.
This function differs from vc-do-command in that it invokes `vc-src-program'."
- (apply 'vc-do-command (or buffer "*vc*") 0 vc-src-program file-or-list flags))
+ (let (file-list)
+ (cond ((stringp file-or-list)
+ (setq file-list (list "--" file-or-list)))
+ (file-or-list
+ (setq file-list (cons "--" file-or-list))))
+ (apply 'vc-do-command (or buffer "*vc*") 0 vc-src-program file-list flags)))
(defun vc-src-working-revision (file)
"SRC-specific version of `vc-working-revision'."
- (or (ignore-errors
- (with-output-to-string
- (vc-src-command standard-output file "list" "-f{1}" "@")))
- "0"))
+ (let ((result (ignore-errors
+ (with-output-to-string
+ (vc-src-command standard-output file "list" "-f{1}" "@")))))
+ (if (zerop (length result)) "0" result)))
;;;
;;; State-changing functions
file
(file-name-directory file)))))
-(defun vc-src-checkin (files comment)
+(defun vc-src-checkin (files comment &optional _rev)
"SRC-specific version of `vc-backend-checkin'.
REV is ignored."
(vc-src-command nil files "commit" "-m" comment))
"Revert FILE to the version it was based on. If FILE is a directory,
revert all registered files beneath it."
(if (file-directory-p file)
- (mapc 'vc-src-revert (vc-expand-dirs (list file)))
+ (mapc 'vc-src-revert (vc-expand-dirs (list file) 'SRC))
(vc-src-command nil file "co")))
(defun vc-src-modify-change-comment (files rev comment)
"Modify the change comments change on FILES on a specified REV. If FILE is a
directory the operation is applied to all registered files beneath it."
- (dolist (file (vc-expand-dirs files))
+ (dolist (file (vc-expand-dirs files 'SRC))
(vc-src-command nil file "amend" "-m" comment rev)))
;; History functions
(repeat :tag "Argument List" :value ("") string))
:group 'vc-src)
-(defun vc-src-print-log (files buffer &optional shortlog start-revision limit)
+(defun vc-src-print-log (files buffer &optional shortlog _start-revision limit)
"Print commit log associated with FILES into specified BUFFER.
If SHORTLOG is non-nil, use the list method.
If START-REVISION is non-nil, it is the newest revision to show.
(when limit (list "-l" (format "%s" limit)))
vc-src-log-switches)))))
-(defun vc-src-diff (files &optional _async oldvers newvers buffer)
+(defun vc-src-diff (files &optional oldvers newvers buffer _async)
"Get a difference report using src between two revisions of FILES."
(let* ((firstfile (car files))
(working (and firstfile (vc-working-revision firstfile))))