Mercurial > emacs
annotate lisp/ediff-vers.el @ 33245:9366a16a186b
(decode-char, encode-char): Fix doc-string.
author | Kenichi Handa <handa@m17n.org> |
---|---|
date | Mon, 06 Nov 2000 12:42:06 +0000 |
parents | 6306740f6938 |
children | f8c8c2d3538e |
rev | line source |
---|---|
14234 | 1 ;;; ediff-vers.el --- version control interface to Ediff |
2 | |
18054 | 3 ;;; Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc. |
14234 | 4 |
5 ;; Author: Michael Kifer <kifer@cs.sunysb.edu> | |
6 | |
7 ;; This file is part of GNU Emacs. | |
8 | |
9 ;; GNU Emacs is free software; you can redistribute it and/or modify | |
10 ;; it under the terms of the GNU General Public License as published by | |
11 ;; the Free Software Foundation; either version 2, or (at your option) | |
12 ;; any later version. | |
13 | |
14 ;; GNU Emacs is distributed in the hope that it will be useful, | |
15 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | |
16 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
17 ;; GNU General Public License for more details. | |
18 | |
19 ;; You should have received a copy of the GNU General Public License | |
20 ;; along with GNU Emacs; see the file COPYING. If not, write to the | |
21 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, | |
22 ;; Boston, MA 02111-1307, USA. | |
23 | |
24 | |
25 ;;; Code: | |
15480
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14234
diff
changeset
|
26 |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14234
diff
changeset
|
27 ;; Compiler pacifier |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14234
diff
changeset
|
28 (defvar rcs-default-co-switches) |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14234
diff
changeset
|
29 (defvar sc-mode) |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14234
diff
changeset
|
30 (defvar cvs-shell) |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14234
diff
changeset
|
31 (defvar cvs-program) |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14234
diff
changeset
|
32 (defvar cvs-cookie-handle) |
18054 | 33 (defvar ediff-temp-file-prefix) |
15480
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14234
diff
changeset
|
34 |
16248
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
35 (and noninteractive |
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
36 (eval-when-compile |
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
37 (load "pcl-cvs" 'noerror) |
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
38 (load "rcs" 'noerror) |
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
39 (load "generic-sc" 'noerror) |
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
40 (load "vc" 'noerror))) |
15480
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14234
diff
changeset
|
41 ;; end pacifier |
14234 | 42 |
43 ;; VC.el support | |
16248
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
44 (defun ediff-vc-internal (rev1 rev2 &optional startup-hooks) |
14234 | 45 ;; Run Ediff on versions of the current buffer. |
46 ;; If REV2 is "" then compare current buffer with REV1. | |
47 ;; 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. | |
49 (let (file1 file2 rev1buf rev2buf) | |
33019
6306740f6938
2000-10-29 Michael Kifer <kifer@cs.sunysb.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
26585
diff
changeset
|
50 (save-window-excursion |
6306740f6938
2000-10-29 Michael Kifer <kifer@cs.sunysb.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
26585
diff
changeset
|
51 (save-excursion |
6306740f6938
2000-10-29 Michael Kifer <kifer@cs.sunysb.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
26585
diff
changeset
|
52 (vc-version-other-window rev1) |
6306740f6938
2000-10-29 Michael Kifer <kifer@cs.sunysb.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
26585
diff
changeset
|
53 (setq rev1buf (current-buffer) |
6306740f6938
2000-10-29 Michael Kifer <kifer@cs.sunysb.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
26585
diff
changeset
|
54 file1 (buffer-file-name))) |
6306740f6938
2000-10-29 Michael Kifer <kifer@cs.sunysb.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
26585
diff
changeset
|
55 (save-excursion |
6306740f6938
2000-10-29 Michael Kifer <kifer@cs.sunysb.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
26585
diff
changeset
|
56 (or (string= rev2 "") ; use current buffer |
6306740f6938
2000-10-29 Michael Kifer <kifer@cs.sunysb.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
26585
diff
changeset
|
57 (vc-version-other-window rev2)) |
6306740f6938
2000-10-29 Michael Kifer <kifer@cs.sunysb.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
26585
diff
changeset
|
58 (setq rev2buf (current-buffer) |
6306740f6938
2000-10-29 Michael Kifer <kifer@cs.sunysb.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
26585
diff
changeset
|
59 file2 (buffer-file-name))) |
6306740f6938
2000-10-29 Michael Kifer <kifer@cs.sunysb.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
26585
diff
changeset
|
60 (setq startup-hooks |
6306740f6938
2000-10-29 Michael Kifer <kifer@cs.sunysb.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
26585
diff
changeset
|
61 (cons `(lambda () |
6306740f6938
2000-10-29 Michael Kifer <kifer@cs.sunysb.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
26585
diff
changeset
|
62 (delete-file ,file1) |
6306740f6938
2000-10-29 Michael Kifer <kifer@cs.sunysb.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
26585
diff
changeset
|
63 (or ,(string= rev2 "") (delete-file ,file2))) |
6306740f6938
2000-10-29 Michael Kifer <kifer@cs.sunysb.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
26585
diff
changeset
|
64 startup-hooks))) |
14234 | 65 (ediff-buffers |
66 rev1buf rev2buf | |
67 startup-hooks | |
68 'ediff-revision))) | |
69 | |
70 ;; RCS.el support | |
71 (defun rcs-ediff-view-revision (&optional rev) | |
72 ;; View previous RCS revision of current file. | |
73 ;; With prefix argument, prompts for a revision name. | |
74 (interactive (list (if current-prefix-arg | |
75 (read-string "Revision: ")))) | |
76 (let* ((filename (buffer-file-name (current-buffer))) | |
77 (switches (append '("-p") | |
78 (if rev (list (concat "-r" rev)) nil))) | |
79 (buff (concat (file-name-nondirectory filename) ".~" rev "~"))) | |
80 (message "Working ...") | |
81 (setq filename (expand-file-name filename)) | |
82 (with-output-to-temp-buffer buff | |
83 (let ((output-buffer (ediff-rcs-get-output-buffer filename buff))) | |
84 (delete-windows-on output-buffer) | |
85 (save-excursion | |
86 (set-buffer output-buffer) | |
87 (apply 'call-process "co" nil t nil | |
88 ;; -q: quiet (no diagnostics) | |
89 (append switches rcs-default-co-switches | |
90 (list "-q" filename))))) | |
91 (message "") | |
92 buff))) | |
93 | |
94 (defun ediff-rcs-get-output-buffer (file name) | |
95 ;; Get a buffer for RCS output for FILE, make it writable and clean it up. | |
96 ;; Optional NAME is name to use instead of `*RCS-output*'. | |
26263
4f315ca65976
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
26039
diff
changeset
|
97 ;; This is a modified version from rcs.el v1.1. I use it here to make |
14234 | 98 ;; Ediff immune to changes in rcs.el |
99 (let* ((default-major-mode 'fundamental-mode) ; no frills! | |
100 (buf (get-buffer-create name))) | |
101 (save-excursion | |
102 (set-buffer buf) | |
103 (setq buffer-read-only nil | |
104 default-directory (file-name-directory (expand-file-name file))) | |
105 (erase-buffer)) | |
106 buf)) | |
107 | |
16248
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
108 (defun ediff-rcs-internal (rev1 rev2 &optional startup-hooks) |
14234 | 109 ;; Run Ediff on versions of the current buffer. |
110 ;; If REV2 is "" then use current buffer. | |
33019
6306740f6938
2000-10-29 Michael Kifer <kifer@cs.sunysb.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
26585
diff
changeset
|
111 (let (rev2buf rev1buf) |
6306740f6938
2000-10-29 Michael Kifer <kifer@cs.sunysb.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
26585
diff
changeset
|
112 (save-window-excursion |
6306740f6938
2000-10-29 Michael Kifer <kifer@cs.sunysb.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
26585
diff
changeset
|
113 (setq rev2buf (if (string= rev2 "") |
6306740f6938
2000-10-29 Michael Kifer <kifer@cs.sunysb.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
26585
diff
changeset
|
114 (current-buffer) |
6306740f6938
2000-10-29 Michael Kifer <kifer@cs.sunysb.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
26585
diff
changeset
|
115 (rcs-ediff-view-revision rev2)) |
6306740f6938
2000-10-29 Michael Kifer <kifer@cs.sunysb.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
26585
diff
changeset
|
116 rev1buf (rcs-ediff-view-revision rev1))) |
14234 | 117 |
118 ;; rcs.el doesn't create temp version files, so we don't have to delete | |
119 ;; anything in startup hooks to ediff-buffers | |
120 (ediff-buffers rev1buf rev2buf startup-hooks 'ediff-revision) | |
121 )) | |
122 | |
123 | |
124 ;; GENERIC-SC.el support | |
125 | |
126 (defun generic-sc-get-latest-rev () | |
127 (cond ((eq sc-mode 'CCASE) | |
128 (eval "main/LATEST")) | |
129 (t (eval "")))) | |
130 | |
16248
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
131 (defun ediff-generic-sc-internal (rev1 rev2 &optional startup-hooks) |
14234 | 132 ;; Run Ediff on versions of the current buffer. |
133 ;; If REV2 is "" then compare current buffer with REV1. | |
134 ;; If the current buffer is named `F', the version is named `F.~REV~'. | |
135 ;; If `F.~REV~' already exists, it is used instead of being re-created. | |
136 (let (rev1buf rev2buf) | |
137 (save-excursion | |
138 (if (or (not rev1) (string= rev1 "")) | |
139 (setq rev1 (generic-sc-get-latest-rev))) | |
140 (sc-visit-previous-revision rev1) | |
141 (setq rev1buf (current-buffer))) | |
142 (save-excursion | |
143 (or (string= rev2 "") ; use current buffer | |
144 (sc-visit-previous-revision rev2)) | |
145 (setq rev2buf (current-buffer))) | |
146 (ediff-buffers rev1buf rev2buf startup-hooks 'ediff-revision))) | |
147 | |
148 | |
149 ;;; Merge with Version Control | |
150 | |
20206 | 151 (defun ediff-vc-merge-internal (rev1 rev2 ancestor-rev |
152 &optional startup-hooks merge-buffer-file) | |
14234 | 153 ;; If ANCESTOR-REV non-nil, merge with ancestor |
154 (let (buf1 buf2 ancestor-buf) | |
33019
6306740f6938
2000-10-29 Michael Kifer <kifer@cs.sunysb.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
26585
diff
changeset
|
155 (save-window-excursion |
6306740f6938
2000-10-29 Michael Kifer <kifer@cs.sunysb.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
26585
diff
changeset
|
156 (save-excursion |
6306740f6938
2000-10-29 Michael Kifer <kifer@cs.sunysb.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
26585
diff
changeset
|
157 (vc-version-other-window rev1) |
6306740f6938
2000-10-29 Michael Kifer <kifer@cs.sunysb.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
26585
diff
changeset
|
158 (setq buf1 (current-buffer))) |
6306740f6938
2000-10-29 Michael Kifer <kifer@cs.sunysb.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
26585
diff
changeset
|
159 (save-excursion |
6306740f6938
2000-10-29 Michael Kifer <kifer@cs.sunysb.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
26585
diff
changeset
|
160 (or (string= rev2 "") |
6306740f6938
2000-10-29 Michael Kifer <kifer@cs.sunysb.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
26585
diff
changeset
|
161 (vc-version-other-window rev2)) |
6306740f6938
2000-10-29 Michael Kifer <kifer@cs.sunysb.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
26585
diff
changeset
|
162 (setq buf2 (current-buffer))) |
6306740f6938
2000-10-29 Michael Kifer <kifer@cs.sunysb.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
26585
diff
changeset
|
163 (if ancestor-rev |
6306740f6938
2000-10-29 Michael Kifer <kifer@cs.sunysb.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
26585
diff
changeset
|
164 (save-excursion |
6306740f6938
2000-10-29 Michael Kifer <kifer@cs.sunysb.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
26585
diff
changeset
|
165 (if (string= ancestor-rev "") |
6306740f6938
2000-10-29 Michael Kifer <kifer@cs.sunysb.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
26585
diff
changeset
|
166 (setq ancestor-rev (vc-workfile-version buffer-file-name))) |
6306740f6938
2000-10-29 Michael Kifer <kifer@cs.sunysb.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
26585
diff
changeset
|
167 (vc-version-other-window ancestor-rev) |
6306740f6938
2000-10-29 Michael Kifer <kifer@cs.sunysb.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
26585
diff
changeset
|
168 (setq ancestor-buf (current-buffer)))) |
6306740f6938
2000-10-29 Michael Kifer <kifer@cs.sunysb.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
26585
diff
changeset
|
169 (setq startup-hooks |
6306740f6938
2000-10-29 Michael Kifer <kifer@cs.sunysb.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
26585
diff
changeset
|
170 (cons |
6306740f6938
2000-10-29 Michael Kifer <kifer@cs.sunysb.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
26585
diff
changeset
|
171 `(lambda () |
6306740f6938
2000-10-29 Michael Kifer <kifer@cs.sunysb.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
26585
diff
changeset
|
172 (delete-file ,(buffer-file-name buf1)) |
6306740f6938
2000-10-29 Michael Kifer <kifer@cs.sunysb.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
26585
diff
changeset
|
173 (or ,(string= rev2 "") |
6306740f6938
2000-10-29 Michael Kifer <kifer@cs.sunysb.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
26585
diff
changeset
|
174 (delete-file ,(buffer-file-name buf2))) |
6306740f6938
2000-10-29 Michael Kifer <kifer@cs.sunysb.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
26585
diff
changeset
|
175 (or ,(string= ancestor-rev "") |
6306740f6938
2000-10-29 Michael Kifer <kifer@cs.sunysb.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
26585
diff
changeset
|
176 ,(not ancestor-rev) |
6306740f6938
2000-10-29 Michael Kifer <kifer@cs.sunysb.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
26585
diff
changeset
|
177 (delete-file ,(buffer-file-name ancestor-buf))) |
6306740f6938
2000-10-29 Michael Kifer <kifer@cs.sunysb.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
26585
diff
changeset
|
178 ) |
6306740f6938
2000-10-29 Michael Kifer <kifer@cs.sunysb.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
26585
diff
changeset
|
179 startup-hooks))) |
14234 | 180 (if ancestor-rev |
181 (ediff-merge-buffers-with-ancestor | |
182 buf1 buf2 ancestor-buf | |
20206 | 183 startup-hooks 'ediff-merge-revisions-with-ancestor merge-buffer-file) |
184 (ediff-merge-buffers | |
185 buf1 buf2 startup-hooks 'ediff-merge-revisions merge-buffer-file)) | |
14234 | 186 )) |
187 | |
16248
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
188 (defun ediff-rcs-merge-internal (rev1 rev2 ancestor-rev |
20206 | 189 &optional |
190 startup-hooks merge-buffer-file) | |
14234 | 191 ;; If ANCESTOR-REV non-nil, merge with ancestor |
192 (let (buf1 buf2 ancestor-buf) | |
33019
6306740f6938
2000-10-29 Michael Kifer <kifer@cs.sunysb.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
26585
diff
changeset
|
193 (save-window-excursion |
6306740f6938
2000-10-29 Michael Kifer <kifer@cs.sunysb.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
26585
diff
changeset
|
194 (setq buf1 (rcs-ediff-view-revision rev1) |
6306740f6938
2000-10-29 Michael Kifer <kifer@cs.sunysb.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
26585
diff
changeset
|
195 buf2 (if (string= rev2 "") |
6306740f6938
2000-10-29 Michael Kifer <kifer@cs.sunysb.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
26585
diff
changeset
|
196 (current-buffer) |
6306740f6938
2000-10-29 Michael Kifer <kifer@cs.sunysb.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
26585
diff
changeset
|
197 (rcs-ediff-view-revision rev2)) |
6306740f6938
2000-10-29 Michael Kifer <kifer@cs.sunysb.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
26585
diff
changeset
|
198 ancestor-buf (if ancestor-rev |
6306740f6938
2000-10-29 Michael Kifer <kifer@cs.sunysb.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
26585
diff
changeset
|
199 (if (string= ancestor-rev "") |
6306740f6938
2000-10-29 Michael Kifer <kifer@cs.sunysb.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
26585
diff
changeset
|
200 (current-buffer) |
6306740f6938
2000-10-29 Michael Kifer <kifer@cs.sunysb.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
26585
diff
changeset
|
201 (rcs-ediff-view-revision ancestor-rev))))) |
14234 | 202 ;; rcs.el doesn't create temp version files, so we don't have to delete |
203 ;; anything in startup hooks to ediff-buffers | |
204 (if ancestor-rev | |
205 (ediff-merge-buffers-with-ancestor | |
206 buf1 buf2 ancestor-buf | |
20206 | 207 startup-hooks 'ediff-merge-revisions-with-ancestor merge-buffer-file) |
208 (ediff-merge-buffers | |
209 buf1 buf2 startup-hooks 'ediff-merge-revisions merge-buffer-file)))) | |
14234 | 210 |
16248
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
211 (defun ediff-generic-sc-merge-internal (rev1 rev2 ancestor-rev |
20206 | 212 &optional |
213 startup-hooks merge-buffer-file) | |
14234 | 214 ;; If ANCESTOR-REV non-nil, merge with ancestor |
215 (let (buf1 buf2 ancestor-buf) | |
216 (save-excursion | |
217 (if (string= rev1 "") | |
218 (setq rev1 (generic-sc-get-latest-rev))) | |
219 (sc-visit-previous-revision rev1) | |
220 (setq buf1 (current-buffer))) | |
221 (save-excursion | |
222 (or (string= rev2 "") | |
223 (sc-visit-previous-revision rev2)) | |
224 (setq buf2 (current-buffer))) | |
225 (if ancestor-rev | |
226 (save-excursion | |
227 (or (string= ancestor-rev "") | |
228 (sc-visit-previous-revision ancestor-rev)) | |
229 (setq ancestor-buf (current-buffer)))) | |
230 (if ancestor-rev | |
231 (ediff-merge-buffers-with-ancestor | |
232 buf1 buf2 ancestor-buf | |
20206 | 233 startup-hooks 'ediff-merge-revisions-with-ancestor merge-buffer-file) |
234 (ediff-merge-buffers | |
235 buf1 buf2 startup-hooks 'ediff-merge-revisions merge-buffer-file)))) | |
14234 | 236 |
237 | |
238 ;; PCL-CVS.el support | |
239 | |
240 | |
241 (defun cvs-run-ediff-on-file-descriptor (tin) | |
242 ;; This is a replacement for cvs-emerge-mode | |
20206 | 243 ;; Runs after cvs-update. |
14234 | 244 ;; Ediff-merge appropriate revisions of the selected file. |
245 (let* ((fileinfo (tin-cookie cvs-cookie-handle tin)) | |
246 (type (cvs-fileinfo->type fileinfo)) | |
247 (tmp-file | |
248 (cvs-retrieve-revision-to-tmpfile fileinfo)) | |
20343 | 249 (default-directory |
21940 | 250 (file-name-as-directory (cvs-fileinfo->dir fileinfo))) |
14234 | 251 ancestor-file) |
252 | |
253 (or (memq type '(MERGED CONFLICT MODIFIED)) | |
254 (error | |
255 "Can only merge `Modified', `Merged' or `Conflict' files")) | |
256 | |
257 (cond ((memq type '(MERGED CONFLICT)) | |
258 (setq ancestor-file | |
259 (cvs-retrieve-revision-to-tmpfile | |
260 fileinfo | |
261 ;; revision | |
262 (cvs-fileinfo->base-revision fileinfo))) | |
263 (ediff-merge-buffers-with-ancestor | |
264 (find-file-noselect tmp-file) | |
265 (find-file-noselect (cvs-fileinfo->backup-file fileinfo)) | |
266 (find-file-noselect ancestor-file) | |
267 nil ; startup-hooks | |
268 'ediff-merge-revisions-with-ancestor)) | |
269 ((eq type 'MODIFIED) | |
20343 | 270 (ediff-buffers |
14234 | 271 (find-file-noselect tmp-file) |
272 (find-file-noselect (cvs-fileinfo->full-path fileinfo)) | |
273 nil ; startup-hooks | |
20343 | 274 'ediff-revisions))) |
14234 | 275 (if (stringp tmp-file) (delete-file tmp-file)) |
276 (if (stringp ancestor-file) (delete-file ancestor-file)))) | |
277 | |
278 ;;; Local Variables: | |
279 ;;; eval: (put 'ediff-defvar-local 'lisp-indent-hook 'defun) | |
19047 | 280 ;;; eval: (put 'ediff-with-current-buffer 'lisp-indent-hook 1) |
281 ;;; eval: (put 'ediff-with-current-buffer 'edebug-form-spec '(form body)) | |
14234 | 282 ;;; End: |
283 | |
284 (provide 'ediff-vers) | |
285 | |
286 ;;; ediff-vers.el ends here |