/[emacs]/emacs/lisp/vc-sccs.el
ViewVC logotype

Diff of /emacs/lisp/vc-sccs.el

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.15 by spiegel, Mon Mar 18 17:20:43 2002 UTC revision 1.15.2.1 by miles, Fri Apr 4 06:20:11 2003 UTC
# Line 28  Line 28 
28    
29  ;;; Code:  ;;; Code:
30    
31  (eval-when-compile  (eval-when-compile
32    (require 'vc))    (require 'vc))
33    
34  ;;;  ;;;
35  ;;; Customization options  ;;; Customization options
36  ;;;  ;;;
37    
# Line 88  For a description of possible values, se Line 88  For a description of possible values, se
88  ;;; State-querying functions  ;;; State-querying functions
89  ;;;  ;;;
90    
91  ;;;###autoload  ;;; The autoload cookie below places vc-sccs-registered directly into
92  (progn (defun vc-sccs-registered (f) (vc-default-registered 'SCCS f)))  ;;; loaddefs.el, so that vc-sccs.el does not need to be loaded for
93    ;;; every file that is visited.  The definition is repeated below
94    ;;; so that Help and etags can find it.
95    
96    ;;;###autoload (defun vc-sccs-registered(f) (vc-default-registered 'SCCS f))
97    (defun vc-sccs-registered (f) (vc-default-registered 'SCCS f))
98    
99  (defun vc-sccs-state (file)  (defun vc-sccs-state (file)
100    "SCCS-specific function to compute the version control state."    "SCCS-specific function to compute the version control state."
# Line 203  expanded if `vc-keep-workfiles' is non-n Line 208  expanded if `vc-keep-workfiles' is non-n
208      (if vc-keep-workfiles      (if vc-keep-workfiles
209          (vc-do-command nil 0 "get" (vc-name file)))))          (vc-do-command nil 0 "get" (vc-name file)))))
210    
211  (defun vc-sccs-checkout (file &optional editable rev workfile)  (defun vc-sccs-find-version (file rev buffer)
212    "Retrieve a copy of a saved version of SCCS controlled FILE into a WORKFILE.    (apply 'vc-do-command
213             buffer 0 "get" (vc-name file)
214             "-s" ;; suppress diagnostic output
215             "-p"
216             (and rev
217                  (concat "-r"
218                          (vc-sccs-lookup-triple file rev)))
219             (if (stringp vc-checkout-switches)
220                 (list vc-checkout-switches)
221               vc-checkout-switches)))
222    
223    (defun vc-sccs-checkout (file &optional editable rev)
224      "Retrieve a copy of a saved version of SCCS controlled FILE.
225  EDITABLE non-nil means that the file should be writable and  EDITABLE non-nil means that the file should be writable and
226  locked.  REV is the revision to check out into WORKFILE."  locked.  REV is the revision to check out."
227    (let ((filename (or workfile file))    (let ((file-buffer (get-file-buffer file))
         (file-buffer (get-file-buffer file))  
228          switches)          switches)
229      (message "Checking out %s..." filename)      (message "Checking out %s..." file)
230      (save-excursion      (save-excursion
231        ;; Change buffers to get local value of vc-checkout-switches.        ;; Change buffers to get local value of vc-checkout-switches.
232        (if file-buffer (set-buffer file-buffer))        (if file-buffer (set-buffer file-buffer))
# Line 224  locked.  REV is the revision to check ou Line 240  locked.  REV is the revision to check ou
240          (save-excursion          (save-excursion
241            ;; Adjust the default-directory so that the check-out creates            ;; Adjust the default-directory so that the check-out creates
242            ;; the file in the right place.            ;; the file in the right place.
243            (setq default-directory (file-name-directory filename))            (setq default-directory (file-name-directory file))
244    
245            (and rev (string= rev "") (setq rev nil))            (and rev (or (string= rev "")
246            (if workfile                         (not (stringp rev)))
247                ;; Some SCCS implementations allow checking out directly to a                 (setq rev nil))
248                ;; file using the -G option, but then some don't so use the            (apply 'vc-do-command nil 0 "get" (vc-name file)
249                ;; least common denominator approach and use the -p option                   (if editable "-e")
250                ;; ala RCS.                   (and rev (concat "-r" (vc-sccs-lookup-triple file rev)))
251                (let ((vc-modes (logior (file-modes (vc-name file))                   switches))))
252                                        (if editable 128 0)))      (message "Checking out %s...done" file)))
                     (failed t))  
                 (unwind-protect  
                     (progn  
                       (let ((coding-system-for-read 'no-conversion)  
                             (coding-system-for-write 'no-conversion))  
                         (with-temp-file filename  
                           (apply 'vc-do-command  
                                  (current-buffer) 0 "get" (vc-name file)  
                                  "-s" ;; suppress diagnostic output  
                                  (if editable "-e")  
                                  "-p"  
                                  (and rev  
                                       (concat "-r"  
                                               (vc-sccs-lookup-triple file rev)))  
                                  switches)))  
                       (set-file-modes filename  
                                       (logior (file-modes (vc-name file))  
                                               (if editable 128 0)))  
                       (setq failed nil))  
                   (and failed (file-exists-p filename)  
                        (delete-file filename))))  
             (apply 'vc-do-command nil 0 "get" (vc-name file)  
                    (if editable "-e")  
                    (and rev (concat "-r" (vc-sccs-lookup-triple file rev)))  
                    switches)))))  
     (message "Checking out %s...done" filename)))  
253    
254  (defun vc-sccs-revert (file &optional contents-done)  (defun vc-sccs-revert (file &optional contents-done)
255    "Revert FILE to the version it was based on."    "Revert FILE to the version it was based on."
# Line 304  EDITABLE non-nil means previous version Line 294  EDITABLE non-nil means previous version
294    "Get a difference report using SCCS between two versions of FILE."    "Get a difference report using SCCS between two versions of FILE."
295    (setq oldvers (vc-sccs-lookup-triple file oldvers))    (setq oldvers (vc-sccs-lookup-triple file oldvers))
296    (setq newvers (vc-sccs-lookup-triple file newvers))    (setq newvers (vc-sccs-lookup-triple file newvers))
297    (apply 'vc-do-command "*vc-diff*" 1 "vcdiff" (vc-name file)    (apply 'vc-do-command "*vc-diff*" 1 "vcdiff" (vc-name file)
298           (append (list "-q"           (append (list "-q"
299                         (and oldvers (concat "-r" oldvers))                         (and oldvers (concat "-r" oldvers))
300                         (and newvers (concat "-r" newvers)))                         (and newvers (concat "-r" newvers)))

Legend:
Removed from v.1.15  
changed lines
  Added in v.1.15.2.1

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26