comparison lisp/ediff/ediff-vers.el @ 70:131b0175ea99 r20-0b30

Import from CVS: tag r20-0b30
author cvs
date Mon, 13 Aug 2007 09:02:59 +0200
parents 0293115a14e9
children c7528f8e288d
comparison
equal deleted inserted replaced
69:804d1389bcd6 70:131b0175ea99
1 ;;; ediff-vers.el --- version control interface to Ediff 1 ;;; ediff-vers.el --- version control interface to Ediff
2 2
3 ;;; Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc. 3 ;;; Copyright (C) 1995, 1996 Free Software Foundation, Inc.
4 4
5 ;; Author: Michael Kifer <kifer@cs.sunysb.edu> 5 ;; Author: Michael Kifer <kifer@cs.sunysb.edu>
6 6
7 ;; This file is part of GNU Emacs. 7 ;; This file is part of GNU Emacs.
8 8
28 (defvar rcs-default-co-switches) 28 (defvar rcs-default-co-switches)
29 (defvar sc-mode) 29 (defvar sc-mode)
30 (defvar cvs-shell) 30 (defvar cvs-shell)
31 (defvar cvs-program) 31 (defvar cvs-program)
32 (defvar cvs-cookie-handle) 32 (defvar cvs-cookie-handle)
33 (defvar ediff-temp-file-prefix) 33
34 34 (eval-when-compile
35 (and noninteractive 35 (load "pcl-cvs" 'noerror)
36 (eval-when-compile 36 (load "rcs" 'noerror)
37 (load "pcl-cvs" 'noerror) 37 (load "generic-sc" 'noerror)
38 (load "rcs" 'noerror) 38 (load "vc" 'noerror))
39 (load "generic-sc" 'noerror)
40 (load "vc" 'noerror)))
41 ;; end pacifier 39 ;; end pacifier
42 40
43 ;; VC.el support 41 ;; VC.el support
44 (defun ediff-vc-internal (rev1 rev2 &optional startup-hooks) 42 (defun vc-ediff-internal (rev1 rev2 &optional startup-hooks)
45 ;; Run Ediff on versions of the current buffer. 43 ;; Run Ediff on versions of the current buffer.
46 ;; If REV2 is "" then compare current buffer with REV1. 44 ;; If REV2 is "" then compare current buffer with REV1.
47 ;; If the current buffer is named `F', the version is named `F.~REV~'. 45 ;; If the current buffer is named `F', the version is named `F.~REV~'.
48 ;; If `F.~REV~' already exists, it is used instead of being re-created. 46 ;; If `F.~REV~' already exists, it is used instead of being re-created.
49 (let (file1 file2 rev1buf rev2buf) 47 (let (file1 file2 rev1buf rev2buf)
103 (setq buffer-read-only nil 101 (setq buffer-read-only nil
104 default-directory (file-name-directory (expand-file-name file))) 102 default-directory (file-name-directory (expand-file-name file)))
105 (erase-buffer)) 103 (erase-buffer))
106 buf)) 104 buf))
107 105
108 (defun ediff-rcs-internal (rev1 rev2 &optional startup-hooks) 106 (defun rcs-ediff-internal (rev1 rev2 &optional startup-hooks)
109 ;; Run Ediff on versions of the current buffer. 107 ;; Run Ediff on versions of the current buffer.
110 ;; If REV2 is "" then use current buffer. 108 ;; If REV2 is "" then use current buffer.
111 (let ((rev2buf (if (string= rev2 "") 109 (let ((rev2buf (if (string= rev2 "")
112 (current-buffer) 110 (current-buffer)
113 (rcs-ediff-view-revision rev2))) 111 (rcs-ediff-view-revision rev2)))
124 (defun generic-sc-get-latest-rev () 122 (defun generic-sc-get-latest-rev ()
125 (cond ((eq sc-mode 'CCASE) 123 (cond ((eq sc-mode 'CCASE)
126 (eval "main/LATEST")) 124 (eval "main/LATEST"))
127 (t (eval "")))) 125 (t (eval ""))))
128 126
129 (defun ediff-generic-sc-internal (rev1 rev2 &optional startup-hooks) 127 (defun generic-sc-ediff-internal (rev1 rev2 &optional startup-hooks)
130 ;; Run Ediff on versions of the current buffer. 128 ;; Run Ediff on versions of the current buffer.
131 ;; If REV2 is "" then compare current buffer with REV1. 129 ;; If REV2 is "" then compare current buffer with REV1.
132 ;; If the current buffer is named `F', the version is named `F.~REV~'. 130 ;; If the current buffer is named `F', the version is named `F.~REV~'.
133 ;; If `F.~REV~' already exists, it is used instead of being re-created. 131 ;; If `F.~REV~' already exists, it is used instead of being re-created.
134 (let (rev1buf rev2buf) 132 (let (rev1buf rev2buf)
144 (ediff-buffers rev1buf rev2buf startup-hooks 'ediff-revision))) 142 (ediff-buffers rev1buf rev2buf startup-hooks 'ediff-revision)))
145 143
146 144
147 ;;; Merge with Version Control 145 ;;; Merge with Version Control
148 146
149 (defun ediff-vc-merge-internal (rev1 rev2 ancestor-rev &optional startup-hooks) 147 (defun vc-ediff-merge-internal (rev1 rev2 ancestor-rev &optional startup-hooks)
150 ;; If ANCESTOR-REV non-nil, merge with ancestor 148 ;; If ANCESTOR-REV non-nil, merge with ancestor
151 (let (buf1 buf2 ancestor-buf) 149 (let (buf1 buf2 ancestor-buf)
152 (save-excursion 150 (save-excursion
153 (vc-version-other-window rev1) 151 (vc-version-other-window rev1)
154 (setq buf1 (current-buffer))) 152 (setq buf1 (current-buffer)))
177 buf1 buf2 ancestor-buf 175 buf1 buf2 ancestor-buf
178 startup-hooks 'ediff-merge-revisions-with-ancestor) 176 startup-hooks 'ediff-merge-revisions-with-ancestor)
179 (ediff-merge-buffers buf1 buf2 startup-hooks 'ediff-merge-revisions)) 177 (ediff-merge-buffers buf1 buf2 startup-hooks 'ediff-merge-revisions))
180 )) 178 ))
181 179
182 (defun ediff-rcs-merge-internal (rev1 rev2 ancestor-rev 180 (defun rcs-ediff-merge-internal (rev1 rev2 ancestor-rev
183 &optional startup-hooks) 181 &optional startup-hooks)
184 ;; If ANCESTOR-REV non-nil, merge with ancestor 182 ;; If ANCESTOR-REV non-nil, merge with ancestor
185 (let (buf1 buf2 ancestor-buf) 183 (let (buf1 buf2 ancestor-buf)
186 (setq buf1 (rcs-ediff-view-revision rev1) 184 (setq buf1 (rcs-ediff-view-revision rev1)
187 buf2 (if (string= rev2 "") 185 buf2 (if (string= rev2 "")
197 (ediff-merge-buffers-with-ancestor 195 (ediff-merge-buffers-with-ancestor
198 buf1 buf2 ancestor-buf 196 buf1 buf2 ancestor-buf
199 startup-hooks 'ediff-merge-revisions-with-ancestor) 197 startup-hooks 'ediff-merge-revisions-with-ancestor)
200 (ediff-merge-buffers buf1 buf2 startup-hooks 'ediff-merge-revisions)))) 198 (ediff-merge-buffers buf1 buf2 startup-hooks 'ediff-merge-revisions))))
201 199
202 (defun ediff-generic-sc-merge-internal (rev1 rev2 ancestor-rev 200 (defun generic-sc-ediff-merge-internal (rev1 rev2 ancestor-rev
203 &optional startup-hooks) 201 &optional startup-hooks)
204 ;; If ANCESTOR-REV non-nil, merge with ancestor 202 ;; If ANCESTOR-REV non-nil, merge with ancestor
205 (let (buf1 buf2 ancestor-buf) 203 (let (buf1 buf2 ancestor-buf)
206 (save-excursion 204 (save-excursion
207 (if (string= rev1 "") 205 (if (string= rev1 "")
224 (ediff-merge-buffers buf1 buf2 startup-hooks 'ediff-merge-revisions)))) 222 (ediff-merge-buffers buf1 buf2 startup-hooks 'ediff-merge-revisions))))
225 223
226 224
227 ;; PCL-CVS.el support 225 ;; PCL-CVS.el support
228 226
229 (defun ediff-pcl-cvs-internal (rev1 rev2 &optional startup-hooks) 227 (defun pcl-cvs-ediff-internal (rev1 rev2 &optional startup-hooks)
230 ;; Run Ediff on a pair of revisions of the current buffer. 228 ;; Run Ediff on a pair of revisions of the current buffer.
231 ;; If REV1 is "", use the latest revision. 229 ;; If REV1 is "", use the latest revision.
232 ;; If REV2 is "", use the current buffer as the second file to compare. 230 ;; If REV2 is "", use the current buffer as the second file to compare.
233 (let ((orig-buf (current-buffer)) 231 (let ((orig-buf (current-buffer))
234 orig-file-name buf1 buf2 file1 file2) 232 orig-file-name buf1 buf2 file1 file2)
251 (ediff-buffers buf1 buf2 startup-hooks 'ediff-revision))) 249 (ediff-buffers buf1 buf2 startup-hooks 'ediff-revision)))
252 250
253 ;; This function is the standard Ediff's interface to pcl-cvs. 251 ;; This function is the standard Ediff's interface to pcl-cvs.
254 ;; Works like with other interfaces: runs ediff on versions of the file in the 252 ;; Works like with other interfaces: runs ediff on versions of the file in the
255 ;; current buffer. 253 ;; current buffer.
256 (defun ediff-pcl-cvs-merge-internal (rev1 rev2 ancestor-rev 254 (defun pcl-cvs-ediff-merge-internal (rev1 rev2 ancestor-rev
257 &optional startup-hooks) 255 &optional startup-hooks)
258 ;; Ediff-merge appropriate revisions of the selected file. 256 ;; Ediff-merge appropriate revisions of the selected file.
259 ;; If REV1 is "" then use the latest revision. 257 ;; If REV1 is "" then use the latest revision.
260 ;; If REV2 is "" then merge current buffer's file with REV1. 258 ;; If REV2 is "" then merge current buffer's file with REV1.
261 ;; If ANCESTOR-REV is "" then use current buffer's file as ancestor. 259 ;; If ANCESTOR-REV is "" then use current buffer's file as ancestor.
358 (if (stringp ancestor-file) (delete-file ancestor-file)))) 356 (if (stringp ancestor-file) (delete-file ancestor-file))))
359 357
360 ;;; Local Variables: 358 ;;; Local Variables:
361 ;;; eval: (put 'ediff-defvar-local 'lisp-indent-hook 'defun) 359 ;;; eval: (put 'ediff-defvar-local 'lisp-indent-hook 'defun)
362 ;;; eval: (put 'ediff-eval-in-buffer 'lisp-indent-hook 1) 360 ;;; eval: (put 'ediff-eval-in-buffer 'lisp-indent-hook 1)
363 ;;; eval: (put 'ediff-eval-in-buffer 'edebug-form-spec '(form body))
364 ;;; End: 361 ;;; End:
365 362
366 (provide 'ediff-vers) 363 (provide 'ediff-vers)
367 364
368 ;;; ediff-vers.el ends here 365 ;;; ediff-vers.el ends here