annotate lisp/ediff-vers.el @ 14596:afb84c1d7750

(decipher-mode, decipher-set-map, decipher-insert, decipher-make-checkpoint, decipher-resync): Added special support for font-lock. (decipher-use-font-lock, decipher-font-lock-keywords): New vars. (decipher-toggle-font-lock, decipher-turn-on-font-lock): New funcs.
author Karl Heuer <kwzh@gnu.org>
date Mon, 19 Feb 1996 07:52:24 +0000
parents 685f31261967
children 43a3308fcf61
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
14234
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
1 ;;; ediff-vers.el --- version control interface to Ediff
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
2
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
3 ;;; Copyright (C) 1994, 1995 Free Software Foundation, Inc.
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
4
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
5 ;; Author: Michael Kifer <kifer@cs.sunysb.edu>
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
6
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
7 ;; This file is part of GNU Emacs.
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
8
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
9 ;; GNU Emacs is free software; you can redistribute it and/or modify
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
10 ;; it under the terms of the GNU General Public License as published by
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
11 ;; the Free Software Foundation; either version 2, or (at your option)
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
12 ;; any later version.
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
13
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
14 ;; GNU Emacs is distributed in the hope that it will be useful,
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
15 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
16 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
17 ;; GNU General Public License for more details.
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
18
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
19 ;; You should have received a copy of the GNU General Public License
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
20 ;; along with GNU Emacs; see the file COPYING. If not, write to the
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
21 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
22 ;; Boston, MA 02111-1307, USA.
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
23
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
24
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
25 ;;; Code:
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
26
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
27 ;; VC.el support
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
28 (defun vc-ediff-internal (rev1 rev2 &optional startup-hooks)
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
29 ;; Run Ediff on versions of the current buffer.
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
30 ;; If REV2 is "" then compare current buffer with REV1.
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
31 ;; If the current buffer is named `F', the version is named `F.~REV~'.
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
32 ;; If `F.~REV~' already exists, it is used instead of being re-created.
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
33 (let (file1 file2 rev1buf rev2buf)
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
34 (save-excursion
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
35 (vc-version-other-window rev1)
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
36 (setq rev1buf (current-buffer)
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
37 file1 (buffer-file-name)))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
38 (save-excursion
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
39 (or (string= rev2 "") ; use current buffer
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
40 (vc-version-other-window rev2))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
41 (setq rev2buf (current-buffer)
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
42 file2 (buffer-file-name)))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
43 (setq startup-hooks
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
44 (cons (` (lambda ()
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
45 (delete-file (, file1))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
46 (or (, (string= rev2 "")) (delete-file (, file2)))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
47 ))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
48 startup-hooks))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
49 (ediff-buffers
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
50 rev1buf rev2buf
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
51 startup-hooks
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
52 'ediff-revision)))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
53
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
54 ;; RCS.el support
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
55 (defun rcs-ediff-view-revision (&optional rev)
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
56 ;; View previous RCS revision of current file.
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
57 ;; With prefix argument, prompts for a revision name.
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
58 (interactive (list (if current-prefix-arg
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
59 (read-string "Revision: "))))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
60 (let* ((filename (buffer-file-name (current-buffer)))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
61 (switches (append '("-p")
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
62 (if rev (list (concat "-r" rev)) nil)))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
63 (buff (concat (file-name-nondirectory filename) ".~" rev "~")))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
64 (message "Working ...")
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
65 (setq filename (expand-file-name filename))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
66 (with-output-to-temp-buffer buff
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
67 (let ((output-buffer (ediff-rcs-get-output-buffer filename buff)))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
68 (delete-windows-on output-buffer)
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
69 (save-excursion
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
70 (set-buffer output-buffer)
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
71 (apply 'call-process "co" nil t nil
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
72 ;; -q: quiet (no diagnostics)
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
73 (append switches rcs-default-co-switches
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
74 (list "-q" filename)))))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
75 (message "")
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
76 buff)))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
77
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
78 (defun ediff-rcs-get-output-buffer (file name)
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
79 ;; Get a buffer for RCS output for FILE, make it writable and clean it up.
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
80 ;; Optional NAME is name to use instead of `*RCS-output*'.
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
81 ;; This is a modified version from rcs.el v1.1. I use it here to make
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
82 ;; Ediff immune to changes in rcs.el
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
83 (let* ((default-major-mode 'fundamental-mode) ; no frills!
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
84 (buf (get-buffer-create name)))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
85 (save-excursion
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
86 (set-buffer buf)
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
87 (setq buffer-read-only nil
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
88 default-directory (file-name-directory (expand-file-name file)))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
89 (erase-buffer))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
90 buf))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
91
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
92 (defun rcs-ediff-internal (rev1 rev2 &optional startup-hooks)
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
93 ;; Run Ediff on versions of the current buffer.
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
94 ;; If REV2 is "" then use current buffer.
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
95 (let ((rev2buf (if (string= rev2 "")
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
96 (current-buffer)
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
97 (rcs-ediff-view-revision rev2)))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
98 (rev1buf (rcs-ediff-view-revision rev1)))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
99
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
100 ;; rcs.el doesn't create temp version files, so we don't have to delete
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
101 ;; anything in startup hooks to ediff-buffers
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
102 (ediff-buffers rev1buf rev2buf startup-hooks 'ediff-revision)
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
103 ))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
104
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
105
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
106 ;; GENERIC-SC.el support
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
107
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
108 (defun generic-sc-get-latest-rev ()
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
109 (cond ((eq sc-mode 'CCASE)
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
110 (eval "main/LATEST"))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
111 (t (eval ""))))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
112
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
113 (defun generic-sc-ediff-internal (rev1 rev2 &optional startup-hooks)
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
114 ;; Run Ediff on versions of the current buffer.
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
115 ;; If REV2 is "" then compare current buffer with REV1.
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
116 ;; If the current buffer is named `F', the version is named `F.~REV~'.
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
117 ;; If `F.~REV~' already exists, it is used instead of being re-created.
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
118 (let (rev1buf rev2buf)
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
119 (save-excursion
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
120 (if (or (not rev1) (string= rev1 ""))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
121 (setq rev1 (generic-sc-get-latest-rev)))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
122 (sc-visit-previous-revision rev1)
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
123 (setq rev1buf (current-buffer)))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
124 (save-excursion
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
125 (or (string= rev2 "") ; use current buffer
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
126 (sc-visit-previous-revision rev2))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
127 (setq rev2buf (current-buffer)))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
128 (ediff-buffers rev1buf rev2buf startup-hooks 'ediff-revision)))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
129
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
130
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
131 ;;; Merge with Version Control
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
132
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
133 (defun vc-ediff-merge-internal (rev1 rev2 ancestor-rev &optional startup-hooks)
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
134 ;; If ANCESTOR-REV non-nil, merge with ancestor
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
135 (let (buf1 buf2 ancestor-buf)
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
136 (save-excursion
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
137 (vc-version-other-window rev1)
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
138 (setq buf1 (current-buffer)))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
139 (save-excursion
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
140 (or (string= rev2 "")
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
141 (vc-version-other-window rev2))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
142 (setq buf2 (current-buffer)))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
143 (if ancestor-rev
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
144 (save-excursion
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
145 (or (string= ancestor-rev "")
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
146 (vc-version-other-window ancestor-rev))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
147 (setq ancestor-buf (current-buffer))))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
148 (setq startup-hooks
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
149 (cons
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
150 (` (lambda ()
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
151 (delete-file (, (buffer-file-name buf1)))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
152 (or (, (string= rev2 ""))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
153 (delete-file (, (buffer-file-name buf2))))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
154 (or (, (string= ancestor-rev ""))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
155 (, (not ancestor-rev))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
156 (delete-file (, (buffer-file-name ancestor-buf))))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
157 ))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
158 startup-hooks))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
159 (if ancestor-rev
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
160 (ediff-merge-buffers-with-ancestor
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
161 buf1 buf2 ancestor-buf
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
162 startup-hooks 'ediff-merge-revisions-with-ancestor)
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
163 (ediff-merge-buffers buf1 buf2 startup-hooks 'ediff-merge-revisions))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
164 ))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
165
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
166 (defun rcs-ediff-merge-internal (rev1 rev2 ancestor-rev
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
167 &optional startup-hooks)
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
168 ;; If ANCESTOR-REV non-nil, merge with ancestor
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
169 (let (buf1 buf2 ancestor-buf)
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
170 (setq buf1 (rcs-ediff-view-revision rev1)
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
171 buf2 (if (string= rev2 "")
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
172 (current-buffer)
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
173 (rcs-ediff-view-revision rev2))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
174 ancestor-buf (if ancestor-rev
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
175 (if (string= ancestor-rev "")
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
176 (current-buffer)
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
177 (rcs-ediff-view-revision ancestor-rev))))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
178 ;; rcs.el doesn't create temp version files, so we don't have to delete
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
179 ;; anything in startup hooks to ediff-buffers
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
180 (if ancestor-rev
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
181 (ediff-merge-buffers-with-ancestor
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
182 buf1 buf2 ancestor-buf
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
183 startup-hooks 'ediff-merge-revisions-with-ancestor)
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
184 (ediff-merge-buffers buf1 buf2 startup-hooks 'ediff-merge-revisions))))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
185
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
186 (defun generic-sc-ediff-merge-internal (rev1 rev2 ancestor-rev
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
187 &optional startup-hooks)
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
188 ;; If ANCESTOR-REV non-nil, merge with ancestor
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
189 (let (buf1 buf2 ancestor-buf)
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
190 (save-excursion
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
191 (if (string= rev1 "")
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
192 (setq rev1 (generic-sc-get-latest-rev)))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
193 (sc-visit-previous-revision rev1)
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
194 (setq buf1 (current-buffer)))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
195 (save-excursion
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
196 (or (string= rev2 "")
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
197 (sc-visit-previous-revision rev2))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
198 (setq buf2 (current-buffer)))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
199 (if ancestor-rev
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
200 (save-excursion
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
201 (or (string= ancestor-rev "")
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
202 (sc-visit-previous-revision ancestor-rev))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
203 (setq ancestor-buf (current-buffer))))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
204 (if ancestor-rev
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
205 (ediff-merge-buffers-with-ancestor
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
206 buf1 buf2 ancestor-buf
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
207 startup-hooks 'ediff-merge-revisions-with-ancestor)
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
208 (ediff-merge-buffers buf1 buf2 startup-hooks 'ediff-merge-revisions))))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
209
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
210
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
211 ;; PCL-CVS.el support
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
212
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
213 (defun pcl-cvs-ediff-internal (rev1 rev2 &optional startup-hooks)
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
214 ;; Run Ediff on a pair of revisions of the current buffer.
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
215 ;; If REV1 is "", use the latest revision.
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
216 ;; If REV2 is "", use the current buffer as the second file to compare.
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
217 (let ((orig-buf (current-buffer))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
218 orig-file-name buf1 buf2 file1 file2)
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
219
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
220 (or (setq orig-file-name (buffer-file-name (current-buffer)))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
221 (error "Current buffer is not visiting any file"))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
222 (if (string= rev1 "") (setq rev1 nil)) ; latest revision
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
223 (setq buf1 (ediff-pcl-cvs-view-revision orig-file-name rev1)
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
224 buf2 (if (string= rev2 "")
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
225 orig-buf
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
226 (ediff-pcl-cvs-view-revision orig-file-name rev2))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
227 file1 (buffer-file-name buf1)
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
228 file2 (buffer-file-name buf2))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
229 (setq startup-hooks
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
230 (cons (` (lambda ()
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
231 (delete-file (, file1))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
232 (or (, (string= rev2 "")) (delete-file (, file2)))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
233 ))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
234 startup-hooks))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
235 (ediff-buffers buf1 buf2 startup-hooks 'ediff-revision)))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
236
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
237 ;; This function is the standard Ediff's interface to pcl-cvs.
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
238 ;; Works like with other interfaces: runs ediff on versions of the file in the
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
239 ;; current buffer.
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
240 (defun pcl-cvs-ediff-merge-internal (rev1 rev2 ancestor-rev
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
241 &optional startup-hooks)
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
242 ;; Ediff-merge appropriate revisions of the selected file.
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
243 ;; If REV1 is "" then use the latest revision.
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
244 ;; If REV2 is "" then merge current buffer's file with REV1.
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
245 ;; If ANCESTOR-REV is "" then use current buffer's file as ancestor.
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
246 ;; If ANCESTOR-REV is nil, then merge without the ancestor.
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
247 (let ((orig-buf (current-buffer))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
248 orig-file-name buf1 buf2 ancestor-buf)
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
249
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
250 (or (setq orig-file-name (buffer-file-name (current-buffer)))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
251 (error "Current buffer is not visiting any file"))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
252 (if (string= rev1 "") (setq rev1 nil)) ; latest revision
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
253
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
254 (setq buf1 (ediff-pcl-cvs-view-revision orig-file-name rev1))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
255 (setq buf2 (if (string= rev2 "")
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
256 orig-buf
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
257 (ediff-pcl-cvs-view-revision orig-file-name rev2)))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
258 (if (stringp ancestor-rev)
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
259 (setq ancestor-buf
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
260 (if (string= ancestor-rev "")
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
261 orig-buf
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
262 (ediff-pcl-cvs-view-revision orig-file-name ancestor-rev))))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
263
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
264 (setq startup-hooks
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
265 (cons
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
266 (` (lambda ()
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
267 (delete-file (, (buffer-file-name buf1)))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
268 (or (, (string= rev2 ""))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
269 (delete-file (, (buffer-file-name buf2))))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
270 (or (, (string= ancestor-rev ""))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
271 (, (not ancestor-rev))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
272 (delete-file (, (buffer-file-name ancestor-buf))))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
273 ))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
274 startup-hooks))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
275
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
276 (if ancestor-buf
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
277 (ediff-merge-buffers-with-ancestor
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
278 buf1 buf2 ancestor-buf startup-hooks
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
279 'ediff-merge-revisions-with-ancestor)
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
280 (ediff-merge-buffers
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
281 buf1 buf2 startup-hooks 'ediff-merge-revisions))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
282 ))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
283
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
284 (defun ediff-pcl-cvs-view-revision (file rev)
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
285 ;; if rev = "", get the latest revision
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
286 (let ((temp-name (make-temp-name
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
287 (concat ediff-temp-file-prefix
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
288 "ediff_" rev))))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
289 (cvs-kill-buffer-visiting temp-name)
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
290 (if rev
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
291 (message "Retrieving revision %s..." rev)
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
292 (message "Retrieving latest revision..."))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
293 (let ((res (call-process cvs-shell nil nil nil "-c"
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
294 (concat cvs-program " update -p "
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
295 (if rev
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
296 (concat "-r " rev " ")
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
297 "")
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
298 file
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
299 " > " temp-name))))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
300 (if (and res (not (and (integerp res) (zerop res))))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
301 (error "Failed to retrieve revision: %s" res))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
302
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
303 (if rev
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
304 (message "Retrieving revision %s... Done." rev)
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
305 (message "Retrieving latest revision... Done."))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
306 (find-file-noselect temp-name))))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
307
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
308
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
309 (defun cvs-run-ediff-on-file-descriptor (tin)
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
310 ;; This is a replacement for cvs-emerge-mode
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
311 ;; Run after cvs-update.
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
312 ;; Ediff-merge appropriate revisions of the selected file.
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
313 (let* ((fileinfo (tin-cookie cvs-cookie-handle tin))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
314 (type (cvs-fileinfo->type fileinfo))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
315 (tmp-file
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
316 (cvs-retrieve-revision-to-tmpfile fileinfo))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
317 ancestor-file)
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
318
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
319 (or (memq type '(MERGED CONFLICT MODIFIED))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
320 (error
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
321 "Can only merge `Modified', `Merged' or `Conflict' files"))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
322
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
323 (cond ((memq type '(MERGED CONFLICT))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
324 (setq ancestor-file
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
325 (cvs-retrieve-revision-to-tmpfile
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
326 fileinfo
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
327 ;; revision
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
328 (cvs-fileinfo->base-revision fileinfo)))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
329 (ediff-merge-buffers-with-ancestor
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
330 (find-file-noselect tmp-file)
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
331 (find-file-noselect (cvs-fileinfo->backup-file fileinfo))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
332 (find-file-noselect ancestor-file)
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
333 nil ; startup-hooks
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
334 'ediff-merge-revisions-with-ancestor))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
335 ((eq type 'MODIFIED)
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
336 (ediff-merge-buffers
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
337 (find-file-noselect tmp-file)
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
338 (find-file-noselect (cvs-fileinfo->full-path fileinfo))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
339 nil ; startup-hooks
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
340 'ediff-merge-revisions)))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
341 (if (stringp tmp-file) (delete-file tmp-file))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
342 (if (stringp ancestor-file) (delete-file ancestor-file))))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
343
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
344 ;;; Local Variables:
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
345 ;;; eval: (put 'ediff-defvar-local 'lisp-indent-hook 'defun)
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
346 ;;; eval: (put 'ediff-eval-in-buffer 'lisp-indent-hook 1)
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
347 ;;; End:
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
348
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
349 (provide 'ediff-vers)
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
350
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
351 ;;; ediff-vers.el ends here