Mercurial > hg > xemacs-beta
comparison lisp/ediff/ediff-vers.el @ 78:c7528f8e288d r20-0b34
Import from CVS: tag r20-0b34
author | cvs |
---|---|
date | Mon, 13 Aug 2007 09:05:42 +0200 |
parents | 131b0175ea99 |
children | 1ce6082ce73f |
comparison
equal
deleted
inserted
replaced
77:6cb4f478e7bc | 78:c7528f8e288d |
---|---|
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 | 33 |
34 (eval-when-compile | 34 (and noninteractive |
35 (load "pcl-cvs" 'noerror) | 35 (eval-when-compile |
36 (load "rcs" 'noerror) | 36 (load "pcl-cvs" 'noerror) |
37 (load "generic-sc" 'noerror) | 37 (load "rcs" 'noerror) |
38 (load "vc" 'noerror)) | 38 (load "generic-sc" 'noerror) |
39 (load "vc" 'noerror))) | |
39 ;; end pacifier | 40 ;; end pacifier |
40 | 41 |
41 ;; VC.el support | 42 ;; VC.el support |
42 (defun vc-ediff-internal (rev1 rev2 &optional startup-hooks) | 43 (defun ediff-vc-internal (rev1 rev2 &optional startup-hooks) |
43 ;; Run Ediff on versions of the current buffer. | 44 ;; Run Ediff on versions of the current buffer. |
44 ;; If REV2 is "" then compare current buffer with REV1. | 45 ;; If REV2 is "" then compare current buffer with REV1. |
45 ;; If the current buffer is named `F', the version is named `F.~REV~'. | 46 ;; If the current buffer is named `F', the version is named `F.~REV~'. |
46 ;; If `F.~REV~' already exists, it is used instead of being re-created. | 47 ;; If `F.~REV~' already exists, it is used instead of being re-created. |
47 (let (file1 file2 rev1buf rev2buf) | 48 (let (file1 file2 rev1buf rev2buf) |
64 rev1buf rev2buf | 65 rev1buf rev2buf |
65 startup-hooks | 66 startup-hooks |
66 'ediff-revision))) | 67 'ediff-revision))) |
67 | 68 |
68 ;; RCS.el support | 69 ;; RCS.el support |
69 (defun rcs-ediff-view-revision (&optional rev) | 70 (defun ediff-rcs-view-revision (&optional rev) |
70 ;; View previous RCS revision of current file. | 71 ;; View previous RCS revision of current file. |
71 ;; With prefix argument, prompts for a revision name. | 72 ;; With prefix argument, prompts for a revision name. |
72 (interactive (list (if current-prefix-arg | 73 (interactive (list (if current-prefix-arg |
73 (read-string "Revision: ")))) | 74 (read-string "Revision: ")))) |
74 (let* ((filename (buffer-file-name (current-buffer))) | 75 (let* ((filename (buffer-file-name (current-buffer))) |
101 (setq buffer-read-only nil | 102 (setq buffer-read-only nil |
102 default-directory (file-name-directory (expand-file-name file))) | 103 default-directory (file-name-directory (expand-file-name file))) |
103 (erase-buffer)) | 104 (erase-buffer)) |
104 buf)) | 105 buf)) |
105 | 106 |
106 (defun rcs-ediff-internal (rev1 rev2 &optional startup-hooks) | 107 (defun ediff-rcs-internal (rev1 rev2 &optional startup-hooks) |
107 ;; Run Ediff on versions of the current buffer. | 108 ;; Run Ediff on versions of the current buffer. |
108 ;; If REV2 is "" then use current buffer. | 109 ;; If REV2 is "" then use current buffer. |
109 (let ((rev2buf (if (string= rev2 "") | 110 (let ((rev2buf (if (string= rev2 "") |
110 (current-buffer) | 111 (current-buffer) |
111 (rcs-ediff-view-revision rev2))) | 112 (rcs-ediff-view-revision rev2))) |
122 (defun generic-sc-get-latest-rev () | 123 (defun generic-sc-get-latest-rev () |
123 (cond ((eq sc-mode 'CCASE) | 124 (cond ((eq sc-mode 'CCASE) |
124 (eval "main/LATEST")) | 125 (eval "main/LATEST")) |
125 (t (eval "")))) | 126 (t (eval "")))) |
126 | 127 |
127 (defun generic-sc-ediff-internal (rev1 rev2 &optional startup-hooks) | 128 (defun ediff-generic-sc-internal (rev1 rev2 &optional startup-hooks) |
128 ;; Run Ediff on versions of the current buffer. | 129 ;; Run Ediff on versions of the current buffer. |
129 ;; If REV2 is "" then compare current buffer with REV1. | 130 ;; If REV2 is "" then compare current buffer with REV1. |
130 ;; If the current buffer is named `F', the version is named `F.~REV~'. | 131 ;; If the current buffer is named `F', the version is named `F.~REV~'. |
131 ;; If `F.~REV~' already exists, it is used instead of being re-created. | 132 ;; If `F.~REV~' already exists, it is used instead of being re-created. |
132 (let (rev1buf rev2buf) | 133 (let (rev1buf rev2buf) |
142 (ediff-buffers rev1buf rev2buf startup-hooks 'ediff-revision))) | 143 (ediff-buffers rev1buf rev2buf startup-hooks 'ediff-revision))) |
143 | 144 |
144 | 145 |
145 ;;; Merge with Version Control | 146 ;;; Merge with Version Control |
146 | 147 |
147 (defun vc-ediff-merge-internal (rev1 rev2 ancestor-rev &optional startup-hooks) | 148 (defun ediff-vc-merge-internal (rev1 rev2 ancestor-rev &optional startup-hooks) |
148 ;; If ANCESTOR-REV non-nil, merge with ancestor | 149 ;; If ANCESTOR-REV non-nil, merge with ancestor |
149 (let (buf1 buf2 ancestor-buf) | 150 (let (buf1 buf2 ancestor-buf) |
150 (save-excursion | 151 (save-excursion |
151 (vc-version-other-window rev1) | 152 (vc-version-other-window rev1) |
152 (setq buf1 (current-buffer))) | 153 (setq buf1 (current-buffer))) |
175 buf1 buf2 ancestor-buf | 176 buf1 buf2 ancestor-buf |
176 startup-hooks 'ediff-merge-revisions-with-ancestor) | 177 startup-hooks 'ediff-merge-revisions-with-ancestor) |
177 (ediff-merge-buffers buf1 buf2 startup-hooks 'ediff-merge-revisions)) | 178 (ediff-merge-buffers buf1 buf2 startup-hooks 'ediff-merge-revisions)) |
178 )) | 179 )) |
179 | 180 |
180 (defun rcs-ediff-merge-internal (rev1 rev2 ancestor-rev | 181 (defun ediff-rcs-merge-internal (rev1 rev2 ancestor-rev |
181 &optional startup-hooks) | 182 &optional startup-hooks) |
182 ;; If ANCESTOR-REV non-nil, merge with ancestor | 183 ;; If ANCESTOR-REV non-nil, merge with ancestor |
183 (let (buf1 buf2 ancestor-buf) | 184 (let (buf1 buf2 ancestor-buf) |
184 (setq buf1 (rcs-ediff-view-revision rev1) | 185 (setq buf1 (rcs-ediff-view-revision rev1) |
185 buf2 (if (string= rev2 "") | 186 buf2 (if (string= rev2 "") |
195 (ediff-merge-buffers-with-ancestor | 196 (ediff-merge-buffers-with-ancestor |
196 buf1 buf2 ancestor-buf | 197 buf1 buf2 ancestor-buf |
197 startup-hooks 'ediff-merge-revisions-with-ancestor) | 198 startup-hooks 'ediff-merge-revisions-with-ancestor) |
198 (ediff-merge-buffers buf1 buf2 startup-hooks 'ediff-merge-revisions)))) | 199 (ediff-merge-buffers buf1 buf2 startup-hooks 'ediff-merge-revisions)))) |
199 | 200 |
200 (defun generic-sc-ediff-merge-internal (rev1 rev2 ancestor-rev | 201 (defun ediff-generic-sc-merge-internal (rev1 rev2 ancestor-rev |
201 &optional startup-hooks) | 202 &optional startup-hooks) |
202 ;; If ANCESTOR-REV non-nil, merge with ancestor | 203 ;; If ANCESTOR-REV non-nil, merge with ancestor |
203 (let (buf1 buf2 ancestor-buf) | 204 (let (buf1 buf2 ancestor-buf) |
204 (save-excursion | 205 (save-excursion |
205 (if (string= rev1 "") | 206 (if (string= rev1 "") |
222 (ediff-merge-buffers buf1 buf2 startup-hooks 'ediff-merge-revisions)))) | 223 (ediff-merge-buffers buf1 buf2 startup-hooks 'ediff-merge-revisions)))) |
223 | 224 |
224 | 225 |
225 ;; PCL-CVS.el support | 226 ;; PCL-CVS.el support |
226 | 227 |
227 (defun pcl-cvs-ediff-internal (rev1 rev2 &optional startup-hooks) | 228 (defun ediff-pcl-cvs-internal (rev1 rev2 &optional startup-hooks) |
228 ;; Run Ediff on a pair of revisions of the current buffer. | 229 ;; Run Ediff on a pair of revisions of the current buffer. |
229 ;; If REV1 is "", use the latest revision. | 230 ;; If REV1 is "", use the latest revision. |
230 ;; If REV2 is "", use the current buffer as the second file to compare. | 231 ;; If REV2 is "", use the current buffer as the second file to compare. |
231 (let ((orig-buf (current-buffer)) | 232 (let ((orig-buf (current-buffer)) |
232 orig-file-name buf1 buf2 file1 file2) | 233 orig-file-name buf1 buf2 file1 file2) |
249 (ediff-buffers buf1 buf2 startup-hooks 'ediff-revision))) | 250 (ediff-buffers buf1 buf2 startup-hooks 'ediff-revision))) |
250 | 251 |
251 ;; This function is the standard Ediff's interface to pcl-cvs. | 252 ;; This function is the standard Ediff's interface to pcl-cvs. |
252 ;; Works like with other interfaces: runs ediff on versions of the file in the | 253 ;; Works like with other interfaces: runs ediff on versions of the file in the |
253 ;; current buffer. | 254 ;; current buffer. |
254 (defun pcl-cvs-ediff-merge-internal (rev1 rev2 ancestor-rev | 255 (defun ediff-pcl-cvs-merge-internal (rev1 rev2 ancestor-rev |
255 &optional startup-hooks) | 256 &optional startup-hooks) |
256 ;; Ediff-merge appropriate revisions of the selected file. | 257 ;; Ediff-merge appropriate revisions of the selected file. |
257 ;; If REV1 is "" then use the latest revision. | 258 ;; If REV1 is "" then use the latest revision. |
258 ;; If REV2 is "" then merge current buffer's file with REV1. | 259 ;; If REV2 is "" then merge current buffer's file with REV1. |
259 ;; If ANCESTOR-REV is "" then use current buffer's file as ancestor. | 260 ;; If ANCESTOR-REV is "" then use current buffer's file as ancestor. |
356 (if (stringp ancestor-file) (delete-file ancestor-file)))) | 357 (if (stringp ancestor-file) (delete-file ancestor-file)))) |
357 | 358 |
358 ;;; Local Variables: | 359 ;;; Local Variables: |
359 ;;; eval: (put 'ediff-defvar-local 'lisp-indent-hook 'defun) | 360 ;;; eval: (put 'ediff-defvar-local 'lisp-indent-hook 'defun) |
360 ;;; eval: (put 'ediff-eval-in-buffer 'lisp-indent-hook 1) | 361 ;;; eval: (put 'ediff-eval-in-buffer 'lisp-indent-hook 1) |
362 ;;; eval: (put 'ediff-eval-in-buffer 'edebug-form-spec '(form body)) | |
361 ;;; End: | 363 ;;; End: |
362 | 364 |
363 (provide 'ediff-vers) | 365 (provide 'ediff-vers) |
364 | 366 |
365 ;;; ediff-vers.el ends here | 367 ;;; ediff-vers.el ends here |