]> code.delx.au - gnu-emacs/blobdiff - lisp/vc/vc-src.el
Update copyright year to 2016
[gnu-emacs] / lisp / vc / vc-src.el
index c93ff96fd29112ef5b3a1d912d24709d3ca6fd7f..23290428043a6fce4e51d5545c5ec569d8b5c313 100644 (file)
@@ -1,6 +1,6 @@
 ;;; 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
@@ -49,7 +47,6 @@
 ;; * 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
@@ -73,7 +70,6 @@
 ;; - 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
@@ -180,16 +176,11 @@ For a description of possible values, see `vc-check-master-templates'."
 
 (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)
@@ -200,14 +191,19 @@ For a description of possible values, see `vc-check-master-templates'."
 (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
@@ -231,7 +227,7 @@ This function differs from vc-do-command in that it invokes `vc-src-program'."
                                           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))
@@ -254,13 +250,13 @@ REV is the revision to check out into WORKFILE."
   "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
@@ -272,7 +268,7 @@ directory the operation is applied to all registered files beneath it."
                  (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.
@@ -292,7 +288,7 @@ If LIMIT is non-nil, show no more than this many entries."
              (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))))