emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] Changes to emacs/lisp/vc-cvs.el


From: Andre Spiegel
Subject: [Emacs-diffs] Changes to emacs/lisp/vc-cvs.el
Date: Thu, 28 Mar 2002 09:27:31 -0500

Index: emacs/lisp/vc-cvs.el
diff -c emacs/lisp/vc-cvs.el:1.37 emacs/lisp/vc-cvs.el:1.38
*** emacs/lisp/vc-cvs.el:1.37   Fri Mar 22 18:10:01 2002
--- emacs/lisp/vc-cvs.el        Thu Mar 28 09:27:30 2002
***************
*** 5,11 ****
  ;; Author:      FSF (see vc.el for full credits)
  ;; Maintainer:  Andre Spiegel <address@hidden>
  
! ;; $Id: vc-cvs.el,v 1.37 2002/03/22 23:10:01 monnier Exp $
  
  ;; This file is part of GNU Emacs.
  
--- 5,11 ----
  ;; Author:      FSF (see vc.el for full credits)
  ;; Maintainer:  Andre Spiegel <address@hidden>
  
! ;; $Id: vc-cvs.el,v 1.38 2002/03/28 14:27:30 spiegel Exp $
  
  ;; This file is part of GNU Emacs.
  
***************
*** 35,40 ****
--- 35,50 ----
  ;;; Customization options
  ;;;
  
+ (defcustom vc-cvs-global-switches nil
+   "*Global switches to pass to any CVS command."
+   :type '(choice (const :tag "None" nil)
+                (string :tag "Argument String")
+                (repeat :tag "Argument List"
+                        :value ("")
+                        string))
+   :version "21.3"
+   :group 'vc)
+ 
  (defcustom vc-cvs-register-switches nil
    "*Extra switches for registering a file into CVS.
  A string or list of strings passed to the checkin program by
***************
*** 182,188 ****
          state))
      (with-temp-buffer
        (cd (file-name-directory file))
!       (vc-do-command t 0 "cvs" file "status")
        (vc-cvs-parse-status t))))
  
  (defun vc-cvs-state-heuristic (file)
--- 192,198 ----
          state))
      (with-temp-buffer
        (cd (file-name-directory file))
!       (vc-cvs-command t 0 file "status")
        (vc-cvs-parse-status t))))
  
  (defun vc-cvs-state-heuristic (file)
***************
*** 203,209 ****
        ;; Don't specify DIR in this command, the default-directory is
        ;; enough.  Otherwise it might fail with remote repositories.
        (with-temp-buffer
!       (vc-do-command t 0 "cvs" nil "status" "-l")
        (goto-char (point-min))
        (while (re-search-forward "^=+\n\\([^=\n].*\n\\|\n\\)+" nil t)
          (narrow-to-region (match-beginning 0) (match-end 0))
--- 213,219 ----
        ;; Don't specify DIR in this command, the default-directory is
        ;; enough.  Otherwise it might fail with remote repositories.
        (with-temp-buffer
!       (vc-cvs-command t 0 nil "status" "-l")
        (goto-char (point-min))
        (while (re-search-forward "^=+\n\\([^=\n].*\n\\|\n\\)+" nil t)
          (narrow-to-region (match-beginning 0) (match-end 0))
***************
*** 288,294 ****
                         (list vc-cvs-register-switches)
                       vc-cvs-register-switches))))
  
!       (apply 'vc-do-command nil 0 "cvs" file
             "add"
             (and comment (string-match "[^\t\n ]" comment)
                  (concat "-m" comment))
--- 298,304 ----
                         (list vc-cvs-register-switches)
                       vc-cvs-register-switches))))
  
!       (apply 'vc-cvs-command nil 0 file
             "add"
             (and comment (string-match "[^\t\n ]" comment)
                  (concat "-m" comment))
***************
*** 313,319 ****
                    vc-checkin-switches))
        status)
      (if (not rev)
!         (setq status (apply 'vc-do-command nil 1 "cvs" file
                              "ci" (if rev (concat "-r" rev))
                              (concat "-m" comment)
                              switches))
--- 323,329 ----
                    vc-checkin-switches))
        status)
      (if (not rev)
!         (setq status (apply 'vc-cvs-command nil 1 file
                              "ci" (if rev (concat "-r" rev))
                              (concat "-m" comment)
                              switches))
***************
*** 321,329 ****
            (error "%s is not a valid symbolic tag name")
          ;; If the input revison is a valid symbolic tag name, we create it
          ;; as a branch, commit and switch to it.       
!         (apply 'vc-do-command nil 0 "cvs" file "tag" "-b" (list rev))
!         (apply 'vc-do-command nil 0 "cvs" file "update" "-r" (list rev))
!         (setq status (apply 'vc-do-command nil 1 "cvs" file
                              "ci" 
                              (concat "-m" comment)
                              switches))
--- 331,339 ----
            (error "%s is not a valid symbolic tag name")
          ;; If the input revison is a valid symbolic tag name, we create it
          ;; as a branch, commit and switch to it.       
!         (apply 'vc-cvs-command nil 0 file "tag" "-b" (list rev))
!         (apply 'vc-cvs-command nil 0 file "update" "-r" (list rev))
!         (setq status (apply 'vc-cvs-command nil 1 file
                              "ci" 
                              (concat "-m" comment)
                              switches))
***************
*** 356,362 ****
      ;; 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-do-command nil 0 "cvs" file "update" "-A"))))
  
  (defun vc-cvs-checkout (file &optional editable rev workfile)
    "Retrieve a revision of FILE into a WORKFILE.
--- 366,372 ----
      ;; 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 file "update" "-A"))))
  
  (defun vc-cvs-checkout (file &optional editable rev workfile)
    "Retrieve a revision of FILE into a WORKFILE.
***************
*** 395,402 ****
                        (let ((coding-system-for-read 'no-conversion)
                              (coding-system-for-write 'no-conversion))
                          (with-temp-file filename
!                           (apply 'vc-do-command
!                                  (current-buffer) 0 "cvs" file
                                   "-Q" ; suppress diagnostic output
                                   "update"
                                   (and rev (not (string= rev ""))
--- 405,412 ----
                        (let ((coding-system-for-read 'no-conversion)
                              (coding-system-for-write 'no-conversion))
                          (with-temp-file filename
!                           (apply 'vc-cvs-command
!                                  (current-buffer) 0 file
                                   "-Q" ; suppress diagnostic output
                                   "update"
                                   (and rev (not (string= rev ""))
***************
*** 418,437 ****
                ;; if necessary (using `cvs-edit' if requested).
        (and editable (not (eq (vc-cvs-checkout-model file) 'implicit))
                     (if vc-cvs-use-edit
!                        (vc-do-command nil 0 "cvs" file "edit")
                       (set-file-modes file (logior (file-modes file) 128))
                       (if file-buffer (toggle-read-only -1))))
              ;; Check out a particular version (or recreate the file).
              (vc-file-setprop file 'vc-workfile-version nil)
!             (apply 'vc-do-command nil 0 "cvs" file
!          (and editable
!               (or (not (file-exists-p file))
!                   (not (eq (vc-cvs-checkout-model file)
!                            'implicit)))
!               "-w")
!          "update"
!          ;; default for verbose checkout: clear the sticky tag so
!          ;; that the actual update will get the head of the trunk
                     (if (or (not rev) (string= rev ""))
                         "-A"
                       (concat "-r" rev))
--- 428,447 ----
                ;; if necessary (using `cvs-edit' if requested).
        (and editable (not (eq (vc-cvs-checkout-model file) 'implicit))
                     (if vc-cvs-use-edit
!                        (vc-cvs-command nil 0 file "edit")
                       (set-file-modes file (logior (file-modes file) 128))
                       (if file-buffer (toggle-read-only -1))))
              ;; Check out a particular version (or recreate the file).
              (vc-file-setprop file 'vc-workfile-version nil)
!             (apply 'vc-cvs-command nil 0 file
!                      (and editable
!                           (or (not (file-exists-p file))
!                               (not (eq (vc-cvs-checkout-model file)
!                                        'implicit)))
!                           "-w")
!                      "update"
!                      ;; default for verbose checkout: clear the sticky tag so
!                      ;; that the actual update will get the head of the trunk
                     (if (or (not rev) (string= rev ""))
                         "-A"
                       (concat "-r" rev))
***************
*** 447,460 ****
      (vc-cvs-checkout file nil (vc-workfile-version file) file))
    (unless (eq (vc-checkout-model file) 'implicit)
      (if vc-cvs-use-edit
!         (vc-do-command nil 0 "cvs" file "unedit")
        ;; Make the file read-only by switching off all w-bits
        (set-file-modes file (logand (file-modes file) 3950)))))
  
  (defun vc-cvs-merge (file first-version &optional second-version)
    "Merge changes into current working copy of FILE.
  The changes are between FIRST-VERSION and SECOND-VERSION."
!   (vc-do-command nil 0 "cvs" file
                   "update" "-kk"
                   (concat "-j" first-version)
                   (concat "-j" second-version))
--- 457,470 ----
      (vc-cvs-checkout file nil (vc-workfile-version file) file))
    (unless (eq (vc-checkout-model file) 'implicit)
      (if vc-cvs-use-edit
!         (vc-cvs-command nil 0 file "unedit")
        ;; Make the file read-only by switching off all w-bits
        (set-file-modes file (logand (file-modes file) 3950)))))
  
  (defun vc-cvs-merge (file first-version &optional second-version)
    "Merge changes into current working copy of FILE.
  The changes are between FIRST-VERSION and SECOND-VERSION."
!   (vc-cvs-command nil 0 file
                   "update" "-kk"
                   (concat "-j" first-version)
                   (concat "-j" second-version))
***************
*** 472,478 ****
    (save-excursion
      ;; (vc-file-setprop file 'vc-workfile-version nil)
      (vc-file-setprop file 'vc-checkout-time 0)
!     (vc-do-command nil 0 "cvs" file "update")
      ;; Analyze the merge result reported by CVS, and set
      ;; file properties accordingly.
      (set-buffer (get-buffer "*vc*"))
--- 482,488 ----
    (save-excursion
      ;; (vc-file-setprop file 'vc-workfile-version nil)
      (vc-file-setprop file 'vc-checkout-time 0)
!     (vc-cvs-command nil 0 file "update")
      ;; Analyze the merge result reported by CVS, and set
      ;; file properties accordingly.
      (set-buffer (get-buffer "*vc*"))
***************
*** 522,531 ****
  
  (defun vc-cvs-print-log (file)
    "Get change log associated with FILE."
!   (vc-do-command
     nil
     (if (and (vc-cvs-stay-local-p file) (fboundp 'start-process)) 'async 0)
!    "cvs" file "log"))
  
  (defun vc-cvs-show-log-entry (version)
    (when (re-search-forward
--- 532,541 ----
  
  (defun vc-cvs-print-log (file)
    "Get change log associated with FILE."
!   (vc-cvs-command
     nil
     (if (and (vc-cvs-stay-local-p file) (fboundp 'start-process)) 'async 0)
!    file "log"))
  
  (defun vc-cvs-show-log-entry (version)
    (when (re-search-forward
***************
*** 565,582 ****
        ;; This file is added but not yet committed; there is no master file.
        (if (or oldvers newvers)
            (error "No revisions of %s exist" file)
!         ;; we regard this as "changed".
!         ;; diff it against /dev/null.
            (apply 'vc-do-command "*vc-diff*"
                   1 "diff" file
                   (append diff-switches-list '("/dev/null"))))
        (setq status
!             (apply 'vc-do-command "*vc-diff*"
                     (if (and (vc-cvs-stay-local-p file)
                            (fboundp 'start-process))
                       'async
                     1)
!                    "cvs" file "diff"
                     (and oldvers (concat "-r" oldvers))
                     (and newvers (concat "-r" newvers))
                     diff-switches-list))
--- 575,593 ----
        ;; This file is added but not yet committed; there is no master file.
        (if (or oldvers newvers)
            (error "No revisions of %s exist" file)
!         ;; We regard this as "changed".
!         ;; Diff it against /dev/null.
!           ;; Note: this is NOT a "cvs diff".
            (apply 'vc-do-command "*vc-diff*"
                   1 "diff" file
                   (append diff-switches-list '("/dev/null"))))
        (setq status
!             (apply 'vc-cvs-command "*vc-diff*"
                     (if (and (vc-cvs-stay-local-p file)
                            (fboundp 'start-process))
                       'async
                     1)
!                    file "diff"
                     (and oldvers (concat "-r" oldvers))
                     (and newvers (concat "-r" newvers))
                     diff-switches-list))
***************
*** 603,609 ****
        ;; cvs diff: use a single call for the entire tree
        (let ((coding-system-for-read
               (or coding-system-for-read 'undecided)))
!         (apply 'vc-do-command "*vc-diff*" 1 "cvs" nil "diff"
                 (and rev1 (concat "-r" rev1))
                 (and rev2 (concat "-r" rev2))
                 (vc-diff-switches-list 'CVS))))))
--- 614,620 ----
        ;; cvs diff: use a single call for the entire tree
        (let ((coding-system-for-read
               (or coding-system-for-read 'undecided)))
!         (apply 'vc-cvs-command "*vc-diff*" 1 nil "diff"
                 (and rev1 (concat "-r" rev1))
                 (and rev2 (concat "-r" rev2))
                 (vc-diff-switches-list 'CVS))))))
***************
*** 611,617 ****
  (defun vc-cvs-annotate-command (file buffer &optional version)
    "Execute \"cvs annotate\" on FILE, inserting the contents in BUFFER.
  Optional arg VERSION is a version to annotate from."
!   (vc-do-command buffer 0 "cvs" file "annotate" (if version
                                                      (concat "-r" version))))
  
  (defun vc-cvs-annotate-current-time ()
--- 622,628 ----
  (defun vc-cvs-annotate-command (file buffer &optional version)
    "Execute \"cvs annotate\" on FILE, inserting the contents in BUFFER.
  Optional arg VERSION is a version to annotate from."
!   (vc-cvs-command buffer 0 file "annotate" (if version
                                                      (concat "-r" version))))
  
  (defun vc-cvs-annotate-current-time ()
***************
*** 655,662 ****
    "Assign to DIR's current version a given NAME.
  If BRANCHP is non-nil, the name is created as a branch (and the current
  workspace is immediately moved to that new branch)."
!   (vc-do-command nil 0 "cvs" dir "tag" "-c" (if branchp "-b") name)
!   (when branchp (vc-do-command nil 0 "cvs" dir "update" "-r" name)))
  
  (defun vc-cvs-retrieve-snapshot (dir name update)
    "Retrieve a snapshot at and below DIR.
--- 666,673 ----
    "Assign to DIR's current version a given NAME.
  If BRANCHP is non-nil, the name is created as a branch (and the current
  workspace is immediately moved to that new branch)."
!   (vc-cvs-command nil 0 dir "tag" "-c" (if branchp "-b") name)
!   (when branchp (vc-cvs-command nil 0 dir "update" "-r" name)))
  
  (defun vc-cvs-retrieve-snapshot (dir name update)
    "Retrieve a snapshot at and below DIR.
***************
*** 667,674 ****
          (sticky-tag))
        (erase-buffer)
        (if (or (not name) (string= name ""))
!         (vc-do-command t 0 "cvs" nil "update")
!       (vc-do-command t 0 "cvs" nil "update" "-r" name)
        (setq sticky-tag name))
        (when update
        (goto-char (point-min))
--- 678,685 ----
          (sticky-tag))
        (erase-buffer)
        (if (or (not name) (string= name ""))
!         (vc-cvs-command t 0 nil "update")
!       (vc-cvs-command t 0 nil "update" "-r" name)
        (setq sticky-tag name))
        (when update
        (goto-char (point-min))
***************
*** 714,719 ****
--- 725,740 ----
  ;;;
  ;;; Internal functions
  ;;;
+ 
+ (defun vc-cvs-command (buffer okstatus file &rest flags)
+   "A wrapper around `vc-do-command' for use in vc-cvs.el.
+ The difference to vc-do-command is that this function always invokes `cvs',
+ and that it passes `vc-cvs-global-switches' to it before FLAGS."
+   (apply 'vc-do-command buffer okstatus "cvs" file
+          (if (stringp vc-cvs-global-switches) 
+              (cons vc-cvs-global-switches flags)
+            (append vc-cvs-global-switches
+                    flags))))
  
  (defun vc-cvs-stay-local-p (file)
    "Return non-nil if VC should stay local when handling FILE."



reply via email to

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