annotate lisp/ediff-vers.el @ 78228:1e016d63f292

Switch license to GPLv3 or later.
author Glenn Morris <rgm@gnu.org>
date Wed, 25 Jul 2007 04:24:43 +0000
parents e3694f1cb928
children 9355f9b7bbff 95d0cdf160ea
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
74439
ddcbd2c1b70d Update copyright years.
Glenn Morris <rgm@gnu.org>
parents: 71382
diff changeset
3 ;; Copyright (C) 1995, 1996, 1997, 2001, 2002, 2003, 2004,
75347
e3694f1cb928 Add 2007 to copyright years.
Glenn Morris <rgm@gnu.org>
parents: 74439
diff changeset
4 ;; 2005, 2006, 2007 Free Software Foundation, Inc.
14234
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
5
42602
633233bf2bbf 2002-01-07 Michael Kifer <kifer@cs.stonybrook.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 38422
diff changeset
6 ;; Author: Michael Kifer <kifer@cs.stonybrook.edu>
14234
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
7
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
8 ;; This file is part of GNU Emacs.
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
9
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
10 ;; GNU Emacs is free software; you can redistribute it and/or modify
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
11 ;; 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
12 ;; the Free Software Foundation; either version 2, or (at your option)
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
13 ;; any later version.
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
14
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
15 ;; GNU Emacs is distributed in the hope that it will be useful,
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
16 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
18 ;; GNU General Public License for more details.
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
19
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
20 ;; You should have received a copy of the GNU General Public License
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
21 ;; along with GNU Emacs; see the file COPYING. If not, write to the
64091
6fb026ad601f Update FSF's address.
Lute Kamstra <lute@gnu.org>
parents: 52401
diff changeset
22 ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
6fb026ad601f Update FSF's address.
Lute Kamstra <lute@gnu.org>
parents: 52401
diff changeset
23 ;; Boston, MA 02110-1301, USA.
14234
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
24
38422
7a94f1c588c4 Some fixes to follow coding conventions.
Pavel Janík <Pavel@Janik.cz>
parents: 35109
diff changeset
25 ;;; Commentary:
14234
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 ;;; Code:
15480
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14234
diff changeset
28
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14234
diff changeset
29 ;; Compiler pacifier
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14234
diff changeset
30 (defvar rcs-default-co-switches)
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14234
diff changeset
31 (defvar sc-mode)
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14234
diff changeset
32 (defvar cvs-shell)
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14234
diff changeset
33 (defvar cvs-program)
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14234
diff changeset
34 (defvar cvs-cookie-handle)
18054
0b9d9cbf3cd4 new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 16248
diff changeset
35 (defvar ediff-temp-file-prefix)
15480
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14234
diff changeset
36
16248
b2fae8abc5b0 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 15480
diff changeset
37 (and noninteractive
b2fae8abc5b0 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 15480
diff changeset
38 (eval-when-compile
42602
633233bf2bbf 2002-01-07 Michael Kifer <kifer@cs.stonybrook.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 38422
diff changeset
39 (let ((load-path (cons (expand-file-name ".") load-path)))
633233bf2bbf 2002-01-07 Michael Kifer <kifer@cs.stonybrook.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 38422
diff changeset
40 (load "pcl-cvs" 'noerror)
633233bf2bbf 2002-01-07 Michael Kifer <kifer@cs.stonybrook.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 38422
diff changeset
41 (load "rcs" 'noerror)
633233bf2bbf 2002-01-07 Michael Kifer <kifer@cs.stonybrook.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 38422
diff changeset
42 ;; On 8+3 MS-DOS filesystems, generic-x.el is loaded
633233bf2bbf 2002-01-07 Michael Kifer <kifer@cs.stonybrook.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 38422
diff changeset
43 ;; instead of (the missing) generic-sc.el. Since the
633233bf2bbf 2002-01-07 Michael Kifer <kifer@cs.stonybrook.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 38422
diff changeset
44 ;; version of Emacs which supports MS-DOS doesn't have
633233bf2bbf 2002-01-07 Michael Kifer <kifer@cs.stonybrook.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 38422
diff changeset
45 ;; generic-sc, we simply avoid loading it.
633233bf2bbf 2002-01-07 Michael Kifer <kifer@cs.stonybrook.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 38422
diff changeset
46 (or (and (fboundp 'msdos-long-file-names)
633233bf2bbf 2002-01-07 Michael Kifer <kifer@cs.stonybrook.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 38422
diff changeset
47 (not (msdos-long-file-names)))
633233bf2bbf 2002-01-07 Michael Kifer <kifer@cs.stonybrook.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 38422
diff changeset
48 (load "generic-sc" 'noerror))
633233bf2bbf 2002-01-07 Michael Kifer <kifer@cs.stonybrook.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 38422
diff changeset
49 ;; (load "vc" 'noerror) ; this sometimes causes compiler error
633233bf2bbf 2002-01-07 Michael Kifer <kifer@cs.stonybrook.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 38422
diff changeset
50 (or (featurep 'ediff-init)
633233bf2bbf 2002-01-07 Michael Kifer <kifer@cs.stonybrook.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 38422
diff changeset
51 (load "ediff-init.el" nil nil 'nosuffix))
633233bf2bbf 2002-01-07 Michael Kifer <kifer@cs.stonybrook.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 38422
diff changeset
52 )))
15480
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14234
diff changeset
53 ;; end pacifier
49588
37645a051842 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 49428
diff changeset
54
71382
4033086b16b6 2006-06-18 Michael Kifer <kifer@cs.stonybrook.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 68997
diff changeset
55 (defcustom ediff-keep-tmp-versions nil
4033086b16b6 2006-06-18 Michael Kifer <kifer@cs.stonybrook.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 68997
diff changeset
56 "*If t, do not delete temporary previous versions for the files on which
4033086b16b6 2006-06-18 Michael Kifer <kifer@cs.stonybrook.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 68997
diff changeset
57 comparison or merge operations are being performed."
4033086b16b6 2006-06-18 Michael Kifer <kifer@cs.stonybrook.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 68997
diff changeset
58 :type 'boolean
4033086b16b6 2006-06-18 Michael Kifer <kifer@cs.stonybrook.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 68997
diff changeset
59 :group 'ediff-vers
4033086b16b6 2006-06-18 Michael Kifer <kifer@cs.stonybrook.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 68997
diff changeset
60 )
4033086b16b6 2006-06-18 Michael Kifer <kifer@cs.stonybrook.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 68997
diff changeset
61
14234
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
62 ;; VC.el support
49428
0f80cb4f9d29 2003-01-25 Michael Kifer <kifer@cs.stonybrook.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 42602
diff changeset
63
0f80cb4f9d29 2003-01-25 Michael Kifer <kifer@cs.stonybrook.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 42602
diff changeset
64 (defun ediff-vc-latest-version (file)
0f80cb4f9d29 2003-01-25 Michael Kifer <kifer@cs.stonybrook.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 42602
diff changeset
65 "Return the version level of the latest version of FILE in repository."
0f80cb4f9d29 2003-01-25 Michael Kifer <kifer@cs.stonybrook.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 42602
diff changeset
66 (if (fboundp 'vc-latest-version)
0f80cb4f9d29 2003-01-25 Michael Kifer <kifer@cs.stonybrook.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 42602
diff changeset
67 (vc-latest-version file)
0f80cb4f9d29 2003-01-25 Michael Kifer <kifer@cs.stonybrook.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 42602
diff changeset
68 (or (vc-file-getprop file 'vc-latest-version)
0f80cb4f9d29 2003-01-25 Michael Kifer <kifer@cs.stonybrook.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 42602
diff changeset
69 (cond ((vc-backend file)
0f80cb4f9d29 2003-01-25 Michael Kifer <kifer@cs.stonybrook.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 42602
diff changeset
70 (vc-call state file)
0f80cb4f9d29 2003-01-25 Michael Kifer <kifer@cs.stonybrook.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 42602
diff changeset
71 (vc-file-getprop file 'vc-latest-version))
0f80cb4f9d29 2003-01-25 Michael Kifer <kifer@cs.stonybrook.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 42602
diff changeset
72 (t (error "File %s is not under version control" file))))
0f80cb4f9d29 2003-01-25 Michael Kifer <kifer@cs.stonybrook.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 42602
diff changeset
73 ))
0f80cb4f9d29 2003-01-25 Michael Kifer <kifer@cs.stonybrook.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 42602
diff changeset
74
0f80cb4f9d29 2003-01-25 Michael Kifer <kifer@cs.stonybrook.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 42602
diff changeset
75
16248
b2fae8abc5b0 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 15480
diff changeset
76 (defun ediff-vc-internal (rev1 rev2 &optional startup-hooks)
49428
0f80cb4f9d29 2003-01-25 Michael Kifer <kifer@cs.stonybrook.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 42602
diff changeset
77 ;; Run Ediff on versions of the current buffer.
0f80cb4f9d29 2003-01-25 Michael Kifer <kifer@cs.stonybrook.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 42602
diff changeset
78 ;; If REV1 is "", use the latest version of the current buffer's file.
0f80cb4f9d29 2003-01-25 Michael Kifer <kifer@cs.stonybrook.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 42602
diff changeset
79 ;; If REV2 is "" then compare current buffer with REV1.
0f80cb4f9d29 2003-01-25 Michael Kifer <kifer@cs.stonybrook.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 42602
diff changeset
80 ;; If the current buffer is named `F', the version is named `F.~REV~'.
0f80cb4f9d29 2003-01-25 Michael Kifer <kifer@cs.stonybrook.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 42602
diff changeset
81 ;; If `F.~REV~' already exists, it is used instead of being re-created.
14234
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
82 (let (file1 file2 rev1buf rev2buf)
49588
37645a051842 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 49428
diff changeset
83 (if (string= rev1 "")
49428
0f80cb4f9d29 2003-01-25 Michael Kifer <kifer@cs.stonybrook.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 42602
diff changeset
84 (setq rev1 (ediff-vc-latest-version (buffer-file-name))))
33019
6306740f6938 2000-10-29 Michael Kifer <kifer@cs.sunysb.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 26585
diff changeset
85 (save-window-excursion
6306740f6938 2000-10-29 Michael Kifer <kifer@cs.sunysb.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 26585
diff changeset
86 (save-excursion
6306740f6938 2000-10-29 Michael Kifer <kifer@cs.sunysb.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 26585
diff changeset
87 (vc-version-other-window rev1)
6306740f6938 2000-10-29 Michael Kifer <kifer@cs.sunysb.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 26585
diff changeset
88 (setq rev1buf (current-buffer)
6306740f6938 2000-10-29 Michael Kifer <kifer@cs.sunysb.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 26585
diff changeset
89 file1 (buffer-file-name)))
6306740f6938 2000-10-29 Michael Kifer <kifer@cs.sunysb.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 26585
diff changeset
90 (save-excursion
6306740f6938 2000-10-29 Michael Kifer <kifer@cs.sunysb.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 26585
diff changeset
91 (or (string= rev2 "") ; use current buffer
6306740f6938 2000-10-29 Michael Kifer <kifer@cs.sunysb.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 26585
diff changeset
92 (vc-version-other-window rev2))
6306740f6938 2000-10-29 Michael Kifer <kifer@cs.sunysb.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 26585
diff changeset
93 (setq rev2buf (current-buffer)
6306740f6938 2000-10-29 Michael Kifer <kifer@cs.sunysb.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 26585
diff changeset
94 file2 (buffer-file-name)))
6306740f6938 2000-10-29 Michael Kifer <kifer@cs.sunysb.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 26585
diff changeset
95 (setq startup-hooks
6306740f6938 2000-10-29 Michael Kifer <kifer@cs.sunysb.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 26585
diff changeset
96 (cons `(lambda ()
71382
4033086b16b6 2006-06-18 Michael Kifer <kifer@cs.stonybrook.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 68997
diff changeset
97 (ediff-delete-version-file ,file1)
4033086b16b6 2006-06-18 Michael Kifer <kifer@cs.stonybrook.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 68997
diff changeset
98 (or ,(string= rev2 "") (ediff-delete-version-file ,file2)))
33019
6306740f6938 2000-10-29 Michael Kifer <kifer@cs.sunysb.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 26585
diff changeset
99 startup-hooks)))
14234
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
100 (ediff-buffers
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
101 rev1buf rev2buf
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
102 startup-hooks
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
103 'ediff-revision)))
49588
37645a051842 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 49428
diff changeset
104
14234
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
105 ;; RCS.el support
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
106 (defun rcs-ediff-view-revision (&optional rev)
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
107 ;; View previous RCS revision of current file.
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
108 ;; With prefix argument, prompts for a revision name.
49588
37645a051842 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 49428
diff changeset
109 (interactive (list (if current-prefix-arg
14234
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
110 (read-string "Revision: "))))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
111 (let* ((filename (buffer-file-name (current-buffer)))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
112 (switches (append '("-p")
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
113 (if rev (list (concat "-r" rev)) nil)))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
114 (buff (concat (file-name-nondirectory filename) ".~" rev "~")))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
115 (message "Working ...")
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
116 (setq filename (expand-file-name filename))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
117 (with-output-to-temp-buffer buff
33391
f8c8c2d3538e (rcs-ediff-view-revision): Put temp buffer into
Dave Love <fx@gnu.org>
parents: 33019
diff changeset
118 (ediff-with-current-buffer standard-output
f8c8c2d3538e (rcs-ediff-view-revision): Put temp buffer into
Dave Love <fx@gnu.org>
parents: 33019
diff changeset
119 (fundamental-mode))
14234
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
120 (let ((output-buffer (ediff-rcs-get-output-buffer filename buff)))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
121 (delete-windows-on output-buffer)
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
122 (save-excursion
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
123 (set-buffer output-buffer)
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
124 (apply 'call-process "co" nil t nil
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
125 ;; -q: quiet (no diagnostics)
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
126 (append switches rcs-default-co-switches
49588
37645a051842 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 49428
diff changeset
127 (list "-q" filename)))))
14234
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
128 (message "")
49588
37645a051842 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 49428
diff changeset
129 buff)))
37645a051842 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 49428
diff changeset
130
14234
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
131 (defun ediff-rcs-get-output-buffer (file name)
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
132 ;; 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
133 ;; Optional NAME is name to use instead of `*RCS-output*'.
26263
4f315ca65976 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 26039
diff changeset
134 ;; This is a modified version from rcs.el v1.1. I use it here to make
14234
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
135 ;; Ediff immune to changes in rcs.el
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
136 (let* ((default-major-mode 'fundamental-mode) ; no frills!
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
137 (buf (get-buffer-create name)))
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 (set-buffer buf)
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
140 (setq buffer-read-only nil
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
141 default-directory (file-name-directory (expand-file-name file)))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
142 (erase-buffer))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
143 buf))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
144
16248
b2fae8abc5b0 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 15480
diff changeset
145 (defun ediff-rcs-internal (rev1 rev2 &optional startup-hooks)
14234
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
146 ;; Run Ediff on versions of the current buffer.
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
147 ;; If REV2 is "" then use current buffer.
33019
6306740f6938 2000-10-29 Michael Kifer <kifer@cs.sunysb.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 26585
diff changeset
148 (let (rev2buf rev1buf)
6306740f6938 2000-10-29 Michael Kifer <kifer@cs.sunysb.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 26585
diff changeset
149 (save-window-excursion
6306740f6938 2000-10-29 Michael Kifer <kifer@cs.sunysb.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 26585
diff changeset
150 (setq rev2buf (if (string= rev2 "")
6306740f6938 2000-10-29 Michael Kifer <kifer@cs.sunysb.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 26585
diff changeset
151 (current-buffer)
6306740f6938 2000-10-29 Michael Kifer <kifer@cs.sunysb.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 26585
diff changeset
152 (rcs-ediff-view-revision rev2))
6306740f6938 2000-10-29 Michael Kifer <kifer@cs.sunysb.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 26585
diff changeset
153 rev1buf (rcs-ediff-view-revision rev1)))
49588
37645a051842 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 49428
diff changeset
154
14234
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
155 ;; 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
156 ;; anything in startup hooks to ediff-buffers
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
157 (ediff-buffers rev1buf rev2buf startup-hooks 'ediff-revision)
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
158 ))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
159
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
160
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
161 ;; GENERIC-SC.el support
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
162
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
163 (defun generic-sc-get-latest-rev ()
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
164 (cond ((eq sc-mode 'CCASE)
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
165 (eval "main/LATEST"))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
166 (t (eval ""))))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
167
16248
b2fae8abc5b0 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 15480
diff changeset
168 (defun ediff-generic-sc-internal (rev1 rev2 &optional startup-hooks)
14234
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
169 ;; Run Ediff on versions of the current buffer.
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
170 ;; If REV2 is "" then compare current buffer with REV1.
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
171 ;; 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
172 ;; 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
173 (let (rev1buf rev2buf)
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
174 (save-excursion
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
175 (if (or (not rev1) (string= rev1 ""))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
176 (setq rev1 (generic-sc-get-latest-rev)))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
177 (sc-visit-previous-revision rev1)
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
178 (setq rev1buf (current-buffer)))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
179 (save-excursion
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
180 (or (string= rev2 "") ; use current buffer
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
181 (sc-visit-previous-revision rev2))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
182 (setq rev2buf (current-buffer)))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
183 (ediff-buffers rev1buf rev2buf startup-hooks 'ediff-revision)))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
184
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 ;;; Merge with Version Control
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
187
49588
37645a051842 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 49428
diff changeset
188 (defun ediff-vc-merge-internal (rev1 rev2 ancestor-rev
20206
f44ff2c52fac new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 19047
diff changeset
189 &optional startup-hooks merge-buffer-file)
14234
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
190 ;; If ANCESTOR-REV non-nil, merge with ancestor
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
191 (let (buf1 buf2 ancestor-buf)
33019
6306740f6938 2000-10-29 Michael Kifer <kifer@cs.sunysb.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 26585
diff changeset
192 (save-window-excursion
6306740f6938 2000-10-29 Michael Kifer <kifer@cs.sunysb.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 26585
diff changeset
193 (save-excursion
6306740f6938 2000-10-29 Michael Kifer <kifer@cs.sunysb.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 26585
diff changeset
194 (vc-version-other-window rev1)
6306740f6938 2000-10-29 Michael Kifer <kifer@cs.sunysb.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 26585
diff changeset
195 (setq buf1 (current-buffer)))
6306740f6938 2000-10-29 Michael Kifer <kifer@cs.sunysb.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 26585
diff changeset
196 (save-excursion
6306740f6938 2000-10-29 Michael Kifer <kifer@cs.sunysb.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 26585
diff changeset
197 (or (string= rev2 "")
6306740f6938 2000-10-29 Michael Kifer <kifer@cs.sunysb.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 26585
diff changeset
198 (vc-version-other-window rev2))
6306740f6938 2000-10-29 Michael Kifer <kifer@cs.sunysb.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 26585
diff changeset
199 (setq buf2 (current-buffer)))
6306740f6938 2000-10-29 Michael Kifer <kifer@cs.sunysb.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 26585
diff changeset
200 (if ancestor-rev
6306740f6938 2000-10-29 Michael Kifer <kifer@cs.sunysb.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 26585
diff changeset
201 (save-excursion
6306740f6938 2000-10-29 Michael Kifer <kifer@cs.sunysb.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 26585
diff changeset
202 (if (string= ancestor-rev "")
6306740f6938 2000-10-29 Michael Kifer <kifer@cs.sunysb.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 26585
diff changeset
203 (setq ancestor-rev (vc-workfile-version buffer-file-name)))
6306740f6938 2000-10-29 Michael Kifer <kifer@cs.sunysb.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 26585
diff changeset
204 (vc-version-other-window ancestor-rev)
6306740f6938 2000-10-29 Michael Kifer <kifer@cs.sunysb.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 26585
diff changeset
205 (setq ancestor-buf (current-buffer))))
49588
37645a051842 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 49428
diff changeset
206 (setq startup-hooks
37645a051842 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 49428
diff changeset
207 (cons
37645a051842 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 49428
diff changeset
208 `(lambda ()
71382
4033086b16b6 2006-06-18 Michael Kifer <kifer@cs.stonybrook.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 68997
diff changeset
209 (ediff-delete-version-file ,(buffer-file-name buf1))
33019
6306740f6938 2000-10-29 Michael Kifer <kifer@cs.sunysb.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 26585
diff changeset
210 (or ,(string= rev2 "")
71382
4033086b16b6 2006-06-18 Michael Kifer <kifer@cs.stonybrook.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 68997
diff changeset
211 (ediff-delete-version-file ,(buffer-file-name buf2)))
33019
6306740f6938 2000-10-29 Michael Kifer <kifer@cs.sunysb.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 26585
diff changeset
212 (or ,(string= ancestor-rev "")
6306740f6938 2000-10-29 Michael Kifer <kifer@cs.sunysb.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 26585
diff changeset
213 ,(not ancestor-rev)
71382
4033086b16b6 2006-06-18 Michael Kifer <kifer@cs.stonybrook.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 68997
diff changeset
214 (ediff-delete-version-file ,(buffer-file-name ancestor-buf)))
33019
6306740f6938 2000-10-29 Michael Kifer <kifer@cs.sunysb.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 26585
diff changeset
215 )
6306740f6938 2000-10-29 Michael Kifer <kifer@cs.sunysb.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 26585
diff changeset
216 startup-hooks)))
14234
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
217 (if ancestor-rev
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
218 (ediff-merge-buffers-with-ancestor
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
219 buf1 buf2 ancestor-buf
20206
f44ff2c52fac new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 19047
diff changeset
220 startup-hooks 'ediff-merge-revisions-with-ancestor merge-buffer-file)
f44ff2c52fac new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 19047
diff changeset
221 (ediff-merge-buffers
f44ff2c52fac new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 19047
diff changeset
222 buf1 buf2 startup-hooks 'ediff-merge-revisions merge-buffer-file))
14234
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
16248
b2fae8abc5b0 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 15480
diff changeset
225 (defun ediff-rcs-merge-internal (rev1 rev2 ancestor-rev
20206
f44ff2c52fac new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 19047
diff changeset
226 &optional
f44ff2c52fac new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 19047
diff changeset
227 startup-hooks merge-buffer-file)
14234
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
228 ;; If ANCESTOR-REV non-nil, merge with ancestor
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
229 (let (buf1 buf2 ancestor-buf)
33019
6306740f6938 2000-10-29 Michael Kifer <kifer@cs.sunysb.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 26585
diff changeset
230 (save-window-excursion
6306740f6938 2000-10-29 Michael Kifer <kifer@cs.sunysb.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 26585
diff changeset
231 (setq buf1 (rcs-ediff-view-revision rev1)
6306740f6938 2000-10-29 Michael Kifer <kifer@cs.sunysb.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 26585
diff changeset
232 buf2 (if (string= rev2 "")
6306740f6938 2000-10-29 Michael Kifer <kifer@cs.sunysb.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 26585
diff changeset
233 (current-buffer)
6306740f6938 2000-10-29 Michael Kifer <kifer@cs.sunysb.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 26585
diff changeset
234 (rcs-ediff-view-revision rev2))
6306740f6938 2000-10-29 Michael Kifer <kifer@cs.sunysb.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 26585
diff changeset
235 ancestor-buf (if ancestor-rev
6306740f6938 2000-10-29 Michael Kifer <kifer@cs.sunysb.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 26585
diff changeset
236 (if (string= ancestor-rev "")
6306740f6938 2000-10-29 Michael Kifer <kifer@cs.sunysb.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 26585
diff changeset
237 (current-buffer)
6306740f6938 2000-10-29 Michael Kifer <kifer@cs.sunysb.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 26585
diff changeset
238 (rcs-ediff-view-revision ancestor-rev)))))
14234
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
239 ;; 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
240 ;; anything in startup hooks to ediff-buffers
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
241 (if ancestor-rev
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
242 (ediff-merge-buffers-with-ancestor
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
243 buf1 buf2 ancestor-buf
20206
f44ff2c52fac new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 19047
diff changeset
244 startup-hooks 'ediff-merge-revisions-with-ancestor merge-buffer-file)
f44ff2c52fac new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 19047
diff changeset
245 (ediff-merge-buffers
f44ff2c52fac new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 19047
diff changeset
246 buf1 buf2 startup-hooks 'ediff-merge-revisions merge-buffer-file))))
14234
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
247
16248
b2fae8abc5b0 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 15480
diff changeset
248 (defun ediff-generic-sc-merge-internal (rev1 rev2 ancestor-rev
20206
f44ff2c52fac new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 19047
diff changeset
249 &optional
f44ff2c52fac new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 19047
diff changeset
250 startup-hooks merge-buffer-file)
14234
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
251 ;; If ANCESTOR-REV non-nil, merge with ancestor
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
252 (let (buf1 buf2 ancestor-buf)
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
253 (save-excursion
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
254 (if (string= rev1 "")
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
255 (setq rev1 (generic-sc-get-latest-rev)))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
256 (sc-visit-previous-revision rev1)
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
257 (setq buf1 (current-buffer)))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
258 (save-excursion
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
259 (or (string= rev2 "")
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
260 (sc-visit-previous-revision rev2))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
261 (setq buf2 (current-buffer)))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
262 (if ancestor-rev
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
263 (save-excursion
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
264 (or (string= ancestor-rev "")
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
265 (sc-visit-previous-revision ancestor-rev))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
266 (setq ancestor-buf (current-buffer))))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
267 (if ancestor-rev
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
268 (ediff-merge-buffers-with-ancestor
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
269 buf1 buf2 ancestor-buf
20206
f44ff2c52fac new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 19047
diff changeset
270 startup-hooks 'ediff-merge-revisions-with-ancestor merge-buffer-file)
f44ff2c52fac new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 19047
diff changeset
271 (ediff-merge-buffers
f44ff2c52fac new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 19047
diff changeset
272 buf1 buf2 startup-hooks 'ediff-merge-revisions merge-buffer-file))))
14234
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
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
275 ;; PCL-CVS.el support
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
276
42602
633233bf2bbf 2002-01-07 Michael Kifer <kifer@cs.stonybrook.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 38422
diff changeset
277 ;; MK: Check. This function doesn't seem to be used any more by pcvs or pcl-cvs
14234
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
278 (defun cvs-run-ediff-on-file-descriptor (tin)
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
279 ;; This is a replacement for cvs-emerge-mode
20206
f44ff2c52fac new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 19047
diff changeset
280 ;; Runs after cvs-update.
14234
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
281 ;; Ediff-merge appropriate revisions of the selected file.
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
282 (let* ((fileinfo (tin-cookie cvs-cookie-handle tin))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
283 (type (cvs-fileinfo->type fileinfo))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
284 (tmp-file
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
285 (cvs-retrieve-revision-to-tmpfile fileinfo))
20343
4327dd36b71b new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 20206
diff changeset
286 (default-directory
21940
f7e788ea680b new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 20343
diff changeset
287 (file-name-as-directory (cvs-fileinfo->dir fileinfo)))
14234
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
288 ancestor-file)
49588
37645a051842 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 49428
diff changeset
289
14234
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
290 (or (memq type '(MERGED CONFLICT MODIFIED))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
291 (error
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
292 "Can only merge `Modified', `Merged' or `Conflict' files"))
49588
37645a051842 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 49428
diff changeset
293
14234
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
294 (cond ((memq type '(MERGED CONFLICT))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
295 (setq ancestor-file
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
296 (cvs-retrieve-revision-to-tmpfile
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
297 fileinfo
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
298 ;; revision
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
299 (cvs-fileinfo->base-revision fileinfo)))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
300 (ediff-merge-buffers-with-ancestor
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
301 (find-file-noselect tmp-file)
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
302 (find-file-noselect (cvs-fileinfo->backup-file fileinfo))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
303 (find-file-noselect ancestor-file)
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
304 nil ; startup-hooks
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
305 'ediff-merge-revisions-with-ancestor))
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
306 ((eq type 'MODIFIED)
20343
4327dd36b71b new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 20206
diff changeset
307 (ediff-buffers
14234
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
308 (find-file-noselect tmp-file)
65627
511f8e9d22ca 2005-09-20 Michael Kifer <kifer@cs.stonybrook.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 64762
diff changeset
309 (if (featurep 'xemacs)
511f8e9d22ca 2005-09-20 Michael Kifer <kifer@cs.stonybrook.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 64762
diff changeset
310 ;; XEmacs doesn't seem to have cvs-fileinfo->full-name
511f8e9d22ca 2005-09-20 Michael Kifer <kifer@cs.stonybrook.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 64762
diff changeset
311 (find-file-noselect (cvs-fileinfo->full-path fileinfo))
511f8e9d22ca 2005-09-20 Michael Kifer <kifer@cs.stonybrook.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 64762
diff changeset
312 (find-file-noselect (cvs-fileinfo->full-name fileinfo)))
14234
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
313 nil ; startup-hooks
20343
4327dd36b71b new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 20206
diff changeset
314 'ediff-revisions)))
71382
4033086b16b6 2006-06-18 Michael Kifer <kifer@cs.stonybrook.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 68997
diff changeset
315 (if (stringp tmp-file) (ediff-delete-version-file tmp-file))
4033086b16b6 2006-06-18 Michael Kifer <kifer@cs.stonybrook.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 68997
diff changeset
316 (if (stringp ancestor-file) (ediff-delete-version-file ancestor-file))))
4033086b16b6 2006-06-18 Michael Kifer <kifer@cs.stonybrook.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 68997
diff changeset
317
4033086b16b6 2006-06-18 Michael Kifer <kifer@cs.stonybrook.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 68997
diff changeset
318
4033086b16b6 2006-06-18 Michael Kifer <kifer@cs.stonybrook.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 68997
diff changeset
319 ;; delete version file on exit unless ediff-keep-tmp-versions is true
4033086b16b6 2006-06-18 Michael Kifer <kifer@cs.stonybrook.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 68997
diff changeset
320 (defun ediff-delete-version-file (file)
4033086b16b6 2006-06-18 Michael Kifer <kifer@cs.stonybrook.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 68997
diff changeset
321 (or ediff-keep-tmp-versions (delete-file file)))
14234
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
322
64215
a4c59075cac8 * viper-cmd.el (viper--key-maps): new variable.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 64091
diff changeset
323
a4c59075cac8 * viper-cmd.el (viper--key-maps): new variable.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 64091
diff changeset
324 (provide 'ediff-vers)
a4c59075cac8 * viper-cmd.el (viper--key-maps): new variable.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 64091
diff changeset
325
68997
6169b51037af 2006-02-19 Michael Kifer <kifer@cs.stonybrook.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 68651
diff changeset
326
14234
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
327 ;;; Local Variables:
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
328 ;;; eval: (put 'ediff-defvar-local 'lisp-indent-hook 'defun)
19047
f90d40b0bff5 new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18054
diff changeset
329 ;;; eval: (put 'ediff-with-current-buffer 'lisp-indent-hook 1)
f90d40b0bff5 new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18054
diff changeset
330 ;;; eval: (put 'ediff-with-current-buffer 'edebug-form-spec '(form body))
14234
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
331 ;;; End:
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
332
52401
695cf19ef79e Add arch taglines
Miles Bader <miles@gnu.org>
parents: 49588
diff changeset
333 ;;; arch-tag: bbb34f0c-2a90-426a-a77a-c75f479ebbbf
14234
685f31261967 Initial revision
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
diff changeset
334 ;;; ediff-vers.el ends here