annotate lisp/ediff-vers.el @ 15886:4877d1aa80ad

(ielm-map): Don't bind M-q. (inferior-emacs-lisp-mode): Set fill-paragraph-function instead.
author Karl Heuer <kwzh@gnu.org>
date Tue, 20 Aug 1996 19:10:47 +0000
parents 43a3308fcf61
children b2fae8abc5b0
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
15480
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14234
diff changeset
3 ;;; Copyright (C) 1995, 1996 Free Software Foundation, Inc.
14234
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:
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)
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14234
diff changeset
33
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14234
diff changeset
34 (eval-when-compile
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14234
diff changeset
35 (load "pcl-cvs" 'noerror)
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14234
diff changeset
36 (load "rcs" 'noerror)
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14234
diff changeset
37 (load "generic-sc" 'noerror)
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14234
diff changeset
38 (load "vc" 'noerror))
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14234
diff changeset
39 ;; end pacifier
14234
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
40
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
41 ;; VC.el support
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
42 (defun vc-ediff-internal (rev1 rev2 &optional startup-hooks)
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
43 ;; Run Ediff on versions of the current buffer.
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
44 ;; If REV2 is "" then compare current buffer with REV1.
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
45 ;; 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
46 ;; 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
47 (let (file1 file2 rev1buf rev2buf)
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
48 (save-excursion
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
49 (vc-version-other-window rev1)
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
50 (setq rev1buf (current-buffer)
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
51 file1 (buffer-file-name)))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
52 (save-excursion
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
53 (or (string= rev2 "") ; use current buffer
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
54 (vc-version-other-window rev2))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
55 (setq rev2buf (current-buffer)
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
56 file2 (buffer-file-name)))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
57 (setq startup-hooks
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
58 (cons (` (lambda ()
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
59 (delete-file (, file1))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
60 (or (, (string= rev2 "")) (delete-file (, file2)))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
61 ))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
62 startup-hooks))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
63 (ediff-buffers
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
64 rev1buf rev2buf
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
65 startup-hooks
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
66 'ediff-revision)))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
67
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
68 ;; RCS.el support
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
69 (defun rcs-ediff-view-revision (&optional rev)
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
70 ;; View previous RCS revision of current file.
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
71 ;; With prefix argument, prompts for a revision name.
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
72 (interactive (list (if current-prefix-arg
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
73 (read-string "Revision: "))))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
74 (let* ((filename (buffer-file-name (current-buffer)))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
75 (switches (append '("-p")
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
76 (if rev (list (concat "-r" rev)) nil)))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
77 (buff (concat (file-name-nondirectory filename) ".~" rev "~")))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
78 (message "Working ...")
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
79 (setq filename (expand-file-name filename))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
80 (with-output-to-temp-buffer buff
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
81 (let ((output-buffer (ediff-rcs-get-output-buffer filename buff)))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
82 (delete-windows-on output-buffer)
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
83 (save-excursion
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
84 (set-buffer output-buffer)
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
85 (apply 'call-process "co" nil t nil
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
86 ;; -q: quiet (no diagnostics)
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
87 (append switches rcs-default-co-switches
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
88 (list "-q" filename)))))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
89 (message "")
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
90 buff)))
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 ediff-rcs-get-output-buffer (file name)
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
93 ;; 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
94 ;; Optional NAME is name to use instead of `*RCS-output*'.
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
95 ;; 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
96 ;; Ediff immune to changes in rcs.el
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
97 (let* ((default-major-mode 'fundamental-mode) ; no frills!
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
98 (buf (get-buffer-create name)))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
99 (save-excursion
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
100 (set-buffer buf)
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
101 (setq buffer-read-only nil
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
102 default-directory (file-name-directory (expand-file-name file)))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
103 (erase-buffer))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
104 buf))
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 (defun rcs-ediff-internal (rev1 rev2 &optional startup-hooks)
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
107 ;; Run Ediff on versions of the current buffer.
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
108 ;; If REV2 is "" then use current buffer.
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
109 (let ((rev2buf (if (string= rev2 "")
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
110 (current-buffer)
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
111 (rcs-ediff-view-revision rev2)))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
112 (rev1buf (rcs-ediff-view-revision rev1)))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
113
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
114 ;; 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
115 ;; anything in startup hooks to ediff-buffers
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
116 (ediff-buffers rev1buf rev2buf startup-hooks 'ediff-revision)
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
117 ))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
118
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
119
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
120 ;; GENERIC-SC.el support
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
121
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
122 (defun generic-sc-get-latest-rev ()
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
123 (cond ((eq sc-mode 'CCASE)
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
124 (eval "main/LATEST"))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
125 (t (eval ""))))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
126
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
127 (defun generic-sc-ediff-internal (rev1 rev2 &optional startup-hooks)
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
128 ;; Run Ediff on versions of the current buffer.
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
129 ;; If REV2 is "" then compare current buffer with REV1.
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
130 ;; 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
131 ;; 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
132 (let (rev1buf rev2buf)
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
133 (save-excursion
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
134 (if (or (not rev1) (string= rev1 ""))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
135 (setq rev1 (generic-sc-get-latest-rev)))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
136 (sc-visit-previous-revision rev1)
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
137 (setq rev1buf (current-buffer)))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
138 (save-excursion
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
139 (or (string= rev2 "") ; use current buffer
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
140 (sc-visit-previous-revision rev2))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
141 (setq rev2buf (current-buffer)))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
142 (ediff-buffers rev1buf rev2buf startup-hooks 'ediff-revision)))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
143
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
144
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
145 ;;; Merge with Version Control
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
146
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
147 (defun vc-ediff-merge-internal (rev1 rev2 ancestor-rev &optional startup-hooks)
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
148 ;; If ANCESTOR-REV non-nil, merge with ancestor
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
149 (let (buf1 buf2 ancestor-buf)
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
150 (save-excursion
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
151 (vc-version-other-window rev1)
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
152 (setq buf1 (current-buffer)))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
153 (save-excursion
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
154 (or (string= rev2 "")
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
155 (vc-version-other-window rev2))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
156 (setq buf2 (current-buffer)))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
157 (if ancestor-rev
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
158 (save-excursion
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
159 (or (string= ancestor-rev "")
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
160 (vc-version-other-window ancestor-rev))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
161 (setq ancestor-buf (current-buffer))))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
162 (setq startup-hooks
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
163 (cons
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
164 (` (lambda ()
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
165 (delete-file (, (buffer-file-name buf1)))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
166 (or (, (string= rev2 ""))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
167 (delete-file (, (buffer-file-name buf2))))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
168 (or (, (string= ancestor-rev ""))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
169 (, (not ancestor-rev))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
170 (delete-file (, (buffer-file-name ancestor-buf))))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
171 ))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
172 startup-hooks))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
173 (if ancestor-rev
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
174 (ediff-merge-buffers-with-ancestor
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
175 buf1 buf2 ancestor-buf
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
176 startup-hooks 'ediff-merge-revisions-with-ancestor)
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
177 (ediff-merge-buffers buf1 buf2 startup-hooks 'ediff-merge-revisions))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
178 ))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
179
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
180 (defun rcs-ediff-merge-internal (rev1 rev2 ancestor-rev
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
181 &optional startup-hooks)
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
182 ;; If ANCESTOR-REV non-nil, merge with ancestor
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
183 (let (buf1 buf2 ancestor-buf)
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
184 (setq buf1 (rcs-ediff-view-revision rev1)
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
185 buf2 (if (string= rev2 "")
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
186 (current-buffer)
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
187 (rcs-ediff-view-revision rev2))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
188 ancestor-buf (if ancestor-rev
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
189 (if (string= ancestor-rev "")
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
190 (current-buffer)
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
191 (rcs-ediff-view-revision ancestor-rev))))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
192 ;; 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
193 ;; anything in startup hooks to ediff-buffers
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
194 (if ancestor-rev
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
195 (ediff-merge-buffers-with-ancestor
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
196 buf1 buf2 ancestor-buf
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
197 startup-hooks 'ediff-merge-revisions-with-ancestor)
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
198 (ediff-merge-buffers buf1 buf2 startup-hooks 'ediff-merge-revisions))))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
199
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
200 (defun generic-sc-ediff-merge-internal (rev1 rev2 ancestor-rev
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
201 &optional startup-hooks)
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
202 ;; If ANCESTOR-REV non-nil, merge with ancestor
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
203 (let (buf1 buf2 ancestor-buf)
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
204 (save-excursion
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
205 (if (string= rev1 "")
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
206 (setq rev1 (generic-sc-get-latest-rev)))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
207 (sc-visit-previous-revision rev1)
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
208 (setq buf1 (current-buffer)))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
209 (save-excursion
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
210 (or (string= rev2 "")
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
211 (sc-visit-previous-revision rev2))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
212 (setq buf2 (current-buffer)))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
213 (if ancestor-rev
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
214 (save-excursion
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
215 (or (string= ancestor-rev "")
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
216 (sc-visit-previous-revision ancestor-rev))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
217 (setq ancestor-buf (current-buffer))))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
218 (if ancestor-rev
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
219 (ediff-merge-buffers-with-ancestor
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
220 buf1 buf2 ancestor-buf
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
221 startup-hooks 'ediff-merge-revisions-with-ancestor)
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
222 (ediff-merge-buffers buf1 buf2 startup-hooks 'ediff-merge-revisions))))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
223
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
224
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
225 ;; PCL-CVS.el support
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
226
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
227 (defun pcl-cvs-ediff-internal (rev1 rev2 &optional startup-hooks)
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
228 ;; Run Ediff on a pair of revisions of the current buffer.
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
229 ;; If REV1 is "", use the latest revision.
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
230 ;; 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
231 (let ((orig-buf (current-buffer))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
232 orig-file-name buf1 buf2 file1 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 (or (setq orig-file-name (buffer-file-name (current-buffer)))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
235 (error "Current buffer is not visiting any file"))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
236 (if (string= rev1 "") (setq rev1 nil)) ; latest revision
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
237 (setq buf1 (ediff-pcl-cvs-view-revision orig-file-name rev1)
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
238 buf2 (if (string= rev2 "")
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
239 orig-buf
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
240 (ediff-pcl-cvs-view-revision orig-file-name rev2))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
241 file1 (buffer-file-name buf1)
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
242 file2 (buffer-file-name buf2))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
243 (setq startup-hooks
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
244 (cons (` (lambda ()
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
245 (delete-file (, file1))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
246 (or (, (string= rev2 "")) (delete-file (, file2)))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
247 ))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
248 startup-hooks))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
249 (ediff-buffers buf1 buf2 startup-hooks 'ediff-revision)))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
250
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
251 ;; This function is the standard Ediff's interface to pcl-cvs.
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
252 ;; 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
253 ;; current buffer.
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
254 (defun pcl-cvs-ediff-merge-internal (rev1 rev2 ancestor-rev
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
255 &optional startup-hooks)
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
256 ;; Ediff-merge appropriate revisions of the selected file.
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
257 ;; If REV1 is "" then use the latest revision.
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
258 ;; If REV2 is "" then merge current buffer's file with REV1.
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
259 ;; If ANCESTOR-REV is "" then use current buffer's file as ancestor.
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
260 ;; If ANCESTOR-REV is nil, then merge without the ancestor.
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
261 (let ((orig-buf (current-buffer))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
262 orig-file-name buf1 buf2 ancestor-buf)
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 (or (setq orig-file-name (buffer-file-name (current-buffer)))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
265 (error "Current buffer is not visiting any file"))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
266 (if (string= rev1 "") (setq rev1 nil)) ; latest revision
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
267
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
268 (setq buf1 (ediff-pcl-cvs-view-revision orig-file-name rev1))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
269 (setq buf2 (if (string= rev2 "")
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
270 orig-buf
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
271 (ediff-pcl-cvs-view-revision orig-file-name rev2)))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
272 (if (stringp ancestor-rev)
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
273 (setq ancestor-buf
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
274 (if (string= ancestor-rev "")
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
275 orig-buf
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
276 (ediff-pcl-cvs-view-revision orig-file-name ancestor-rev))))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
277
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
278 (setq startup-hooks
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
279 (cons
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
280 (` (lambda ()
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
281 (delete-file (, (buffer-file-name buf1)))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
282 (or (, (string= rev2 ""))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
283 (delete-file (, (buffer-file-name buf2))))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
284 (or (, (string= ancestor-rev ""))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
285 (, (not ancestor-rev))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
286 (delete-file (, (buffer-file-name ancestor-buf))))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
287 ))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
288 startup-hooks))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
289
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
290 (if ancestor-buf
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
291 (ediff-merge-buffers-with-ancestor
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
292 buf1 buf2 ancestor-buf startup-hooks
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
293 'ediff-merge-revisions-with-ancestor)
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
294 (ediff-merge-buffers
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
295 buf1 buf2 startup-hooks 'ediff-merge-revisions))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
296 ))
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 (defun ediff-pcl-cvs-view-revision (file rev)
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
299 ;; if rev = "", get the latest revision
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
300 (let ((temp-name (make-temp-name
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
301 (concat ediff-temp-file-prefix
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
302 "ediff_" rev))))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
303 (cvs-kill-buffer-visiting temp-name)
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
304 (if rev
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
305 (message "Retrieving revision %s..." rev)
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
306 (message "Retrieving latest revision..."))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
307 (let ((res (call-process cvs-shell nil nil nil "-c"
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
308 (concat cvs-program " update -p "
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
309 (if rev
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
310 (concat "-r " rev " ")
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
311 "")
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
312 file
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
313 " > " temp-name))))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
314 (if (and res (not (and (integerp res) (zerop res))))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
315 (error "Failed to retrieve revision: %s" res))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
316
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
317 (if rev
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
318 (message "Retrieving revision %s... Done." rev)
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
319 (message "Retrieving latest revision... Done."))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
320 (find-file-noselect temp-name))))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
321
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 (defun cvs-run-ediff-on-file-descriptor (tin)
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
324 ;; This is a replacement for cvs-emerge-mode
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
325 ;; Run after cvs-update.
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
326 ;; Ediff-merge appropriate revisions of the selected file.
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
327 (let* ((fileinfo (tin-cookie cvs-cookie-handle tin))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
328 (type (cvs-fileinfo->type fileinfo))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
329 (tmp-file
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
330 (cvs-retrieve-revision-to-tmpfile fileinfo))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
331 ancestor-file)
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
332
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
333 (or (memq type '(MERGED CONFLICT MODIFIED))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
334 (error
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
335 "Can only merge `Modified', `Merged' or `Conflict' files"))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
336
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
337 (cond ((memq type '(MERGED CONFLICT))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
338 (setq ancestor-file
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
339 (cvs-retrieve-revision-to-tmpfile
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
340 fileinfo
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
341 ;; revision
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
342 (cvs-fileinfo->base-revision fileinfo)))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
343 (ediff-merge-buffers-with-ancestor
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
344 (find-file-noselect tmp-file)
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
345 (find-file-noselect (cvs-fileinfo->backup-file fileinfo))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
346 (find-file-noselect ancestor-file)
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
347 nil ; startup-hooks
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
348 'ediff-merge-revisions-with-ancestor))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
349 ((eq type 'MODIFIED)
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
350 (ediff-merge-buffers
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
351 (find-file-noselect tmp-file)
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
352 (find-file-noselect (cvs-fileinfo->full-path fileinfo))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
353 nil ; startup-hooks
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
354 'ediff-merge-revisions)))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
355 (if (stringp tmp-file) (delete-file tmp-file))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
356 (if (stringp ancestor-file) (delete-file ancestor-file))))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
357
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
358 ;;; Local Variables:
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
359 ;;; eval: (put 'ediff-defvar-local 'lisp-indent-hook 'defun)
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
360 ;;; eval: (put 'ediff-eval-in-buffer 'lisp-indent-hook 1)
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
361 ;;; End:
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
362
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
363 (provide 'ediff-vers)
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
364
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
365 ;;; ediff-vers.el ends here