emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] master 01/01: Remove never-used rev argument from VC's bac


From: Eric S. Raymond
Subject: [Emacs-diffs] master 01/01: Remove never-used rev argument from VC's backend checkin methods.
Date: Thu, 20 Nov 2014 07:39:37 +0000

branch: master
commit f83109f0fabe13c0175ca6fe23b475bd8a9d9d99
Author: Eric S. Raymond <address@hidden>
Date:   Thu Nov 20 02:37:06 2014 -0500

    Remove never-used rev argument from VC's backend checkin methods.
    
    Alters vc/vc-arch.el, vc/vc-bzr.el, vc/vc-cvs.el, vc/vc-dav.el,
    vc/vc-git.el, vc/vc-hg.el, vc/vc-mtn.el, vc/vc-rcs.el,
    vc/vc-sccs.el, vc/vc-svn.el, vc/vc.el.
    
    Only the RCS, SCCS, and CVS back ends tried to do anything with it,
    and that code was never exercised. Chiseling away the cruft of
    decades...
---
 lisp/ChangeLog     |    9 +++++++++
 lisp/vc/vc-arch.el |    3 +--
 lisp/vc/vc-bzr.el  |    6 ++----
 lisp/vc/vc-cvs.el  |   49 +++++++++++++++++++++++++++++++------------------
 lisp/vc/vc-dav.el  |    6 ++----
 lisp/vc/vc-git.el  |    2 +-
 lisp/vc/vc-hg.el   |    4 ++--
 lisp/vc/vc-mtn.el  |    2 +-
 lisp/vc/vc-rcs.el  |   16 ++++++++++------
 lisp/vc/vc-sccs.el |    3 +--
 lisp/vc/vc-svn.el  |    3 +--
 lisp/vc/vc.el      |   28 +++++++++++++---------------
 12 files changed, 74 insertions(+), 57 deletions(-)

diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 6fa23de..2020fd3 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,12 @@
+2014-11-20  Eric S. Raymond  <address@hidden>
+
+       * vc/vc-arch.el, vc/vc-bzr.el, vc/vc-cvs.el, vc/vc-dav.el,
+       vc/vc-git.el, vc/vc-hg.el, vc/vc-mtn.el, vc/vc-rcs.el,
+       vc/vc-sccs.el, vc/vc-svn.el, vc/vc.el: Remove never-used rev
+       argument from the backend checkin methods. Only the RCS, SCCS, and
+       CVS back ends tried to do anything with it, and that code was
+       never exercised. Chiseling away the cruft of decades...
+
 2014-11-19  Lars Magne Ingebrigtsen  <address@hidden>
 
        * net/eww.el (eww-render): Remove a no-op :title setting.
diff --git a/lisp/vc/vc-arch.el b/lisp/vc/vc-arch.el
index 2bc8b7b..53b8e35 100644
--- a/lisp/vc/vc-arch.el
+++ b/lisp/vc/vc-arch.el
@@ -441,8 +441,7 @@ CALLBACK expects (ENTRIES &optional MORE-TO-COME); see
 
 (autoload 'vc-switches "vc")
 
-(defun vc-arch-checkin (files rev comment)
-  (if rev (error "Committing to a specific revision is unsupported"))
+(defun vc-arch-checkin (files comment)
   ;; FIXME: This implementation probably only works for singleton filesets
   (let ((summary (file-relative-name (car files) (vc-arch-root (car files)))))
     ;; Extract a summary from the comment.
diff --git a/lisp/vc/vc-bzr.el b/lisp/vc/vc-bzr.el
index a093bcb..2c1941b 100644
--- a/lisp/vc/vc-bzr.el
+++ b/lisp/vc/vc-bzr.el
@@ -634,10 +634,8 @@ or a superior directory.")
                                            "" (replace-regexp-in-string
                                                "\n[ \t]?" " " str)))))
 
-(defun vc-bzr-checkin (files rev comment)
-  "Check FILES in to bzr with log message COMMENT.
-REV non-nil gets an error."
-  (if rev (error "Can't check in a specific revision with bzr"))
+(defun vc-bzr-checkin (files comment)
+  "Check FILES in to bzr with log message COMMENT."
   (apply 'vc-bzr-command "commit" nil 0 files
          (cons "-m" (log-edit-extract-headers
                      `(("Author" . ,(vc-bzr--sanitize-header "--author"))
diff --git a/lisp/vc/vc-cvs.el b/lisp/vc/vc-cvs.el
index ad5559b..6fbfa72 100644
--- a/lisp/vc/vc-cvs.el
+++ b/lisp/vc/vc-cvs.el
@@ -321,20 +321,38 @@ its parents."
                   (directory-file-name dir))))
     (eq dir t)))
 
-(defun vc-cvs-checkin (files rev comment)
+;; vc-cvs-checkin used to take a 'rev' second argument that allowed
+;; checking in onto a specified branch tip rather than the current
+;; default branch, but nothing in the entire rest of VC exercised
+;; this code.  Removing it simplifies the backend interface for all
+;; modes.
+;;
+;; Here's the setup code preserved in amber, in case the logic needs
+;; to be broken out into a method someday; (if rev (concat "-r" rev))
+;; used to be part of the switches passed to vc-cvs-command.
+;;
+;;  (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 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))
+;;      (mapc (lambda (file) (vc-file-setprop file 'vc-cvs-sticky-tag rev))
+;;         files)))
+;;
+;; The following postamble cleaned up after the branch change:
+;;
+;;    ;; if this was an explicit check-in (does not include creation of
+;;    ;; a branch), remove the sticky tag.
+;;    (if (and rev (not (vc-cvs-valid-symbolic-tag-name-p rev)))
+;;     (vc-cvs-command nil 0 files "update" "-A"))))
+;;       files)))
+;;
+(defun vc-cvs-checkin (files comment)
   "CVS-specific version of `vc-backend-checkin'."
-  (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 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))
-      (mapc (lambda (file) (vc-file-setprop file 'vc-cvs-sticky-tag rev))
-           files)))
   (let ((status (apply 'vc-cvs-command nil 1 files
-                      "ci" (if rev (concat "-r" rev))
-                      (concat "-m" comment)
+                      "ci" (concat "-m" comment)
                       (vc-switches 'CVS 'checkin))))
     (set-buffer "*vc*")
     (goto-char (point-min))
@@ -365,12 +383,7 @@ its parents."
     ;; tell it from the permissions of the file (see
     ;; vc-cvs-checkout-model).
     (mapc (lambda (file) (vc-file-setprop file 'vc-checkout-model nil))
-         files)
-
-    ;; if this was an explicit check-in (does not include creation of
-    ;; a branch), remove the sticky tag.
-    (if (and rev (not (vc-cvs-valid-symbolic-tag-name-p rev)))
-       (vc-cvs-command nil 0 files "update" "-A"))))
+         files)))
 
 (defun vc-cvs-find-revision (file rev buffer)
   (apply 'vc-cvs-command
diff --git a/lisp/vc/vc-dav.el b/lisp/vc/vc-dav.el
index 9b67d74..77979d6 100644
--- a/lisp/vc/vc-dav.el
+++ b/lisp/vc/vc-dav.el
@@ -82,10 +82,8 @@ See `vc-checkout-model' for a list of possible values."
   ;; Do we need to do anything here?  FIXME?
   )
 
-(defun vc-dav-checkin (url rev comment)
-  "Commit changes in URL to WebDAV.
-If REV is non-nil, that should become the new revision number.
-COMMENT is used as a check-in comment."
+(defun vc-dav-checkin (url comment)
+  "Commit changes in URL to WebDAV. COMMENT is used as a check-in comment."
   ;; This should PUT the resource and release any locks that we hold.
   )
 
diff --git a/lisp/vc/vc-git.el b/lisp/vc/vc-git.el
index 3b11a3c..3e45eab 100644
--- a/lisp/vc/vc-git.el
+++ b/lisp/vc/vc-git.el
@@ -665,7 +665,7 @@ If toggling on, also insert its message into the buffer."
   "Major mode for editing Git log messages.
 It is based on `log-edit-mode', and has Git-specific extensions.")
 
-(defun vc-git-checkin (files _rev comment)
+(defun vc-git-checkin (files comment)
   (let* ((file1 (or (car files) default-directory))
          (root (vc-git-root file1))
          (default-directory (expand-file-name root))
diff --git a/lisp/vc/vc-hg.el b/lisp/vc/vc-hg.el
index 4f13914..583fa6c 100644
--- a/lisp/vc/vc-hg.el
+++ b/lisp/vc/vc-hg.el
@@ -407,7 +407,7 @@ Optional arg REVISION is a revision to annotate from."
     (and (vc-hg-command nil 0 nil "status")
          (vc-hg-command nil 0 nil (if branchp "bookmark" "tag") name))))
 
-(defun vc-hg-retrieve-tag (dir name update)
+(defun vc-hg-retrieve-tag (dir name _update)
   "Retrieve the version tagged by NAME of all registered files at or below 
DIR."
   (let ((default-directory dir))
     (vc-hg-command nil 0 nil "update" name)
@@ -477,7 +477,7 @@ COMMENT is ignored."
 
 (declare-function log-edit-extract-headers "log-edit" (headers string))
 
-(defun vc-hg-checkin (files _rev comment)
+(defun vc-hg-checkin (files comment)
   "Hg-specific version of `vc-backend-checkin'.
 REV is ignored."
   (apply 'vc-hg-command nil 0 files
diff --git a/lisp/vc/vc-mtn.el b/lisp/vc/vc-mtn.el
index ea071c8..fdaca54 100644
--- a/lisp/vc/vc-mtn.el
+++ b/lisp/vc/vc-mtn.el
@@ -187,7 +187,7 @@ If nil, use the value of `vc-diff-switches'.  If t, use no 
switches."
 
 (declare-function log-edit-extract-headers "log-edit" (headers string))
 
-(defun vc-mtn-checkin (files _rev comment)
+(defun vc-mtn-checkin (files comment)
   (apply 'vc-mtn-command nil 0 files
         (nconc (list "commit" "-m")
                (log-edit-extract-headers '(("Author" . "--author")
diff --git a/lisp/vc/vc-rcs.el b/lisp/vc/vc-rcs.el
index 57515d0..4b06b09 100644
--- a/lisp/vc/vc-rcs.el
+++ b/lisp/vc/vc-rcs.el
@@ -358,23 +358,27 @@ whether to remove it."
         (yes-or-no-p (format "Directory %s is empty; remove it? " dir))
         (delete-directory dir))))
 
-(defun vc-rcs-checkin (files rev comment)
+;; It used to be possible to pass in a value for the variable rev, but
+;; nothing in the rest of VC used this capability.  Removing it makes the
+;; backend interface simpler for all modes.
+;;
+(defun vc-rcs-checkin (files comment)
   "RCS-specific version of `vc-backend-checkin'."
-  (let ((switches (vc-switches 'RCS 'checkin)))
+  (let (rev (switches (vc-switches 'RCS 'checkin)))
     ;; Now operate on the files
     (dolist (file (vc-expand-dirs files))
       (let ((old-version (vc-working-revision file)) new-version
            (default-branch (vc-file-getprop file 'vc-rcs-default-branch)))
        ;; Force branch creation if an appropriate
        ;; default branch has been set.
-       (and (not rev)
-            default-branch
+       (and default-branch
             (string-match (concat "^" (regexp-quote old-version) "\\.")
                           default-branch)
             (setq rev default-branch)
             (setq switches (cons "-f" switches)))
-       (if (and (not rev) old-version)
-           (setq rev (vc-branch-part old-version)))
+       (if old-version
+           (setq rev (vc-branch-part old-version))
+         (error "can't find current branch"))
        (apply #'vc-do-command "*vc*" 0 "ci" (vc-name file)
               ;; if available, use the secure check-in option
               (and (vc-rcs-release-p "5.6.4") "-j")
diff --git a/lisp/vc/vc-sccs.el b/lisp/vc/vc-sccs.el
index fb7d959..db777ab 100644
--- a/lisp/vc/vc-sccs.el
+++ b/lisp/vc/vc-sccs.el
@@ -253,11 +253,10 @@ expanded if `vc-keep-workfiles' is non-nil, otherwise, 
delete the workfile."
       (stringp (vc-sccs-search-project-dir (or (file-name-directory file) "")
                                           (file-name-nondirectory file)))))
 
-(defun vc-sccs-checkin (files rev comment)
+(defun vc-sccs-checkin (files comment)
   "SCCS-specific version of `vc-backend-checkin'."
   (dolist (file (vc-expand-dirs files))
     (apply 'vc-sccs-do-command nil 0 "delta" (vc-name file)
-          (if rev (concat "-r" rev))
           (concat "-y" comment)
           (vc-switches 'SCCS 'checkin))
     (if vc-keep-workfiles
diff --git a/lisp/vc/vc-svn.el b/lisp/vc/vc-svn.el
index c7568e4..bd22fbf 100644
--- a/lisp/vc/vc-svn.el
+++ b/lisp/vc/vc-svn.el
@@ -316,9 +316,8 @@ to the SVN command."
   "Return non-nil if FILE could be registered in SVN.
 This is only possible if SVN is responsible for FILE's directory.")
 
-(defun vc-svn-checkin (files rev comment &optional _extra-args-ignored)
+(defun vc-svn-checkin (files comment &optional _extra-args-ignored)
   "SVN-specific version of `vc-backend-checkin'."
-  (if rev (error "Committing to a specific revision is unsupported in SVN"))
   (let ((status (apply
                  'vc-svn-command nil 1 files "ci"
                  (nconc (list "-m" comment) (vc-switches 'SVN 'checkin)))))
diff --git a/lisp/vc/vc.el b/lisp/vc/vc.el
index 0838491..2efa450 100644
--- a/lisp/vc/vc.el
+++ b/lisp/vc/vc.el
@@ -72,7 +72,7 @@
 ;; When using Subversion or a later system, anything you do outside VC
 ;; *through the VCS tools* should safely interlock with VC
 ;; operations. Under these VC does little state caching, because local
-;; operations are assumed to be fast.  The dividing line is
+;; operations are assumed to be fast.
 ;;
 ;; ADDING SUPPORT FOR OTHER BACKENDS
 ;;
@@ -267,12 +267,12 @@
 ;;   Unregister FILE from this backend.  This is only needed if this
 ;;   backend may be used as a "more local" backend for temporary editing.
 ;;
-;; * checkin (files rev comment)
+;; * checkin (files comment)
 ;;
-;;   Commit changes in FILES to this backend.  REV is a historical artifact
-;;   and should be ignored.  COMMENT is used as a check-in comment.
-;;   The implementation should pass the value of vc-checkin-switches to
-;;   the backend command.
+;;   Commit changes in FILES to this backend. COMMENT is used as a
+;;   check-in comment.  The implementation should pass the value of
+;;   vc-checkin-switches to the backend command.  The revision argument
+;;   of some older VC versions is no longer supported.
 ;;
 ;; * find-revision (file rev buffer)
 ;;
@@ -1498,13 +1498,11 @@ Type \\[vc-next-action] to check in changes.")
      ".\n")
     (message "Please explain why you stole the lock.  Type C-c C-c when 
done.")))
 
-(defun vc-checkin (files backend &optional rev comment initial-contents)
-  "Check in FILES.
-The optional argument REV may be a string specifying the new revision
-level (strongly deprecated).  COMMENT is a comment
-string; if omitted, a buffer is popped up to accept a comment.  If
-INITIAL-CONTENTS is non-nil, then COMMENT is used as the initial contents
-of the log entry buffer.
+(defun vc-checkin (files backend &optional comment initial-contents)
+  "Check in FILES. COMMENT is a comment string; if omitted, a
+buffer is popped up to accept a comment.  If INITIAL-CONTENTS is
+non-nil, then COMMENT is used as the initial contents of the log
+entry buffer.
 
 If `vc-keep-workfiles' is nil, FILE is deleted afterwards, provided
 that the version control system supports this mode of operation.
@@ -1530,7 +1528,7 @@ Runs the normal hooks `vc-before-checkin-hook' and 
`vc-checkin-hook'."
        ;; vc-checkin-switches, but 'the' local buffer is
        ;; not a well-defined concept for filesets.
        (progn
-         (vc-call-backend backend 'checkin files rev comment)
+         (vc-call-backend backend 'checkin files comment)
          (mapc 'vc-delete-automatic-version-backups files))
        `((vc-state . up-to-date)
          (vc-checkout-time . ,(nth 5 (file-attributes file)))
@@ -2686,7 +2684,7 @@ backend to NEW-BACKEND, and unregister FILE from the 
current backend.
     (when (or move edited)
       (vc-file-setprop file 'vc-state 'edited)
       (vc-mode-line file new-backend)
-      (vc-checkin file new-backend nil comment (stringp comment)))))
+      (vc-checkin file new-backend comment (stringp comment)))))
 
 (defun vc-rename-master (oldmaster newfile templates)
   "Rename OLDMASTER to be the master file for NEWFILE based on TEMPLATES."



reply via email to

[Prev in Thread] Current Thread [Next in Thread]