emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] master 01/01: Remove editable argument from VC's backend c


From: Eric S. Raymond
Subject: [Emacs-diffs] master 01/01: Remove editable argument from VC's backend checkout methods.
Date: Thu, 20 Nov 2014 09:01:44 +0000

branch: master
commit e7e9dbccb05175a512c40a3f433887c40abaa469
Author: Eric S. Raymond <address@hidden>
Date:   Thu Nov 20 03:52:24 2014 -0500

    Remove editable argument from VC's backend checkout methods.
    
    Alters 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.
    
    where this matters (which is only in SCCS and RCS) files are now always
    checked out editable. This may actually have been dynamically true
    already - it looks like the vc-next-action code evolved past visiting
    the other case. Tested with RCS.
---
 lisp/ChangeLog     |    8 ++++++++
 lisp/vc/vc-bzr.el  |    2 +-
 lisp/vc/vc-cvs.el  |    7 +++----
 lisp/vc/vc-dav.el  |    2 +-
 lisp/vc/vc-git.el  |    4 ++--
 lisp/vc/vc-hg.el   |    4 ++--
 lisp/vc/vc-mtn.el  |    2 +-
 lisp/vc/vc-rcs.el  |    4 ++--
 lisp/vc/vc-sccs.el |    4 ++--
 lisp/vc/vc-svn.el  |    6 +++---
 lisp/vc/vc.el      |   49 ++++++++++++++++++++++++-------------------------
 11 files changed, 49 insertions(+), 43 deletions(-)

diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 2020fd3..473a1f8 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,5 +1,13 @@
 2014-11-20  Eric S. Raymond  <address@hidden>
 
+       * 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 editable argument from the backend
+       checkout methods; where it matters (which is only in SCCS and RCS)
+       files are always checked out editable. This may actually have
+       been dynamically true already - it looks like the vc-next-action
+       code evolved past visiting the other case. Tested with RCS.
+
        * 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
diff --git a/lisp/vc/vc-bzr.el b/lisp/vc/vc-bzr.el
index 2c1941b..073c355 100644
--- a/lisp/vc/vc-bzr.el
+++ b/lisp/vc/vc-bzr.el
@@ -655,7 +655,7 @@ or a superior directory.")
   (expand-file-name ".bzrignore"
                    (vc-bzr-root file)))
 
-(defun vc-bzr-checkout (_file &optional _editable rev)
+(defun vc-bzr-checkout (_file &optional rev)
   (if rev (error "Operation not supported")
     ;; Else, there's nothing to do.
     nil))
diff --git a/lisp/vc/vc-cvs.el b/lisp/vc/vc-cvs.el
index 6fbfa72..4bce79c 100644
--- a/lisp/vc/vc-cvs.el
+++ b/lisp/vc/vc-cvs.el
@@ -395,9 +395,8 @@ its parents."
         "-p"
         (vc-switches 'CVS 'checkout)))
 
-(defun vc-cvs-checkout (file &optional editable rev)
+(defun vc-cvs-checkout (file &optional rev)
   "Checkout a revision of FILE into the working area.
-EDITABLE non-nil means that the file should be writable.
 REV is the revision to check out."
   (message "Checking out %s..." file)
   ;; Change buffers to get local value of vc-checkout-switches.
@@ -405,7 +404,7 @@ REV is the revision to check out."
     (if (and (file-exists-p file) (not rev))
         ;; If no revision was specified, just make the file writable
         ;; if necessary (using `cvs-edit' if requested).
-        (and editable (not (eq (vc-cvs-checkout-model (list file)) 'implicit))
+        (and (not (eq (vc-cvs-checkout-model (list file)) 'implicit))
              (if vc-cvs-use-edit
                  (vc-cvs-command nil 0 file "edit")
                (set-file-modes file (logior (file-modes file) 128))
@@ -413,7 +412,7 @@ REV is the revision to check out."
       ;; Check out a particular revision (or recreate the file).
       (vc-file-setprop file 'vc-working-revision nil)
       (apply 'vc-cvs-command nil 0 file
-             (and editable "-w")
+             "-w"
              "update"
              (when rev
                (unless (eq rev t)
diff --git a/lisp/vc/vc-dav.el b/lisp/vc/vc-dav.el
index 77979d6..df7801f 100644
--- a/lisp/vc/vc-dav.el
+++ b/lisp/vc/vc-dav.el
@@ -87,7 +87,7 @@ See `vc-checkout-model' for a list of possible values."
   ;; This should PUT the resource and release any locks that we hold.
   )
 
-(defun vc-dav-checkout (url &optional editable rev destfile)
+(defun vc-dav-checkout (url &optional rev destfile)
   "Check out revision REV of URL into the working area.
 
 If EDITABLE is non-nil URL should be writable by the user and if
diff --git a/lisp/vc/vc-git.el b/lisp/vc/vc-git.el
index 3e45eab..7509890 100644
--- a/lisp/vc/vc-git.el
+++ b/lisp/vc/vc-git.el
@@ -66,7 +66,7 @@
 ;; - unregister (file)                             OK
 ;; * checkin (files rev comment)                   OK
 ;; * find-revision (file rev buffer)               OK
-;; * checkout (file &optional editable rev)        OK
+;; * checkout (file &optional rev)                 OK
 ;; * revert (file &optional contents-done)         OK
 ;; - rollback (files)                              COULD BE SUPPORTED
 ;; - merge (file rev1 rev2)                   It would be possible to merge
@@ -709,7 +709,7 @@ It is based on `log-edit-mode', and has Git-specific 
extensions.")
   (expand-file-name ".gitignore"
                    (vc-git-root file)))
 
-(defun vc-git-checkout (file &optional _editable rev)
+(defun vc-git-checkout (file &optional rev)
   (vc-git-command nil 0 file "checkout" (or rev "HEAD")))
 
 (defun vc-git-revert (file &optional contents-done)
diff --git a/lisp/vc/vc-hg.el b/lisp/vc/vc-hg.el
index 583fa6c..dab2c72 100644
--- a/lisp/vc/vc-hg.el
+++ b/lisp/vc/vc-hg.el
@@ -63,7 +63,7 @@
 ;; - unregister (file)                         OK
 ;; * checkin (files rev comment)               OK
 ;; * find-revision (file rev buffer)           OK
-;; * checkout (file &optional editable rev)    OK
+;; * checkout (file &optional rev)             OK
 ;; * revert (file &optional contents-done)     OK
 ;; - rollback (files)                          ?? PROBABLY NOT NEEDED
 ;; - merge (file rev1 rev2)                    NEEDED
@@ -499,7 +499,7 @@ REV is ignored."
                    (vc-hg-root file)))
 
 ;; Modeled after the similar function in vc-bzr.el
-(defun vc-hg-checkout (file &optional _editable rev)
+(defun vc-hg-checkout (file &optional rev)
   "Retrieve a revision of FILE.
 EDITABLE is ignored.
 REV is the revision to check out into WORKFILE."
diff --git a/lisp/vc/vc-mtn.el b/lisp/vc/vc-mtn.el
index fdaca54..145fdeb 100644
--- a/lisp/vc/vc-mtn.el
+++ b/lisp/vc/vc-mtn.el
@@ -197,7 +197,7 @@ If nil, use the value of `vc-diff-switches'.  If t, use no 
switches."
 (defun vc-mtn-find-revision (file rev buffer)
   (vc-mtn-command buffer 0 file "cat" "-r" rev))
 
-;; (defun vc-mtn-checkout (file &optional editable rev)
+;; (defun vc-mtn-checkout (file &optional rev)
 ;;   )
 
 (defun vc-mtn-revert (file &optional contents-done)
diff --git a/lisp/vc/vc-rcs.el b/lisp/vc/vc-rcs.el
index 4b06b09..2d713c9 100644
--- a/lisp/vc/vc-rcs.el
+++ b/lisp/vc/vc-rcs.el
@@ -421,7 +421,7 @@ whether to remove it."
         (concat "-p" rev)
         (vc-switches 'RCS 'checkout)))
 
-(defun vc-rcs-checkout (file &optional editable rev)
+(defun vc-rcs-checkout (file &optional rev)
   "Retrieve a copy of a saved version of FILE.  If FILE is a directory,
 attempt the checkout for all registered files beneath it."
   (if (file-directory-p file)
@@ -452,7 +452,7 @@ attempt the checkout for all registered files beneath it."
                     ;; If locking is not strict, force to overwrite
                     ;; the writable workfile.
                     (if (eq (vc-rcs-checkout-model (list file)) 'implicit) 
"-f")
-                    (if editable "-l")
+                    "-l"
                     (if (stringp rev)
                         ;; a literal revision was specified
                         (concat "-r" rev)
diff --git a/lisp/vc/vc-sccs.el b/lisp/vc/vc-sccs.el
index db777ab..f1e437b 100644
--- a/lisp/vc/vc-sccs.el
+++ b/lisp/vc/vc-sccs.el
@@ -272,7 +272,7 @@ expanded if `vc-keep-workfiles' is non-nil, otherwise, 
delete the workfile."
                      (vc-sccs-lookup-triple file rev)))
         (vc-switches 'SCCS 'checkout)))
 
-(defun vc-sccs-checkout (file &optional editable rev)
+(defun vc-sccs-checkout (file &optional rev)
   "Retrieve a copy of a saved revision of SCCS controlled FILE.
 If FILE is a directory, all version-controlled files beneath are checked out.
 EDITABLE non-nil means that the file should be writable and
@@ -299,7 +299,7 @@ locked.  REV is the revision to check out."
                         (not (stringp rev)))
                 (setq rev nil))
            (apply 'vc-sccs-do-command nil 0 "get" (vc-name file)
-                  (if editable "-e")
+                  "-e"
                   (and rev (concat "-r" (vc-sccs-lookup-triple file rev)))
                   switches))))
       (message "Checking out %s...done" file))))
diff --git a/lisp/vc/vc-svn.el b/lisp/vc/vc-svn.el
index bd22fbf..30d66e4 100644
--- a/lisp/vc/vc-svn.el
+++ b/lisp/vc/vc-svn.el
@@ -375,14 +375,14 @@ FILE is a file wildcard, relative to the root directory 
of DIRECTORY."
   "Return the administrative directory of FILE."
   (expand-file-name vc-svn-admin-directory (vc-svn-root file)))
 
-(defun vc-svn-checkout (file &optional editable rev)
+(defun vc-svn-checkout (file &optional rev)
   (message "Checking out %s..." file)
   (with-current-buffer (or (get-file-buffer file) (current-buffer))
-    (vc-svn-update file editable rev (vc-switches 'SVN 'checkout)))
+    (vc-svn-update file rev (vc-switches 'SVN 'checkout)))
   (vc-mode-line file 'SVN)
   (message "Checking out %s...done" file))
 
-(defun vc-svn-update (file _editable rev switches)
+(defun vc-svn-update (file rev switches)
   (if (and (file-exists-p file) (not rev))
       ;; If no revision was specified, there's nothing to do.
       nil
diff --git a/lisp/vc/vc.el b/lisp/vc/vc.el
index 2efa450..f0fe51b 100644
--- a/lisp/vc/vc.el
+++ b/lisp/vc/vc.el
@@ -281,16 +281,17 @@
 ;;   The implementation should pass the value of vc-checkout-switches
 ;;   to the backend command.
 ;;
-;; * checkout (file &optional editable rev)
-;;
-;;   Check out revision REV of FILE into the working area.  If EDITABLE
-;;   is non-nil, FILE should be writable by the user and if locking is
-;;   used for FILE, a lock should also be set.  If REV is non-nil, that
-;;   is the revision to check out (default is the working revision).
-;;   If REV is t, that means to check out the head of the current branch;
-;;   if it is the empty string, check out the head of the trunk.
-;;   The implementation should pass the value of vc-checkout-switches
-;;   to the backend command.
+;; * checkout (file &optional rev)
+;;
+;;   Check out revision REV of FILE into the working area.  FILE
+;;   should be writable by the user and if locking is used for FILE, a
+;;   lock should also be set.  If REV is non-nil, that is the revision
+;;   to check out (default is the working revision).  If REV is t,
+;;   that means to check out the head of the current branch; if it is
+;;   the empty string, check out the head of the trunk.  The
+;;   implementation should pass the value of vc-checkout-switches to
+;;   the backend command. The 'editable' argument of older VC versions
+;;   is gone; all files are checked out editable.
 ;;
 ;; * revert (file &optional contents-done)
 ;;
@@ -1138,10 +1139,10 @@ For old-style locking-based version control systems, 
like RCS:
              (let ((vsym (intern-soft revision-downcase)))
                (dolist (file files) (vc-transfer-file file vsym)))
            (dolist (file files)
-              (vc-checkout file (eq model 'implicit) revision)))))
+              (vc-checkout file revision)))))
        ((not (eq model 'implicit))
        ;; check the files out
-       (dolist (file files) (vc-checkout file t)))
+       (dolist (file files) (vc-checkout file)))
        (t
         ;; do nothing
         (message "Fileset is up-to-date"))))
@@ -1227,10 +1228,10 @@ For old-style locking-based version control systems, 
like RCS:
        (if (yes-or-no-p (format
                          "%s is not up-to-date.  Get latest revision? "
                          (file-name-nondirectory file)))
-           (vc-checkout file (eq model 'implicit) t)
+           (vc-checkout file t)
          (when (and (not (eq model 'implicit))
                     (yes-or-no-p "Lock this revision? "))
-           (vc-checkout file t)))))
+           (vc-checkout file)))))
      ;; needs-merge
      ((eq state 'needs-merge)
       (dolist (file files)
@@ -1267,7 +1268,7 @@ For old-style locking-based version control systems, like 
RCS:
                    "Revert to checked-in revision, instead? "))
              (error "Checkout aborted")
            (vc-revert-buffer-internal t t)
-           (vc-checkout file t)))))
+           (vc-checkout file)))))
      ;; Unknown fileset state
      (t
       (error "Fileset is in an unknown state %s" state)))))
@@ -1426,29 +1427,27 @@ Argument BACKEND is the backend you are using."
       (replace-match ""))
     (write-region (point-min) (point-max) file)))
 
-(defun vc-checkout (file &optional writable rev)
+(defun vc-checkout (file &optional rev)
   "Retrieve a copy of the revision REV of FILE.
-If WRITABLE is non-nil, make sure the retrieved file is writable.
 REV defaults to the latest revision.
 
 After check-out, runs the normal hook `vc-checkout-hook'."
-  (and writable
-       (not rev)
+  (and (not rev)
        (vc-call make-version-backups-p file)
        (vc-up-to-date-p file)
        (vc-make-version-backup file))
   (let ((backend (vc-backend file)))
     (with-vc-properties (list file)
       (condition-case err
-          (vc-call-backend backend 'checkout file writable rev)
+          (vc-call-backend backend 'checkout file rev)
         (file-error
          ;; Maybe the backend is not installed ;-(
-         (when writable
+         (when t
            (let ((buf (get-file-buffer file)))
              (when buf (with-current-buffer buf (read-only-mode -1)))))
          (signal (car err) (cdr err))))
       `((vc-state . ,(if (or (eq (vc-checkout-model backend (list file)) 
'implicit)
-                             (not writable))
+                             nil)
                          (if (vc-call-backend backend 'latest-on-branch-p file)
                              'up-to-date
                            'needs-update)
@@ -2544,14 +2543,14 @@ tip revision are merged into the working file."
                    (and file (member file files))))))
       (dolist (file files)
        (if (vc-up-to-date-p file)
-           (vc-checkout file nil t)
+           (vc-checkout file t)
          (vc-maybe-resolve-conflicts
           file (vc-call-backend backend 'merge-news file)))))
      ;; For a locking VCS, check out each file.
      ((eq (vc-checkout-model backend files) 'locking)
       (dolist (file files)
        (if (vc-up-to-date-p file)
-           (vc-checkout file nil t))))
+           (vc-checkout file t))))
      (t
       (error "VC update is unsupported for `%s'" backend)))))
 
@@ -2673,7 +2672,7 @@ backend to NEW-BACKEND, and unregister FILE from the 
current backend.
          (when modified-file
            (vc-switch-backend file new-backend)
            (unless (eq (vc-checkout-model new-backend (list file)) 'implicit)
-             (vc-checkout file t nil))
+             (vc-checkout file))
            (rename-file modified-file file 'ok-if-already-exists)
            (vc-file-setprop file 'vc-checkout-time nil)))))
     (when move



reply via email to

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