Mercurial > emacs
annotate lisp/ediff-vers.el @ 42903:52001b0494dd
(Trailing Whitespace): Add index entry for fringe usage.
author | Eli Zaretskii <eliz@gnu.org> |
---|---|
date | Tue, 22 Jan 2002 11:27:49 +0000 |
parents | 633233bf2bbf |
children | 0f80cb4f9d29 |
rev | line source |
---|---|
14234 | 1 ;;; ediff-vers.el --- version control interface to Ediff |
2 | |
42602
633233bf2bbf
2002-01-07 Michael Kifer <kifer@cs.stonybrook.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
38422
diff
changeset
|
3 ;;; Copyright (C) 1995, 96, 97, 2002 Free Software Foundation, Inc. |
14234 | 4 |
42602
633233bf2bbf
2002-01-07 Michael Kifer <kifer@cs.stonybrook.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
38422
diff
changeset
|
5 ;; Author: Michael Kifer <kifer@cs.stonybrook.edu> |
14234 | 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 | |
38422
7a94f1c588c4
Some fixes to follow coding conventions.
Pavel Janík <Pavel@Janik.cz>
parents:
35109
diff
changeset
|
24 ;;; Commentary: |
14234 | 25 |
26 ;;; Code: | |
15480
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14234
diff
changeset
|
27 |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14234
diff
changeset
|
28 ;; Compiler pacifier |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14234
diff
changeset
|
29 (defvar rcs-default-co-switches) |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14234
diff
changeset
|
30 (defvar sc-mode) |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14234
diff
changeset
|
31 (defvar cvs-shell) |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14234
diff
changeset
|
32 (defvar cvs-program) |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14234
diff
changeset
|
33 (defvar cvs-cookie-handle) |
18054 | 34 (defvar ediff-temp-file-prefix) |
15480
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14234
diff
changeset
|
35 |
16248
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
36 (and noninteractive |
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
37 (eval-when-compile |
42602
633233bf2bbf
2002-01-07 Michael Kifer <kifer@cs.stonybrook.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
38422
diff
changeset
|
38 (let ((load-path (cons (expand-file-name ".") load-path))) |
633233bf2bbf
2002-01-07 Michael Kifer <kifer@cs.stonybrook.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
38422
diff
changeset
|
39 (load "pcl-cvs" 'noerror) |
633233bf2bbf
2002-01-07 Michael Kifer <kifer@cs.stonybrook.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
38422
diff
changeset
|
40 (load "rcs" 'noerror) |
633233bf2bbf
2002-01-07 Michael Kifer <kifer@cs.stonybrook.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
38422
diff
changeset
|
41 ;; On 8+3 MS-DOS filesystems, generic-x.el is loaded |
633233bf2bbf
2002-01-07 Michael Kifer <kifer@cs.stonybrook.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
38422
diff
changeset
|
42 ;; instead of (the missing) generic-sc.el. Since the |
633233bf2bbf
2002-01-07 Michael Kifer <kifer@cs.stonybrook.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
38422
diff
changeset
|
43 ;; version of Emacs which supports MS-DOS doesn't have |
633233bf2bbf
2002-01-07 Michael Kifer <kifer@cs.stonybrook.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
38422
diff
changeset
|
44 ;; generic-sc, we simply avoid loading it. |
633233bf2bbf
2002-01-07 Michael Kifer <kifer@cs.stonybrook.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
38422
diff
changeset
|
45 (or (and (fboundp 'msdos-long-file-names) |
633233bf2bbf
2002-01-07 Michael Kifer <kifer@cs.stonybrook.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
38422
diff
changeset
|
46 (not (msdos-long-file-names))) |
633233bf2bbf
2002-01-07 Michael Kifer <kifer@cs.stonybrook.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
38422
diff
changeset
|
47 (load "generic-sc" 'noerror)) |
633233bf2bbf
2002-01-07 Michael Kifer <kifer@cs.stonybrook.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
38422
diff
changeset
|
48 ;; (load "vc" 'noerror) ; this sometimes causes compiler error |
633233bf2bbf
2002-01-07 Michael Kifer <kifer@cs.stonybrook.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
38422
diff
changeset
|
49 (or (featurep 'ediff-init) |
633233bf2bbf
2002-01-07 Michael Kifer <kifer@cs.stonybrook.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
38422
diff
changeset
|
50 (load "ediff-init.el" nil nil 'nosuffix)) |
633233bf2bbf
2002-01-07 Michael Kifer <kifer@cs.stonybrook.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
38422
diff
changeset
|
51 ))) |
15480
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14234
diff
changeset
|
52 ;; end pacifier |
14234 | 53 |
54 ;; VC.el support | |
16248
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
55 (defun ediff-vc-internal (rev1 rev2 &optional startup-hooks) |
14234 | 56 ;; Run Ediff on versions of the current buffer. |
57 ;; If REV2 is "" then compare current buffer with REV1. | |
58 ;; If the current buffer is named `F', the version is named `F.~REV~'. | |
59 ;; If `F.~REV~' already exists, it is used instead of being re-created. | |
60 (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
|
61 (save-window-excursion |
6306740f6938
2000-10-29 Michael Kifer <kifer@cs.sunysb.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
26585
diff
changeset
|
62 (save-excursion |
6306740f6938
2000-10-29 Michael Kifer <kifer@cs.sunysb.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
26585
diff
changeset
|
63 (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
|
64 (setq rev1buf (current-buffer) |
6306740f6938
2000-10-29 Michael Kifer <kifer@cs.sunysb.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
26585
diff
changeset
|
65 file1 (buffer-file-name))) |
6306740f6938
2000-10-29 Michael Kifer <kifer@cs.sunysb.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
26585
diff
changeset
|
66 (save-excursion |
6306740f6938
2000-10-29 Michael Kifer <kifer@cs.sunysb.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
26585
diff
changeset
|
67 (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
|
68 (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
|
69 (setq rev2buf (current-buffer) |
6306740f6938
2000-10-29 Michael Kifer <kifer@cs.sunysb.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
26585
diff
changeset
|
70 file2 (buffer-file-name))) |
6306740f6938
2000-10-29 Michael Kifer <kifer@cs.sunysb.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
26585
diff
changeset
|
71 (setq startup-hooks |
6306740f6938
2000-10-29 Michael Kifer <kifer@cs.sunysb.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
26585
diff
changeset
|
72 (cons `(lambda () |
6306740f6938
2000-10-29 Michael Kifer <kifer@cs.sunysb.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
26585
diff
changeset
|
73 (delete-file ,file1) |
6306740f6938
2000-10-29 Michael Kifer <kifer@cs.sunysb.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
26585
diff
changeset
|
74 (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
|
75 startup-hooks))) |
14234 | 76 (ediff-buffers |
77 rev1buf rev2buf | |
78 startup-hooks | |
79 'ediff-revision))) | |
80 | |
81 ;; RCS.el support | |
82 (defun rcs-ediff-view-revision (&optional rev) | |
83 ;; View previous RCS revision of current file. | |
84 ;; With prefix argument, prompts for a revision name. | |
85 (interactive (list (if current-prefix-arg | |
86 (read-string "Revision: ")))) | |
87 (let* ((filename (buffer-file-name (current-buffer))) | |
88 (switches (append '("-p") | |
89 (if rev (list (concat "-r" rev)) nil))) | |
90 (buff (concat (file-name-nondirectory filename) ".~" rev "~"))) | |
91 (message "Working ...") | |
92 (setq filename (expand-file-name filename)) | |
93 (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
|
94 (ediff-with-current-buffer standard-output |
f8c8c2d3538e
(rcs-ediff-view-revision): Put temp buffer into
Dave Love <fx@gnu.org>
parents:
33019
diff
changeset
|
95 (fundamental-mode)) |
14234 | 96 (let ((output-buffer (ediff-rcs-get-output-buffer filename buff))) |
97 (delete-windows-on output-buffer) | |
98 (save-excursion | |
99 (set-buffer output-buffer) | |
100 (apply 'call-process "co" nil t nil | |
101 ;; -q: quiet (no diagnostics) | |
102 (append switches rcs-default-co-switches | |
103 (list "-q" filename))))) | |
104 (message "") | |
105 buff))) | |
106 | |
107 (defun ediff-rcs-get-output-buffer (file name) | |
108 ;; Get a buffer for RCS output for FILE, make it writable and clean it up. | |
109 ;; 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
|
110 ;; This is a modified version from rcs.el v1.1. I use it here to make |
14234 | 111 ;; Ediff immune to changes in rcs.el |
112 (let* ((default-major-mode 'fundamental-mode) ; no frills! | |
113 (buf (get-buffer-create name))) | |
114 (save-excursion | |
115 (set-buffer buf) | |
116 (setq buffer-read-only nil | |
117 default-directory (file-name-directory (expand-file-name file))) | |
118 (erase-buffer)) | |
119 buf)) | |
120 | |
16248
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
121 (defun ediff-rcs-internal (rev1 rev2 &optional startup-hooks) |
14234 | 122 ;; Run Ediff on versions of the current buffer. |
123 ;; 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
|
124 (let (rev2buf rev1buf) |
6306740f6938
2000-10-29 Michael Kifer <kifer@cs.sunysb.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
26585
diff
changeset
|
125 (save-window-excursion |
6306740f6938
2000-10-29 Michael Kifer <kifer@cs.sunysb.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
26585
diff
changeset
|
126 (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
|
127 (current-buffer) |
6306740f6938
2000-10-29 Michael Kifer <kifer@cs.sunysb.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
26585
diff
changeset
|
128 (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
|
129 rev1buf (rcs-ediff-view-revision rev1))) |
14234 | 130 |
131 ;; rcs.el doesn't create temp version files, so we don't have to delete | |
132 ;; anything in startup hooks to ediff-buffers | |
133 (ediff-buffers rev1buf rev2buf startup-hooks 'ediff-revision) | |
134 )) | |
135 | |
136 | |
137 ;; GENERIC-SC.el support | |
138 | |
139 (defun generic-sc-get-latest-rev () | |
140 (cond ((eq sc-mode 'CCASE) | |
141 (eval "main/LATEST")) | |
142 (t (eval "")))) | |
143 | |
16248
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
144 (defun ediff-generic-sc-internal (rev1 rev2 &optional startup-hooks) |
14234 | 145 ;; Run Ediff on versions of the current buffer. |
146 ;; If REV2 is "" then compare current buffer with REV1. | |
147 ;; If the current buffer is named `F', the version is named `F.~REV~'. | |
148 ;; If `F.~REV~' already exists, it is used instead of being re-created. | |
149 (let (rev1buf rev2buf) | |
150 (save-excursion | |
151 (if (or (not rev1) (string= rev1 "")) | |
152 (setq rev1 (generic-sc-get-latest-rev))) | |
153 (sc-visit-previous-revision rev1) | |
154 (setq rev1buf (current-buffer))) | |
155 (save-excursion | |
156 (or (string= rev2 "") ; use current buffer | |
157 (sc-visit-previous-revision rev2)) | |
158 (setq rev2buf (current-buffer))) | |
159 (ediff-buffers rev1buf rev2buf startup-hooks 'ediff-revision))) | |
160 | |
161 | |
162 ;;; Merge with Version Control | |
163 | |
20206 | 164 (defun ediff-vc-merge-internal (rev1 rev2 ancestor-rev |
165 &optional startup-hooks merge-buffer-file) | |
14234 | 166 ;; If ANCESTOR-REV non-nil, merge with ancestor |
167 (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
|
168 (save-window-excursion |
6306740f6938
2000-10-29 Michael Kifer <kifer@cs.sunysb.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
26585
diff
changeset
|
169 (save-excursion |
6306740f6938
2000-10-29 Michael Kifer <kifer@cs.sunysb.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
26585
diff
changeset
|
170 (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
|
171 (setq buf1 (current-buffer))) |
6306740f6938
2000-10-29 Michael Kifer <kifer@cs.sunysb.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
26585
diff
changeset
|
172 (save-excursion |
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 (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
|
175 (setq buf2 (current-buffer))) |
6306740f6938
2000-10-29 Michael Kifer <kifer@cs.sunysb.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
26585
diff
changeset
|
176 (if ancestor-rev |
6306740f6938
2000-10-29 Michael Kifer <kifer@cs.sunysb.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
26585
diff
changeset
|
177 (save-excursion |
6306740f6938
2000-10-29 Michael Kifer <kifer@cs.sunysb.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
26585
diff
changeset
|
178 (if (string= ancestor-rev "") |
6306740f6938
2000-10-29 Michael Kifer <kifer@cs.sunysb.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
26585
diff
changeset
|
179 (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
|
180 (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
|
181 (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
|
182 (setq startup-hooks |
6306740f6938
2000-10-29 Michael Kifer <kifer@cs.sunysb.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
26585
diff
changeset
|
183 (cons |
6306740f6938
2000-10-29 Michael Kifer <kifer@cs.sunysb.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
26585
diff
changeset
|
184 `(lambda () |
6306740f6938
2000-10-29 Michael Kifer <kifer@cs.sunysb.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
26585
diff
changeset
|
185 (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
|
186 (or ,(string= rev2 "") |
6306740f6938
2000-10-29 Michael Kifer <kifer@cs.sunysb.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
26585
diff
changeset
|
187 (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
|
188 (or ,(string= ancestor-rev "") |
6306740f6938
2000-10-29 Michael Kifer <kifer@cs.sunysb.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
26585
diff
changeset
|
189 ,(not ancestor-rev) |
6306740f6938
2000-10-29 Michael Kifer <kifer@cs.sunysb.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
26585
diff
changeset
|
190 (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
|
191 ) |
6306740f6938
2000-10-29 Michael Kifer <kifer@cs.sunysb.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
26585
diff
changeset
|
192 startup-hooks))) |
14234 | 193 (if ancestor-rev |
194 (ediff-merge-buffers-with-ancestor | |
195 buf1 buf2 ancestor-buf | |
20206 | 196 startup-hooks 'ediff-merge-revisions-with-ancestor merge-buffer-file) |
197 (ediff-merge-buffers | |
198 buf1 buf2 startup-hooks 'ediff-merge-revisions merge-buffer-file)) | |
14234 | 199 )) |
200 | |
16248
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
201 (defun ediff-rcs-merge-internal (rev1 rev2 ancestor-rev |
20206 | 202 &optional |
203 startup-hooks merge-buffer-file) | |
14234 | 204 ;; If ANCESTOR-REV non-nil, merge with ancestor |
205 (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
|
206 (save-window-excursion |
6306740f6938
2000-10-29 Michael Kifer <kifer@cs.sunysb.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
26585
diff
changeset
|
207 (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
|
208 buf2 (if (string= rev2 "") |
6306740f6938
2000-10-29 Michael Kifer <kifer@cs.sunysb.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
26585
diff
changeset
|
209 (current-buffer) |
6306740f6938
2000-10-29 Michael Kifer <kifer@cs.sunysb.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
26585
diff
changeset
|
210 (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
|
211 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
|
212 (if (string= ancestor-rev "") |
6306740f6938
2000-10-29 Michael Kifer <kifer@cs.sunysb.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
26585
diff
changeset
|
213 (current-buffer) |
6306740f6938
2000-10-29 Michael Kifer <kifer@cs.sunysb.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
26585
diff
changeset
|
214 (rcs-ediff-view-revision ancestor-rev))))) |
14234 | 215 ;; rcs.el doesn't create temp version files, so we don't have to delete |
216 ;; anything in startup hooks to ediff-buffers | |
217 (if ancestor-rev | |
218 (ediff-merge-buffers-with-ancestor | |
219 buf1 buf2 ancestor-buf | |
20206 | 220 startup-hooks 'ediff-merge-revisions-with-ancestor merge-buffer-file) |
221 (ediff-merge-buffers | |
222 buf1 buf2 startup-hooks 'ediff-merge-revisions merge-buffer-file)))) | |
14234 | 223 |
16248
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
224 (defun ediff-generic-sc-merge-internal (rev1 rev2 ancestor-rev |
20206 | 225 &optional |
226 startup-hooks merge-buffer-file) | |
14234 | 227 ;; If ANCESTOR-REV non-nil, merge with ancestor |
228 (let (buf1 buf2 ancestor-buf) | |
229 (save-excursion | |
230 (if (string= rev1 "") | |
231 (setq rev1 (generic-sc-get-latest-rev))) | |
232 (sc-visit-previous-revision rev1) | |
233 (setq buf1 (current-buffer))) | |
234 (save-excursion | |
235 (or (string= rev2 "") | |
236 (sc-visit-previous-revision rev2)) | |
237 (setq buf2 (current-buffer))) | |
238 (if ancestor-rev | |
239 (save-excursion | |
240 (or (string= ancestor-rev "") | |
241 (sc-visit-previous-revision ancestor-rev)) | |
242 (setq ancestor-buf (current-buffer)))) | |
243 (if ancestor-rev | |
244 (ediff-merge-buffers-with-ancestor | |
245 buf1 buf2 ancestor-buf | |
20206 | 246 startup-hooks 'ediff-merge-revisions-with-ancestor merge-buffer-file) |
247 (ediff-merge-buffers | |
248 buf1 buf2 startup-hooks 'ediff-merge-revisions merge-buffer-file)))) | |
14234 | 249 |
250 | |
251 ;; PCL-CVS.el support | |
252 | |
42602
633233bf2bbf
2002-01-07 Michael Kifer <kifer@cs.stonybrook.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
38422
diff
changeset
|
253 ;; MK: Check. This function doesn't seem to be used any more by pcvs or pcl-cvs |
14234 | 254 (defun cvs-run-ediff-on-file-descriptor (tin) |
255 ;; This is a replacement for cvs-emerge-mode | |
20206 | 256 ;; Runs after cvs-update. |
14234 | 257 ;; Ediff-merge appropriate revisions of the selected file. |
258 (let* ((fileinfo (tin-cookie cvs-cookie-handle tin)) | |
259 (type (cvs-fileinfo->type fileinfo)) | |
260 (tmp-file | |
261 (cvs-retrieve-revision-to-tmpfile fileinfo)) | |
20343 | 262 (default-directory |
21940 | 263 (file-name-as-directory (cvs-fileinfo->dir fileinfo))) |
14234 | 264 ancestor-file) |
265 | |
266 (or (memq type '(MERGED CONFLICT MODIFIED)) | |
267 (error | |
268 "Can only merge `Modified', `Merged' or `Conflict' files")) | |
269 | |
270 (cond ((memq type '(MERGED CONFLICT)) | |
271 (setq ancestor-file | |
272 (cvs-retrieve-revision-to-tmpfile | |
273 fileinfo | |
274 ;; revision | |
275 (cvs-fileinfo->base-revision fileinfo))) | |
276 (ediff-merge-buffers-with-ancestor | |
277 (find-file-noselect tmp-file) | |
278 (find-file-noselect (cvs-fileinfo->backup-file fileinfo)) | |
279 (find-file-noselect ancestor-file) | |
280 nil ; startup-hooks | |
281 'ediff-merge-revisions-with-ancestor)) | |
282 ((eq type 'MODIFIED) | |
20343 | 283 (ediff-buffers |
14234 | 284 (find-file-noselect tmp-file) |
285 (find-file-noselect (cvs-fileinfo->full-path fileinfo)) | |
286 nil ; startup-hooks | |
20343 | 287 'ediff-revisions))) |
14234 | 288 (if (stringp tmp-file) (delete-file tmp-file)) |
289 (if (stringp ancestor-file) (delete-file ancestor-file)))) | |
290 | |
291 ;;; Local Variables: | |
292 ;;; eval: (put 'ediff-defvar-local 'lisp-indent-hook 'defun) | |
19047 | 293 ;;; eval: (put 'ediff-with-current-buffer 'lisp-indent-hook 1) |
294 ;;; eval: (put 'ediff-with-current-buffer 'edebug-form-spec '(form body)) | |
14234 | 295 ;;; End: |
296 | |
297 (provide 'ediff-vers) | |
298 | |
299 ;;; ediff-vers.el ends here |