Mercurial > emacs
annotate lisp/ediff-vers.el @ 34097:0225d8e15f2c
(coordinates_in_window): Handle computations for
positions on the vertical bar and fringes differently for
window-system frames. Consider some pixels near the vertical bar
as on the bar if the frame doesn't have vertical scroll bars.
Associate positions between mode or header lines with the
right window, the left one.
author | Gerd Moellmann <gerd@gnu.org> |
---|---|
date | Fri, 01 Dec 2000 20:44:31 +0000 |
parents | f8c8c2d3538e |
children | 1b58126efb71 |
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 | |
33391
f8c8c2d3538e
(rcs-ediff-view-revision): Put temp buffer into
Dave Love <fx@gnu.org>
parents:
33019
diff
changeset
|
83 (ediff-with-current-buffer standard-output |
f8c8c2d3538e
(rcs-ediff-view-revision): Put temp buffer into
Dave Love <fx@gnu.org>
parents:
33019
diff
changeset
|
84 (fundamental-mode)) |
14234 | 85 (let ((output-buffer (ediff-rcs-get-output-buffer filename buff))) |
86 (delete-windows-on output-buffer) | |
87 (save-excursion | |
88 (set-buffer output-buffer) | |
89 (apply 'call-process "co" nil t nil | |
90 ;; -q: quiet (no diagnostics) | |
91 (append switches rcs-default-co-switches | |
92 (list "-q" filename))))) | |
93 (message "") | |
94 buff))) | |
95 | |
96 (defun ediff-rcs-get-output-buffer (file name) | |
97 ;; Get a buffer for RCS output for FILE, make it writable and clean it up. | |
98 ;; 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
|
99 ;; This is a modified version from rcs.el v1.1. I use it here to make |
14234 | 100 ;; Ediff immune to changes in rcs.el |
101 (let* ((default-major-mode 'fundamental-mode) ; no frills! | |
102 (buf (get-buffer-create name))) | |
103 (save-excursion | |
104 (set-buffer buf) | |
105 (setq buffer-read-only nil | |
106 default-directory (file-name-directory (expand-file-name file))) | |
107 (erase-buffer)) | |
108 buf)) | |
109 | |
16248
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
110 (defun ediff-rcs-internal (rev1 rev2 &optional startup-hooks) |
14234 | 111 ;; Run Ediff on versions of the current buffer. |
112 ;; 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
|
113 (let (rev2buf rev1buf) |
6306740f6938
2000-10-29 Michael Kifer <kifer@cs.sunysb.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
26585
diff
changeset
|
114 (save-window-excursion |
6306740f6938
2000-10-29 Michael Kifer <kifer@cs.sunysb.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
26585
diff
changeset
|
115 (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
|
116 (current-buffer) |
6306740f6938
2000-10-29 Michael Kifer <kifer@cs.sunysb.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
26585
diff
changeset
|
117 (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
|
118 rev1buf (rcs-ediff-view-revision rev1))) |
14234 | 119 |
120 ;; rcs.el doesn't create temp version files, so we don't have to delete | |
121 ;; anything in startup hooks to ediff-buffers | |
122 (ediff-buffers rev1buf rev2buf startup-hooks 'ediff-revision) | |
123 )) | |
124 | |
125 | |
126 ;; GENERIC-SC.el support | |
127 | |
128 (defun generic-sc-get-latest-rev () | |
129 (cond ((eq sc-mode 'CCASE) | |
130 (eval "main/LATEST")) | |
131 (t (eval "")))) | |
132 | |
16248
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
133 (defun ediff-generic-sc-internal (rev1 rev2 &optional startup-hooks) |
14234 | 134 ;; Run Ediff on versions of the current buffer. |
135 ;; If REV2 is "" then compare current buffer with REV1. | |
136 ;; If the current buffer is named `F', the version is named `F.~REV~'. | |
137 ;; If `F.~REV~' already exists, it is used instead of being re-created. | |
138 (let (rev1buf rev2buf) | |
139 (save-excursion | |
140 (if (or (not rev1) (string= rev1 "")) | |
141 (setq rev1 (generic-sc-get-latest-rev))) | |
142 (sc-visit-previous-revision rev1) | |
143 (setq rev1buf (current-buffer))) | |
144 (save-excursion | |
145 (or (string= rev2 "") ; use current buffer | |
146 (sc-visit-previous-revision rev2)) | |
147 (setq rev2buf (current-buffer))) | |
148 (ediff-buffers rev1buf rev2buf startup-hooks 'ediff-revision))) | |
149 | |
150 | |
151 ;;; Merge with Version Control | |
152 | |
20206 | 153 (defun ediff-vc-merge-internal (rev1 rev2 ancestor-rev |
154 &optional startup-hooks merge-buffer-file) | |
14234 | 155 ;; If ANCESTOR-REV non-nil, merge with ancestor |
156 (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
|
157 (save-window-excursion |
6306740f6938
2000-10-29 Michael Kifer <kifer@cs.sunysb.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
26585
diff
changeset
|
158 (save-excursion |
6306740f6938
2000-10-29 Michael Kifer <kifer@cs.sunysb.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
26585
diff
changeset
|
159 (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
|
160 (setq buf1 (current-buffer))) |
6306740f6938
2000-10-29 Michael Kifer <kifer@cs.sunysb.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
26585
diff
changeset
|
161 (save-excursion |
6306740f6938
2000-10-29 Michael Kifer <kifer@cs.sunysb.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
26585
diff
changeset
|
162 (or (string= rev2 "") |
6306740f6938
2000-10-29 Michael Kifer <kifer@cs.sunysb.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
26585
diff
changeset
|
163 (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
|
164 (setq buf2 (current-buffer))) |
6306740f6938
2000-10-29 Michael Kifer <kifer@cs.sunysb.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
26585
diff
changeset
|
165 (if ancestor-rev |
6306740f6938
2000-10-29 Michael Kifer <kifer@cs.sunysb.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
26585
diff
changeset
|
166 (save-excursion |
6306740f6938
2000-10-29 Michael Kifer <kifer@cs.sunysb.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
26585
diff
changeset
|
167 (if (string= 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-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
|
169 (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
|
170 (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
|
171 (setq startup-hooks |
6306740f6938
2000-10-29 Michael Kifer <kifer@cs.sunysb.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
26585
diff
changeset
|
172 (cons |
6306740f6938
2000-10-29 Michael Kifer <kifer@cs.sunysb.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
26585
diff
changeset
|
173 `(lambda () |
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 buf1)) |
6306740f6938
2000-10-29 Michael Kifer <kifer@cs.sunysb.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
26585
diff
changeset
|
175 (or ,(string= rev2 "") |
6306740f6938
2000-10-29 Michael Kifer <kifer@cs.sunysb.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
26585
diff
changeset
|
176 (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
|
177 (or ,(string= ancestor-rev "") |
6306740f6938
2000-10-29 Michael Kifer <kifer@cs.sunysb.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
26585
diff
changeset
|
178 ,(not ancestor-rev) |
6306740f6938
2000-10-29 Michael Kifer <kifer@cs.sunysb.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
26585
diff
changeset
|
179 (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
|
180 ) |
6306740f6938
2000-10-29 Michael Kifer <kifer@cs.sunysb.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
26585
diff
changeset
|
181 startup-hooks))) |
14234 | 182 (if ancestor-rev |
183 (ediff-merge-buffers-with-ancestor | |
184 buf1 buf2 ancestor-buf | |
20206 | 185 startup-hooks 'ediff-merge-revisions-with-ancestor merge-buffer-file) |
186 (ediff-merge-buffers | |
187 buf1 buf2 startup-hooks 'ediff-merge-revisions merge-buffer-file)) | |
14234 | 188 )) |
189 | |
16248
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
190 (defun ediff-rcs-merge-internal (rev1 rev2 ancestor-rev |
20206 | 191 &optional |
192 startup-hooks merge-buffer-file) | |
14234 | 193 ;; If ANCESTOR-REV non-nil, merge with ancestor |
194 (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
|
195 (save-window-excursion |
6306740f6938
2000-10-29 Michael Kifer <kifer@cs.sunysb.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
26585
diff
changeset
|
196 (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
|
197 buf2 (if (string= rev2 "") |
6306740f6938
2000-10-29 Michael Kifer <kifer@cs.sunysb.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
26585
diff
changeset
|
198 (current-buffer) |
6306740f6938
2000-10-29 Michael Kifer <kifer@cs.sunysb.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
26585
diff
changeset
|
199 (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
|
200 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
|
201 (if (string= ancestor-rev "") |
6306740f6938
2000-10-29 Michael Kifer <kifer@cs.sunysb.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
26585
diff
changeset
|
202 (current-buffer) |
6306740f6938
2000-10-29 Michael Kifer <kifer@cs.sunysb.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
26585
diff
changeset
|
203 (rcs-ediff-view-revision ancestor-rev))))) |
14234 | 204 ;; rcs.el doesn't create temp version files, so we don't have to delete |
205 ;; anything in startup hooks to ediff-buffers | |
206 (if ancestor-rev | |
207 (ediff-merge-buffers-with-ancestor | |
208 buf1 buf2 ancestor-buf | |
20206 | 209 startup-hooks 'ediff-merge-revisions-with-ancestor merge-buffer-file) |
210 (ediff-merge-buffers | |
211 buf1 buf2 startup-hooks 'ediff-merge-revisions merge-buffer-file)))) | |
14234 | 212 |
16248
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
213 (defun ediff-generic-sc-merge-internal (rev1 rev2 ancestor-rev |
20206 | 214 &optional |
215 startup-hooks merge-buffer-file) | |
14234 | 216 ;; If ANCESTOR-REV non-nil, merge with ancestor |
217 (let (buf1 buf2 ancestor-buf) | |
218 (save-excursion | |
219 (if (string= rev1 "") | |
220 (setq rev1 (generic-sc-get-latest-rev))) | |
221 (sc-visit-previous-revision rev1) | |
222 (setq buf1 (current-buffer))) | |
223 (save-excursion | |
224 (or (string= rev2 "") | |
225 (sc-visit-previous-revision rev2)) | |
226 (setq buf2 (current-buffer))) | |
227 (if ancestor-rev | |
228 (save-excursion | |
229 (or (string= ancestor-rev "") | |
230 (sc-visit-previous-revision ancestor-rev)) | |
231 (setq ancestor-buf (current-buffer)))) | |
232 (if ancestor-rev | |
233 (ediff-merge-buffers-with-ancestor | |
234 buf1 buf2 ancestor-buf | |
20206 | 235 startup-hooks 'ediff-merge-revisions-with-ancestor merge-buffer-file) |
236 (ediff-merge-buffers | |
237 buf1 buf2 startup-hooks 'ediff-merge-revisions merge-buffer-file)))) | |
14234 | 238 |
239 | |
240 ;; PCL-CVS.el support | |
241 | |
242 | |
243 (defun cvs-run-ediff-on-file-descriptor (tin) | |
244 ;; This is a replacement for cvs-emerge-mode | |
20206 | 245 ;; Runs after cvs-update. |
14234 | 246 ;; Ediff-merge appropriate revisions of the selected file. |
247 (let* ((fileinfo (tin-cookie cvs-cookie-handle tin)) | |
248 (type (cvs-fileinfo->type fileinfo)) | |
249 (tmp-file | |
250 (cvs-retrieve-revision-to-tmpfile fileinfo)) | |
20343 | 251 (default-directory |
21940 | 252 (file-name-as-directory (cvs-fileinfo->dir fileinfo))) |
14234 | 253 ancestor-file) |
254 | |
255 (or (memq type '(MERGED CONFLICT MODIFIED)) | |
256 (error | |
257 "Can only merge `Modified', `Merged' or `Conflict' files")) | |
258 | |
259 (cond ((memq type '(MERGED CONFLICT)) | |
260 (setq ancestor-file | |
261 (cvs-retrieve-revision-to-tmpfile | |
262 fileinfo | |
263 ;; revision | |
264 (cvs-fileinfo->base-revision fileinfo))) | |
265 (ediff-merge-buffers-with-ancestor | |
266 (find-file-noselect tmp-file) | |
267 (find-file-noselect (cvs-fileinfo->backup-file fileinfo)) | |
268 (find-file-noselect ancestor-file) | |
269 nil ; startup-hooks | |
270 'ediff-merge-revisions-with-ancestor)) | |
271 ((eq type 'MODIFIED) | |
20343 | 272 (ediff-buffers |
14234 | 273 (find-file-noselect tmp-file) |
274 (find-file-noselect (cvs-fileinfo->full-path fileinfo)) | |
275 nil ; startup-hooks | |
20343 | 276 'ediff-revisions))) |
14234 | 277 (if (stringp tmp-file) (delete-file tmp-file)) |
278 (if (stringp ancestor-file) (delete-file ancestor-file)))) | |
279 | |
280 ;;; Local Variables: | |
281 ;;; eval: (put 'ediff-defvar-local 'lisp-indent-hook 'defun) | |
19047 | 282 ;;; eval: (put 'ediff-with-current-buffer 'lisp-indent-hook 1) |
283 ;;; eval: (put 'ediff-with-current-buffer 'edebug-form-spec '(form body)) | |
14234 | 284 ;;; End: |
285 | |
286 (provide 'ediff-vers) | |
287 | |
288 ;;; ediff-vers.el ends here |