annotate lisp/pcl-cvs/pcl-cvs.el @ 10:49a24b4fd526 r19-15b6

Import from CVS: tag r19-15b6
author cvs
date Mon, 13 Aug 2007 08:47:52 +0200
parents 376386a54a3c
children 1a767b41a199
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2 ;;;#ident "@(#)OrigId: pcl-cvs.el,v 1.93 1993/05/31 22:44:00 ceder Exp "
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3 ;;;
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 0
diff changeset
4 ;;;#ident "@(#)cvs/contrib/pcl-cvs:$Name: r19-15b6 $:$Id: pcl-cvs.el,v 1.2 1996/12/29 00:15:02 steve Exp $"
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
6 ;;; pcl-cvs.el -- A Front-end to CVS 1.3 or later.
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 0
diff changeset
7 ;;; Release 1.05-CVS-$Name: r19-15b6 $.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
8 ;;; Copyright (C) 1991, 1992, 1993 Per Cederqvist
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
9
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
10 ;;; This program is free software; you can redistribute it and/or modify
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
11 ;;; it under the terms of the GNU General Public License as published by
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
12 ;;; the Free Software Foundation; either version 2 of the License, or
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
13 ;;; (at your option) any later version.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
14 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
15 ;;; This program is distributed in the hope that it will be useful,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
16 ;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
17 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
18 ;;; GNU General Public License for more details.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
19 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
20 ;;; You should have received a copy of the GNU General Public License
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
21 ;;; along with this program; if not, write to the Free Software
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 0
diff changeset
22 ;;; Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 0
diff changeset
23 ;;; 02111-1307, USA.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
24
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
25 ;;; See below for installation instructions.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
26
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
27 ;;; There is an TeXinfo file that describes this package. You should read it
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
28 ;;; to get the most from this package.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
29
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
30 ;;; Mail questions and bug reports regarding this version (as included in
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
31 ;;; CVS-1.7 or newer) to the pcl-cvs support team at <pcl-cvs@cyclic.com>.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
32
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
33 ;;; Don't try to use this with CVS 1.2 or earlier. It won't work. Get CVS 1.7
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
34 ;;; or newer. Use the version of RCS best suited for the version of CVS you're
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
35 ;;; using.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
36
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 0
diff changeset
37 (require 'cookie) ; from ELIB-1.0
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
38 (require 'add-log) ; for all the ChangeLog goodies
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
39
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
40 ;;; -------------------------------------------------------
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
41 ;;; START OF THINGS TO CHECK WHEN INSTALLING
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
42
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
43 ;; also use $GNU here, since may folks might install CVS as a GNU package
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
44 ;;
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 0
diff changeset
45 (defun cvs-find-program (program)
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 0
diff changeset
46 (let ((path (list (getenv "LOCAL")
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 0
diff changeset
47 (getenv "GNU")
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 0
diff changeset
48 "/usr/local/bin"
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 0
diff changeset
49 "/usr/bin"
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 0
diff changeset
50 "/bin")))
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 0
diff changeset
51 (while path
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 0
diff changeset
52 (if (stringp (car path))
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 0
diff changeset
53 (let ((abs-program (expand-file-name program (car path))))
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 0
diff changeset
54 (if (file-executable-p abs-program)
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 0
diff changeset
55 (setq path nil
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 0
diff changeset
56 program abs-program))))
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 0
diff changeset
57 (setq path (cdr path)))
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 0
diff changeset
58 program))
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 0
diff changeset
59
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 0
diff changeset
60 (defvar cvs-program (cvs-find-program "cvs")
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
61 "*Full path to the cvs executable.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
62
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
63 ;; SunOS-4.1.1_U1 has "diff.c 1.12 88/08/04 SMI; from UCB 4.6 86/04/03"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
64 ;;
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 0
diff changeset
65 (defvar cvs-diff-program (cvs-find-program "diff")
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
66 "*Full path to the best diff program you've got.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
67 NOTE: there are some nasty bugs in the context diff variants of some vendor
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
68 versions, such as the one in SunOS-4.1.1_U1")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
69
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
70 (defvar cvs-rmdir-program "/bin/rmdir"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
71 "*Full path to the rmdir program. Typically /bin/rmdir.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
72
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
73 (defvar cvs-shell "/bin/sh"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
74 "*Full path to a shell that can do redirection on stdout.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
75
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
76 ;;; Options to control various features:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
77
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
78 (defvar cvs-changelog-full-paragraphs t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
79 "If non-nil, include full ChangeLog paragraphs in the CVS log.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
80 This may be set in the ``local variables'' section of a ChangeLog, to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
81 indicate the policy for that ChangeLog.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
82
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
83 A ChangeLog paragraph is a bunch of log text containing no blank lines;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
84 a paragraph usually describes a set of changes with a single purpose,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
85 but perhaps spanning several functions in several files. Changes in
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
86 different paragraphs are unrelated.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
87
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
88 You could argue that the CVS log entry for a file should contain the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
89 full ChangeLog paragraph mentioning the change to the file, even though
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
90 it may mention other files, because that gives you the full context you
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
91 need to understand the change. This is the behaviour you get when this
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
92 variable is set to t.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
93
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
94 On the other hand, you could argue that the CVS log entry for a change
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
95 should contain only the text for the changes which occurred in that
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
96 file, because the CVS log is per-file. This is the behaviour you get
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
97 when this variable is set to nil.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
98
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
99 (defvar cvs-cvsroot-required nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
100 "*Specifies whether CVS needs to be told where the repository is.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
101
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
102 In CVS 1.3, if your CVSROOT environment variable is not set, and you
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
103 do not set the `cvs-cvsroot' lisp variable, CVS will have no idea
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
104 where to find the repository, and refuse to run. CVS 1.4 and later
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
105 store the repository path with the working directories, so most
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
106 operations don't need to be told where the repository is.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
107
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
108 If you work with multiple repositories with CVS 1.4, it's probably
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
109 advisable to leave your CVSROOT environment variable unset, set this
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
110 variable to nil, and let CVS figure out where the repository is for
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
111 itself.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
112
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
113 (defvar cvs-cvsroot nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
114 "*Specifies where the (current) cvs master repository is.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
115 Overrides the $CVSROOT variable by sending \" -d dir\" to all cvs commands.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
116 This switch is useful if you have multiple CVS repositories, and are not using
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
117 a modern version of CVS that stores the current repository in CVS/Root.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
118
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
119 ;; Uncomment the following line if you are running on 18.57 or earlier.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
120 ;(setq delete-exited-processes nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
121 ;; Emacs version 18.57 and earlier is likely to crash if
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
122 ;; delete-exited-processes is t, since the sentinel uses lots of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
123 ;; memory, and 18.57 forgets to GCPROT a variable if
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
124 ;; delete-exited-processes is t.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
125
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
126 ;;; END OF THINGS TO CHECK WHEN INSTALLING
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
127 ;;; --------------------------------------------------------
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
128
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 0
diff changeset
129 (defconst pcl-cvs-version "1.05-CVS-$Name: r19-15b6 $"
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
130 "A string denoting the current release version of pcl-cvs.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
131
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
132 ;; You are NOT allowed to disable this message by default. However, you
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
133 ;; are encouraged to inform your users that by adding
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
134 ;; (setq cvs-inhibit-copyright-message t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
135 ;; to their .emacs they can get rid of it. Just don't add that line
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
136 ;; to your default.el!
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
137 (defvar cvs-inhibit-copyright-message nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
138 "*Non-nil means don't display a Copyright message in the ``*cvs*'' buffer.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
139
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
140 (defconst cvs-startup-message
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
141 (if cvs-inhibit-copyright-message
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 0
diff changeset
142 "PCL-CVS release 1.05-CVS-$Name: r19-15b6 $"
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 0
diff changeset
143 "PCL-CVS release 1.05 from CVS release $Name: r19-15b6 $.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
144 Copyright (C) 1992, 1993 Per Cederqvist
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
145 Pcl-cvs comes with absolutely no warranty; for details consult the manual.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
146 This is free software, and you are welcome to redistribute it under certain
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
147 conditions; again, consult the TeXinfo manual for details.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
148 "*Startup message for CVS.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
149
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
150 (defconst pcl-cvs-bugs-address "pcl-cvs-auto-bugs@cyclic.com"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
151 "The destination address used for the default bug report form.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
152
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
153 (defvar cvs-stdout-file nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
154 "Name of the file that holds the output that CVS sends to stdout.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
155 This variable is buffer local.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
156
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
157 (defvar cvs-lock-file nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
158 "Full path to a lock file that CVS is waiting for (or was waiting for).")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
159
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
160 (defvar cvs-bakprefix ".#"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
161 "The prefix that CVS prepends to files when rcsmerge'ing.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
162
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
163 (defvar cvs-erase-input-buffer nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
164 "*Non-nil if input buffers should be cleared before asking for new info.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
165
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
166 (defvar cvs-auto-remove-handled nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
167 "*Non-nil if cvs-mode-remove-handled should be called automatically.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
168 If this is set to any non-nil value, entries that do not need to be checked in
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
169 will be removed from the *cvs* buffer after every cvs-mode-commit command.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
170
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
171 (defvar cvs-auto-remove-handled-directories nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
172 "*Non-nil if cvs-mode-remove-handled and cvs-update should automatically
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
173 remove empty directories.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
174 If this is set to any non-nil value, directories that do not contain any files
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
175 to be checked in will be removed from the *cvs* buffer.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
176
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
177 (defvar cvs-sort-ignore-file t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
178 "*Non-nil if cvs-mode-ignore should sort the .cvsignore automatically.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
179
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
180 (defvar cvs-auto-revert-after-commit t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
181 "*Non-nil if committed buffers should be automatically reverted.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
182
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
183 (defconst cvs-cursor-column 14
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
184 "Column to position cursor in in cvs-mode.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
185 Column 0 is left-most column.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
186
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
187 (defvar cvs-mode-map nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
188 "Keymap for the cvs mode.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
189
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
190 (defvar cvs-edit-mode-map nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
191 "Keymap for the cvs edit mode (used when editing cvs log messages).")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
192
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
193 (defvar cvs-buffer-name "*cvs*"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
194 "Name of the cvs buffer.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
195
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
196 (defvar cvs-commit-prompt-buffer "*cvs-commit-message*"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
197 "Name of buffer in which the user is prompted for a log message when
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
198 committing files.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
199
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
200 (defvar cvs-commit-buffer-require-final-newline t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
201 "*t says silently put a newline at the end of commit log messages.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
202 Non-nil but not t says ask user whether to add a newline in each such case.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
203 nil means don't add newlines.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
204
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
205 (defvar cvs-temp-buffer-name "*cvs-tmp*"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
206 "*Name of the cvs temporary buffer.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
207 Output from cvs is placed here by synchronous commands.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
208
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
209 (defvar cvs-diff-ignore-marks nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
210 "*Non-nil if cvs-diff and cvs-mode-diff-backup should ignore any marked files.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
211 Normally they run diff on the files that are marked (with cvs-mode-mark),
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
212 or the file under the cursor if no files are marked. If this variable
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
213 is set to a non-nil value they will always run diff on the file on the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
214 current line.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
215
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
216 ;;; (setq cvs-status-flags '("-v"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
217 (defvar cvs-status-flags '("-v")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
218 "*List of flags to pass to ``cvs status''. Default is \"-v\".")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
219
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
220 ;;; (setq cvs-log-flags nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
221 (defvar cvs-log-flags nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
222 "*List of flags to pass to ``cvs log''. Default is none.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
223
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
224 ;;; (setq cvs-tag-flags nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
225 (defvar cvs-tag-flags nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
226 "*List of extra flags to pass to ``cvs tag''. Default is none.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
227
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
228 ;;; (setq cvs-rtag-flags nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
229 (defvar cvs-rtag-flags nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
230 "*List of extra flags to pass to ``cvs rtag''. Default is none.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
231
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
232 ;;; (setq cvs-diff-flags '("-u"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
233 (defvar cvs-diff-flags '("-u")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
234 "*List of flags to use as flags to pass to ``diff'' and ``cvs diff''.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
235 Used by cvs-mode-diff-cvs and cvs-mode-diff-backup. Default is \"-u\".
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
236
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
237 Set this to \"-u\" to get a Unidiff format, or \"-c\" to get context diffs.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
238
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
239 ;;; (setq cvs-update-optional-flags nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
240 (defvar cvs-update-optional-flags nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
241 "*List of strings to use as optional flags to pass to ``cvs update''. Used
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
242 by cvs-do-update, called by cvs-update, cvs-update-other-window,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
243 cvs-mode-update-no-prompt, and cvs-examine. Default is none.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
244
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
245 For example set this to \"-j VENDOR_PREV_RELEASE -j VENDOR_TOP_RELEASE\" to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
246 perform an update after a new vendor release has been imported.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
247
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
248 To restrict the update to the current working directory, set this to \"-l\".")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
249
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
250 (defvar cvs-update-prog-output-skip-regexp "$"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
251 "*A regexp that matches the end of the output from all cvs update programs.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
252 That is, output from any programs that are run by CVS (by the flag -u in the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
253 `modules' file - see cvs(5)) when `cvs update' is performed should terminate
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
254 with a line that this regexp matches. It is enough that some part of the line
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
255 is matched.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
256
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
257 The default (a single $) fits programs without output.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
258
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
259 ;;; --------------------------------------------------------
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
260 ;;; The variables below are used internally by pcl-cvs. You should
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
261 ;;; never change them.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
262
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
263 (defvar cvs-buffers-to-delete nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
264 "List of temporary buffers that should be discarded as soon as possible.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
265 Due to a bug in emacs 18.57 the sentinel can't discard them reliably.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
266
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
267 (defvar cvs-update-running nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
268 "This is set to nil when no process is running, and to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
269 the process when a cvs update process is running.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
270
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
271 (defvar cvs-cookie-handle nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
272 "Handle for the cookie structure that is displayed in the *cvs* buffer.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
273
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
274 (defvar cvs-commit-list nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
275 "Used internally by pcl-cvs.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
276
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
277 ;;; The cvs data structure:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
278 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
279 ;;; When the `cvs update' is ready we parse the output. Every file
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
280 ;;; that is affected in some way is added as a cookie of fileinfo
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
281 ;;; (as defined below).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
282 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
283
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
284 ;;; cvs-fileinfo
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
285
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
286 ;;; Constructor:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
287
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
288 (defun cvs-create-fileinfo (type
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
289 dir
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
290 file-name
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
291 full-log)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
292 "Create a fileinfo from all parameters.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
293 Arguments: TYPE DIR FILE-NAME FULL-LOG.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
294 A fileinfo is a vector with the following fields:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
295
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
296 [0] handled True if this file doesn't require further action.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
297 [1] marked t/nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
298 [2] type One of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
299 UPDATED - file copied from repository
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
300 PATCHED - file update with patch from repository
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
301 MODIFIED - modified by you, unchanged in
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
302 repository
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
303 ADDED - added by you, not yet committed
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
304 REMOVED - removed by you, not yet committed
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
305 CVS-REMOVED- removed, since file no longer exists
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
306 in the repository.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
307 MERGED - successful merge
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
308 CONFLICT - conflict when merging (if pcl-cvs did it)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
309 REM-CONFLICT-removed in repository, but altered
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
310 locally.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
311 MOD-CONFLICT-removed locally, changed in repository.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
312 REM-EXIST - removed locally, but still exists.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
313 DIRCHANGE - A change of directory.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
314 UNKNOWN - An unknown file.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
315 UNKNOWN-DIR- An unknown directory.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
316 MOVE-AWAY - A file that is in the way.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
317 REPOS-MISSING- The directory has vanished from the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
318 repository.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
319 MESSAGE - This is a special fileinfo that is used
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
320 to display a text that should be in
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
321 full-log.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
322 [3] dir Directory the file resides in. Should not end with slash.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
323 [4] file-name The file name.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
324 [5] backup-file The name of a backup file created during a merge.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
325 Only valid for MERGED and CONFLICT files.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
326 [6] base-revision The revision that the working file was based on.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
327 Only valid for MERGED and CONFLICT files.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
328 [7] head-revision The revision that the newly merged changes came from
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
329 Only valid for MERGED and CONFLICT files.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
330 [8] backup-revision The revision of the cvs backup file (original working rev.)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
331 Only valid for MERGED and CONFLICT files.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
332 [9] cvs-diff-buffer A buffer that contains a 'cvs diff file'.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
333 [10] vendor-diff-buffer A buffer that contains a 'diff base-file head-file'.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
334 [11] backup-diff-buffer A buffer that contains a 'diff file backup-file'.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
335 [12] full-log The output from cvs, unparsed.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
336 [13] mod-time Modification time of file used for *-diff-buffer."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
337
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
338 (cons
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
339 'CVS-FILEINFO
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
340 (vector nil nil type dir file-name nil nil nil nil nil nil nil full-log nil nil)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
341
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
342 ;;; Selectors:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
343
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
344 (defun cvs-fileinfo->handled (cvs-fileinfo)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
345 "Get the `handled' field from CVS-FILEINFO."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
346 (elt (cdr cvs-fileinfo) 0))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
347
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
348 (defun cvs-fileinfo->marked (cvs-fileinfo)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
349 "Check if CVS-FILEINFO is marked."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
350 (elt (cdr cvs-fileinfo) 1))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
351
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
352 (defun cvs-fileinfo->type (cvs-fileinfo)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
353 "Get type from CVS-FILEINFO.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
354 Type is one of UPDATED, PATCHED, MODIFIED, ADDED, REMOVED, CVS-REMOVED, MERGED,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
355 CONFLICT, REM-CONFLICT, MOD-CONFLICT, REM-EXIST, DIRCHANGE, UNKNOWN,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
356 UNKNOWN-DIR, MOVE-AWAY, REPOS-MISSING or MESSAGE."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
357 (elt (cdr cvs-fileinfo) 2))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
358
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
359 (defun cvs-fileinfo->dir (cvs-fileinfo)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
360 "Get dir from CVS-FILEINFO.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
361 The directory name does not end with a slash."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
362 (elt (cdr cvs-fileinfo) 3))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
363
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
364 (defun cvs-fileinfo->file-name (cvs-fileinfo)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
365 "Get file-name from CVS-FILEINFO."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
366 (elt (cdr cvs-fileinfo) 4))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
367
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
368 (defun cvs-fileinfo->backup-file (cvs-fileinfo)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
369 "Get backup-file from CVS-FILEINFO."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
370 (elt (cdr cvs-fileinfo) 5))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
371
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
372 (defun cvs-fileinfo->base-revision (cvs-fileinfo)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
373 "Get the base revision from CVS-FILEINFO."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
374 (elt (cdr cvs-fileinfo) 6))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
375
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
376 (defun cvs-fileinfo->head-revision (cvs-fileinfo)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
377 "Get the head revision from CVS-FILEINFO."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
378 (elt (cdr cvs-fileinfo) 7))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
379
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
380 (defun cvs-fileinfo->backup-revision (cvs-fileinfo)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
381 "Get the backup revision from CVS-FILEINFO."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
382 (elt (cdr cvs-fileinfo) 8))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
383
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
384 (defun cvs-fileinfo->cvs-diff-buffer (cvs-fileinfo)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
385 "Get cvs-diff-buffer from CVS-FILEINFO."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
386 (elt (cdr cvs-fileinfo) 9))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
387
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
388 (defun cvs-fileinfo->vendor-diff-buffer (cvs-fileinfo)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
389 "Get backup-diff-buffer from CVS-FILEINFO."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
390 (elt (cdr cvs-fileinfo) 10))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
391
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
392 (defun cvs-fileinfo->backup-diff-buffer (cvs-fileinfo)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
393 "Get backup-diff-buffer from CVS-FILEINFO."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
394 (elt (cdr cvs-fileinfo) 11))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
395
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
396 (defun cvs-fileinfo->full-log (cvs-fileinfo)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
397 "Get full-log from CVS-FILEINFO."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
398 (elt (cdr cvs-fileinfo) 12))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
399
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
400 (defun cvs-fileinfo->mod-time (cvs-fileinfo)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
401 "Get mod-time from CVS-FILEINFO."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
402 (elt (cdr cvs-fileinfo) 13))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
403
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
404 ;;; Modifiers:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
405
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
406 (defun cvs-set-fileinfo->handled (cvs-fileinfo newval)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
407 "Set handled in CVS-FILEINFO to NEWVAL."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
408 (aset (cdr cvs-fileinfo) 0 newval))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
409
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
410 (defun cvs-set-fileinfo->marked (cvs-fileinfo newval)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
411 "Set marked in CVS-FILEINFO to NEWVAL."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
412 (aset (cdr cvs-fileinfo) 1 newval))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
413
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
414 (defun cvs-set-fileinfo->type (cvs-fileinfo newval)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
415 "Set type in CVS-FILEINFO to NEWVAL."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
416 (aset (cdr cvs-fileinfo) 2 newval))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
417
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
418 (defun cvs-set-fileinfo->dir (cvs-fileinfo newval)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
419 "Set dir in CVS-FILEINFO to NEWVAL.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
420 The directory should now end with a slash."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
421 (aset (cdr cvs-fileinfo) 3 newval))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
422
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
423 (defun cvs-set-fileinfo->file-name (cvs-fileinfo newval)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
424 "Set file-name in CVS-FILEINFO to NEWVAL."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
425 (aset (cdr cvs-fileinfo) 4 newval))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
426
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
427 (defun cvs-set-fileinfo->backup-file (cvs-fileinfo newval)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
428 "Set backup-file in CVS-FILEINFO to NEWVAL."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
429 (aset (cdr cvs-fileinfo) 5 newval))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
430
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
431 (defun cvs-set-fileinfo->base-revision (cvs-fileinfo newval)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
432 "Set base-revision in CVS-FILEINFO to NEWVAL."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
433 (aset (cdr cvs-fileinfo) 6 newval))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
434
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
435 (defun cvs-set-fileinfo->head-revision (cvs-fileinfo newval)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
436 "Set head-revision in CVS-FILEINFO to NEWVAL."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
437 (aset (cdr cvs-fileinfo) 7 newval))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
438
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
439 (defun cvs-set-fileinfo->backup-revision (cvs-fileinfo newval)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
440 "Set backup-revision in CVS-FILEINFO to NEWVAL."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
441 (aset (cdr cvs-fileinfo) 8 newval))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
442
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
443 (defun cvs-set-fileinfo->cvs-diff-buffer (cvs-fileinfo newval)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
444 "Set cvs-diff-buffer in CVS-FILEINFO to NEWVAL."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
445 (aset (cdr cvs-fileinfo) 9 newval))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
446
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
447 (defun cvs-set-fileinfo->vendor-diff-buffer (cvs-fileinfo newval)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
448 "Set vendor-diff-buffer in CVS-FILEINFO to NEWVAL."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
449 (aset (cdr cvs-fileinfo) 10 newval))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
450
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
451 (defun cvs-set-fileinfo->backup-diff-buffer (cvs-fileinfo newval)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
452 "Set backup-diff-buffer in CVS-FILEINFO to NEWVAL."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
453 (aset (cdr cvs-fileinfo) 11 newval))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
454
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
455 (defun cvs-set-fileinfo->full-log (cvs-fileinfo newval)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
456 "Set full-log in CVS-FILEINFO to NEWVAL."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
457 (aset (cdr cvs-fileinfo) 12 newval))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
458
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
459 (defun cvs-set-fileinfo->mod-time (cvs-fileinfo newval)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
460 "Set full-log in CVS-FILEINFO to NEWVAL."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
461 (aset (cdr cvs-fileinfo) 13 newval))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
462
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
463 ;;; Predicate:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
464
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
465 (defun cvs-fileinfo-p (object)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
466 "Return t if OBJECT is a cvs-fileinfo."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
467 (eq (car-safe object) 'CVS-FILEINFO))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
468
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
469 ;;;; End of types.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
470
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
471 ;;----------
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
472 (defun cvs-use-temp-buffer ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
473 "Display a temporary buffer in another window and select it.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
474 The selected window will not be changed. The temporary buffer will
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
475 be erased and writable."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
476
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
477 (let ((dir default-directory))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
478 (display-buffer (get-buffer-create cvs-temp-buffer-name))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
479 (set-buffer cvs-temp-buffer-name)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
480 (setq buffer-read-only nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
481 (setq default-directory dir)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
482 (erase-buffer)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
483
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
484 ;;----------
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
485 (defun cvs-examine (directory &optional local)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
486 "Run a 'cvs -n update' in the current working directory.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
487 That is, check what needs to be done, but don't change the disc.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
488 Feed the output to a *cvs* buffer and run cvs-mode on it.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
489 If optional prefix argument LOCAL is non-nil, 'cvs update -l' is run.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
490 WARNING: this doesn't work very well yet...."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
491
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
492 ;; TODO: this should do everything cvs-update does...
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
493 ;; for example, for CONFLICT files, it should setup fileinfo appropriately
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
494
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
495 (interactive (list (read-file-name "CVS Update (directory): "
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
496 nil default-directory nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
497 current-prefix-arg))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
498 (cvs-do-update directory local 'noupdate))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
499
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
500 ;;----------
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
501 ;;;###autoload
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
502 (defun cvs-update (directory &optional local)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
503 "Run a 'cvs update' in the current working directory. Feed the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
504 output to a *cvs* buffer and run cvs-mode on it.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
505 If optional prefix argument LOCAL is non-nil, 'cvs update -l' is run."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
506
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
507 (interactive (list (read-file-name "CVS Update (directory): "
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
508 nil default-directory nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
509 current-prefix-arg))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
510 (cvs-do-update directory local nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
511 (switch-to-buffer cvs-buffer-name))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
512
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
513 ;;----------
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
514 ;;;###autoload
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
515 (defun cvs-update-other-window (directory &optional local)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
516 "Run a 'cvs update' in the current working directory. Feed the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
517 output to a *cvs* buffer, display it in the other window, and run
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
518 cvs-mode on it.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
519
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
520 If optional prefix argument LOCAL is non-nil, 'cvs update -l' is run."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
521
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
522 (interactive (list (read-file-name "CVS Update other window (directory): "
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
523 nil default-directory nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
524 current-prefix-arg))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
525 (cvs-do-update directory local nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
526 (switch-to-buffer-other-window cvs-buffer-name))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
527
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
528 ;;----------
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
529 (defun cvs-filter (predicate list &rest extra-args)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
530 "Apply PREDICATE to each element on LIST.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
531 Args: PREDICATE LIST &rest EXTRA-ARGS.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
532
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
533 Return a new list consisting of those elements that PREDICATE
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
534 returns non-nil for.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
535
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
536 If more than two arguments are given the remaining args are
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
537 passed to PREDICATE."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
538
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
539 ;; Avoid recursion - this should work for LONG lists also!
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
540 (let* ((head (cons 'dummy-header nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
541 (tail head))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
542 (while list
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
543 (if (apply predicate (car list) extra-args)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
544 (setq tail (setcdr tail (list (car list)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
545 (setq list (cdr list)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
546 (cdr head)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
547
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
548 ;;----------
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
549 (defun cvs-mode-update-no-prompt ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
550 "Run cvs update in current directory."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
551
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
552 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
553 (cvs-do-update default-directory nil nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
554
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
555 ;;----------
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
556 (defun cvs-do-update (directory local dont-change-disc)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
557 "Do a 'cvs update' in DIRECTORY.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
558 Args: DIRECTORY LOCAL DONT-CHANGE-DISC.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
559
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
560 If LOCAL is non-nil 'cvs update -l' is executed.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
561 If DONT-CHANGE-DISC is non-nil 'cvs -n update' is executed.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
562 Both LOCAL and DONT-CHANGE-DISC may be non-nil simultaneously.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
563
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
564 *Note*: DONT-CHANGE-DISC does not yet work. The parser gets confused."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
565
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
566 (save-some-buffers)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
567 ;; Ensure that it is safe to do an update. If not, ask user
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
568 ;; for confirmation.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
569 (if (and (boundp 'cvs-cookie-handle) (collection-buffer cvs-cookie-handle))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
570 (if (collection-collect-tin
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
571 cvs-cookie-handle
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
572 '(lambda (cookie) (eq (cvs-fileinfo->type cookie) 'CONFLICT)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
573 (if (not
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
574 (yes-or-no-p
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
575 "Only update if conflicts have been resolved. Continue? "))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
576 (error "Update aborted by user request."))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
577 (if (not (file-exists-p cvs-program))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
578 (error "%s: file not found (check setting of cvs-program)"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
579 cvs-program))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
580 (let* ((this-dir (file-name-as-directory (expand-file-name directory)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
581 (update-buffer (generate-new-buffer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
582 (concat " " (file-name-nondirectory
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
583 (substring this-dir 0 -1))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
584 "-update")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
585 (temp-name (make-temp-name
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
586 (concat (file-name-as-directory
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
587 (or (getenv "TMPDIR") "/tmp"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
588 "pcl-cvs.")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
589 (args nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
590
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
591 ;; Check that this-dir exists and is a directory that is under CVS contr.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
592
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
593 (if (not (file-directory-p this-dir))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
594 (error "%s is not a directory." this-dir))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
595 (if (not (file-directory-p (concat this-dir "CVS")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
596 (error "%s does not contain CVS controlled files." this-dir))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
597 (if (file-readable-p (concat this-dir "CVS/Root"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
598 (save-excursion ; read CVS/Root into cvs-cvsroot
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
599 (find-file (concat this-dir "CVS/Root"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
600 (goto-char (point-min))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
601 (setq cvs-cvsroot (buffer-substring (point)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
602 (progn (end-of-line) (point))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
603 (if (not cvs-cvsroot)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
604 (error "Invalid contents of %sCVS/Root" this-dir))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
605 (kill-buffer (current-buffer)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
606 (if (and cvs-cvsroot-required
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
607 (not (or (getenv "CVSROOT") cvs-cvsroot)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
608 (error "Both cvs-cvsroot and environment variable CVSROOT are unset, and no CVS/Root.")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
609
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
610 ;; Check that at most one `cvs update' is run at any time.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
611
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
612 (if (and cvs-update-running (process-status cvs-update-running)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
613 (or (eq (process-status cvs-update-running) 'run)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
614 (eq (process-status cvs-update-running) 'stop)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
615 (error "Can't run two `cvs update' simultaneously."))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
616
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
617 (if (not (listp cvs-update-optional-flags))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
618 (error "cvs-update-optional-flags should be set using cvs-set-update-optional-flags"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
619
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
620 ;; Generate "-d /master -n update -l".
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
621 (setq args (concat (if cvs-cvsroot (concat " -d " cvs-cvsroot))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
622 (if dont-change-disc " -n ")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
623 " update "
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
624 (if local " -l ")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
625 (if cvs-update-optional-flags
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
626 (mapconcat 'identity
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
627 (copy-sequence cvs-update-optional-flags)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
628 " "))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
629
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
630 ;; Set up the buffer that receives the stderr output from "cvs update".
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
631 (set-buffer update-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
632 (setq default-directory this-dir)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
633 (make-local-variable 'cvs-stdout-file)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
634 (setq cvs-stdout-file temp-name)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
635
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
636 (setq cvs-update-running
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
637 (let ((process-connection-type nil)) ; Use a pipe, not a pty.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
638 (start-process "cvs" update-buffer cvs-shell "-c"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
639 (concat cvs-program " " args " > " temp-name))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
640
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
641 (setq mode-line-process
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
642 (concat ": "
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
643 (symbol-name (process-status cvs-update-running))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
644 ; XEmacs change
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
645 (redraw-modeline) ; Update the mode line.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
646 (set-process-sentinel cvs-update-running 'cvs-sentinel)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
647 (set-process-filter cvs-update-running 'cvs-update-filter)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
648 (set-marker (process-mark cvs-update-running) (point-min))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
649
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
650 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
651 (set-buffer (get-buffer-create cvs-buffer-name))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
652 (setq buffer-read-only nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
653 (erase-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
654 (cvs-mode))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
655
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
656 (setq cvs-cookie-handle
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
657 (collection-create
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
658 cvs-buffer-name 'cvs-pp
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
659 cvs-startup-message ;See comment above cvs-startup-message.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
660 "---------- End -----"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
661
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
662 (cookie-enter-first
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
663 cvs-cookie-handle
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
664 (cvs-create-fileinfo
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
665 'MESSAGE nil nil (concat "\n Running `cvs " args "' in " this-dir
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
666 "...\n")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
667
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
668 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
669 (set-buffer cvs-buffer-name)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
670 (setq mode-line-process
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
671 (concat ": "
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
672 (symbol-name (process-status cvs-update-running))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
673 ; XEmacs change
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
674 (redraw-modeline) ; Update the mode line.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
675 (setq buffer-read-only t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
676
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
677 ;; Work around a bug in emacs 18.57 and earlier.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
678 (setq cvs-buffers-to-delete
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
679 (cvs-delete-unused-temporary-buffers cvs-buffers-to-delete)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
680
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
681 ;; The following line is said to improve display updates on some
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
682 ;; emacses. It shouldn't be needed, but it does no harm.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
683 (sit-for 0))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
684
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
685 ;;----------
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
686 (defun cvs-delete-unused-temporary-buffers (list)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
687 "Delete all buffers on LIST that is not visible.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
688 Return a list of all buffers that still is alive."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
689
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
690 (cond
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
691 ((null list) nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
692 ((get-buffer-window (car list))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
693 (cons (car list)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
694 (cvs-delete-unused-temporary-buffers (cdr list))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
695 (t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
696 (kill-buffer (car list))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
697 (cvs-delete-unused-temporary-buffers (cdr list)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
698
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
699 ;;----------
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
700 (put 'cvs-mode 'mode-class 'special)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
701
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
702 ;;----------
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
703 (defun cvs-mode ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
704 "\\<cvs-mode-map>Mode used for pcl-cvs, a front-end to CVS.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
705
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
706 To get to the \"*cvs*\" buffer you should use ``\\[execute-extended-command] cvs-update''.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
707
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
708 Full documentation is in the Texinfo file. Here are the most useful commands:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
709
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
710 \\[cvs-mode-previous-line] Move up. \\[cvs-mode-next-line] Move down.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
711 \\[cvs-mode-commit] Commit file. \\[cvs-mode-update-no-prompt] Re-update directory.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
712 \\[cvs-mode-mark] Mark file/dir. \\[cvs-mode-unmark] Unmark file/dir.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
713 \\[cvs-mode-mark-all-files] Mark all files. \\[cvs-mode-unmark-all-files] Unmark all files.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
714 \\[cvs-mode-find-file] Edit file/run Dired. \\[cvs-mode-find-file-other-window] Find file or run Dired in other window.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
715 \\[cvs-mode-ignore] Add file to ./.cvsignore. \\[cvs-mode-add-change-log-entry-other-window] Write ChangeLog in other window.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
716 \\[cvs-mode-add] Add to repository. \\[cvs-mode-remove-file] Remove file.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
717 \\[cvs-mode-diff-cvs] Diff with base revision. \\[cvs-mode-diff-backup] Diff backup file.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
718 \\[cvs-mode-ediff] Ediff base rev & backup. \\[cvs-mode-diff-vendor] Show merge from vendor branch.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
719 \\[cvs-mode-emerge] Emerge base rev & backup. \\[cvs-mode-diff-backup] Diff backup file.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
720 \\[cvs-mode-acknowledge] Delete line from buffer. \\[cvs-mode-remove-handled] Remove processed entries.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
721 \\[cvs-mode-log] Run ``cvs log''. \\[cvs-mode-status] Run ``cvs status''.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
722 \\[cvs-mode-tag] Run ``cvs tag''. \\[cvs-mode-rtag] Run ``cvs rtag''.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
723 \\[cvs-mode-changelog-commit] Like \\[cvs-mode-commit], but get default log text from ChangeLog.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
724 \\[cvs-mode-undo-local-changes] Revert the last checked in version - discard your changes to the file.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
725
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
726 Entry to this mode runs cvs-mode-hook.
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 0
diff changeset
727 This description is updated for release 1.05-CVS-$Name: r19-15b6 $ of pcl-cvs.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
728
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
729 All bindings:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
730 \\{cvs-mode-map}"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
731
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
732 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
733 (setq major-mode 'cvs-mode)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
734 (setq mode-name "CVS")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
735 (setq mode-line-process nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
736 ;; for older v18 emacs
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
737 ;;(buffer-flush-undo (current-buffer))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
738 (buffer-disable-undo (current-buffer))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
739 (make-local-variable 'goal-column)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
740 (setq goal-column cvs-cursor-column)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
741 (use-local-map cvs-mode-map)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
742 (run-hooks 'cvs-mode-hook))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
743
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
744 ;;----------
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
745 (defun cvs-sentinel (proc msg)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
746 "Sentinel for the cvs update process.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
747 This is responsible for parsing the output from the cvs update when
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
748 it is finished."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
749
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
750 (cond
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
751 ((null (buffer-name (process-buffer proc)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
752 ;; buffer killed
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
753 (set-process-buffer proc nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
754 ((memq (process-status proc) '(signal exit))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
755 (let* ((obuf (current-buffer))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
756 (omax (point-max))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
757 (opoint (point)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
758 ;; save-excursion isn't the right thing if
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
759 ;; process-buffer is current-buffer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
760 (unwind-protect
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
761 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
762 (set-buffer (process-buffer proc))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
763 (setq mode-line-process
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
764 (concat ": "
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
765 (symbol-name (process-status proc))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
766 (let* ((out-file cvs-stdout-file)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
767 (stdout-buffer (find-file-noselect out-file)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
768 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
769 (set-buffer stdout-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
770 (rename-buffer (concat " "
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
771 (file-name-nondirectory out-file)) t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
772 (cvs-parse-update stdout-buffer (process-buffer proc))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
773 (setq cvs-buffers-to-delete
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
774 (cons (process-buffer proc)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
775 (cons stdout-buffer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
776 cvs-buffers-to-delete)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
777 (delete-file out-file)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
778 (message "CVS update process has completed.") ; XEmacs
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
779 (set-buffer-modified-p (buffer-modified-p))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
780 (setq cvs-update-running nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
781 (if (equal obuf (process-buffer proc))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
782 nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
783 (set-buffer (process-buffer proc))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
784 (if (< opoint omax)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
785 (goto-char opoint))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
786 (set-buffer obuf))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
787
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
788 ;;----------
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
789 (defun cvs-update-filter (proc string)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
790 "Filter function for pcl-cvs.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
791 This function gets the output that CVS sends to stderr. It inserts it
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
792 into (process-buffer proc) but it also checks if CVS is waiting for a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
793 lock file. If so, it inserts a message cookie in the *cvs* buffer."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
794
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
795 (let ((old-buffer (current-buffer))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
796 (data (match-data)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
797 (unwind-protect
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
798 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
799 (set-buffer (process-buffer proc))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
800 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
801 ;; Insert the text, moving the process-marker.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
802 (goto-char (process-mark proc))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
803 (insert string)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
804 (set-marker (process-mark proc) (point))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
805 ;; Delete any old lock message
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
806 (if (tin-nth cvs-cookie-handle 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
807 (tin-delete cvs-cookie-handle
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
808 (tin-nth cvs-cookie-handle 1)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
809 ;; Check if CVS is waiting for a lock.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
810 (beginning-of-line 0) ;Move to beginning of last
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
811 ;complete line.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
812 (cond
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
813 ((looking-at
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
814 "^cvs \\(update\\|server\\): \\[..:..:..\\] waiting for \\(.*\\)lock in \\(.*\\)$")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
815 (setq cvs-lock-file (buffer-substring (match-beginning 3)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
816 (match-end 3)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
817 (cookie-enter-last
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
818 cvs-cookie-handle
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
819 (cvs-create-fileinfo
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
820 'MESSAGE nil nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
821 (concat "\tWaiting for "
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
822 (buffer-substring (match-beginning 2)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
823 (match-end 2))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
824 "lock in " cvs-lock-file
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
825 ".\n\t (type M-x cvs-delete-lock to delete it)")))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
826 (store-match-data data)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
827 (set-buffer old-buffer))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
828
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
829 ;;----------
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
830 (defun cvs-delete-lock ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
831 "Delete the lock file that CVS is waiting for.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
832 Note that this can be dangerous. You should only do this
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
833 if you are convinced that the process that created the lock is dead."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
834
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
835 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
836 (cond
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
837 ((not (or (file-exists-p
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
838 (concat (file-name-as-directory cvs-lock-file) "#cvs.lock"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
839 (cvs-filter (function cvs-lock-file-p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
840 (directory-files cvs-lock-file))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
841 (error "No lock files found."))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
842 ((yes-or-no-p (concat "Really delete locks in " cvs-lock-file "? "))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
843 ;; Re-read the directory -- the locks might have disappeared.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
844 (let ((locks (cvs-filter (function cvs-lock-file-p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
845 (directory-files cvs-lock-file))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
846 (while locks
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
847 (delete-file (concat (file-name-as-directory cvs-lock-file)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
848 (car locks)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
849 (setq locks (cdr locks)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
850 (cvs-remove-directory
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
851 (concat (file-name-as-directory cvs-lock-file) "#cvs.lock"))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
852
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
853 ;;----------
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
854 (defun cvs-remove-directory (dir)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
855 "Remove a directory."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
856
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
857 (if (file-directory-p dir)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
858 (call-process cvs-rmdir-program nil nil nil dir)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
859 (error "Not a directory: %s" dir))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
860 (if (file-exists-p dir)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
861 (error "Could not remove directory %s" dir)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
862
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
863 ;;----------
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
864 (defun cvs-lock-file-p (file)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
865 "Return true if FILE looks like a CVS lock file."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
866
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
867 (or
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
868 (string-match "^#cvs.tfl.[0-9]+$" file)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
869 (string-match "^#cvs.rfl.[0-9]+$" file)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
870 (string-match "^#cvs.wfl.[0-9]+$" file)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
871
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
872 ;;----------
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
873 (defun cvs-quote-multiword-string (str)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
874 "Return STR surrounded in single quotes if it contains whitespace."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
875 (cond ((string-match "[ \t\n]" str)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
876 (concat "'" str "'"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
877 (t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
878 str)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
879
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
880 ;;----------
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
881 ;; this should be in subr.el or some similar place....
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
882 (defun parse-string (str &optional regexp)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
883 "Explode the string STR into a list of words ala strtok(3). Optional REGEXP
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
884 defines regexp matching word separator, which defaults to \"[ \\t\\n]+\"."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
885 (let (str-list ; new list
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
886 str-token ; "index" of next token
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
887 (str-start 0) ; "index" of current token
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
888 (str-sep (if regexp
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
889 regexp
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
890 "[ \t\n]+")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
891 (while (setq str-token (string-match str-sep str str-start))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
892 (setq str-list
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
893 (nconc str-list
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
894 (list (substring str str-start str-token))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
895 (setq str-start (match-end 0)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
896 ;; tag on the remainder as the final item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
897 (if (not (>= str-start (length str)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
898 (setq str-list
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
899 (nconc str-list
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
900 (list (substring str str-start)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
901 str-list))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
902
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
903 ;;----------
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
904 (defun cvs-make-list (str)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
905 "Return list of words made from the string STR."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
906 (cond ((string-match "[ \t\n]+" str)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
907 (let ((new-str (parse-string str "[ \t\n]+")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
908 ;; this is ugly, but assume if the first element is empty, there are
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
909 ;; no more elements.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
910 (cond ((string= (car new-str) "")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
911 nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
912 (t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
913 new-str))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
914 ((string= str "")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
915 nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
916 (t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
917 (list str))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
918
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
919 ;;----------
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
920 (defun cvs-skip-line (stdout stderr regexp &optional arg)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
921 "Like forward-line, but check that the skipped line matches REGEXP.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
922 Args: STDOUT STDERR REGEXP &optional ARG.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
923
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
924 If it doesn't match REGEXP a bug report is generated and displayed.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
925 STDOUT and STDERR is only used to do that.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
926
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
927 If optional ARG, a number, is given the ARGth parenthesized expression
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
928 in the REGEXP is returned as a string.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
929 Point should be in column 1 when this function is called."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
930
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
931 (cond
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
932 ((looking-at regexp)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
933 (forward-line 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
934 (if arg
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
935 (buffer-substring (match-beginning arg)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
936 (match-end arg))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
937 (t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
938 (cvs-parse-error stdout
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
939 stderr
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
940 (if (eq (current-buffer) stdout)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
941 'STDOUT
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
942 'STDERR)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
943 (point)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
944 regexp))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
945
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
946 ;;----------
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
947 (defun cvs-get-current-dir (root-dir dirname)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
948 "Return current working directory, suitable for cvs-parse-update.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
949 Args: ROOT-DIR DIRNAME.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
950
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
951 Concatenates ROOT-DIR and DIRNAME to form an absolute path."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
952
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
953 (if (string= "." dirname)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
954 (substring root-dir 0 -1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
955 (concat root-dir dirname)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
956
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
957 ;;----------
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
958 (defun cvs-compare-fileinfos (a b)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
959 "Compare fileinfo A with fileinfo B and return t if A is `less'."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
960
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
961 (cond
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
962 ;; Sort acording to directories.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
963 ((string< (cvs-fileinfo->dir a) (cvs-fileinfo->dir b)) t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
964 ((not (string= (cvs-fileinfo->dir a) (cvs-fileinfo->dir b))) nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
965 ;; The DIRCHANGE entry is always first within the directory.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
966 ((and (eq (cvs-fileinfo->type a) 'DIRCHANGE)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
967 (not (eq (cvs-fileinfo->type b) 'DIRCHANGE))) t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
968 ((and (eq (cvs-fileinfo->type b) 'DIRCHANGE)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
969 (not (eq (cvs-fileinfo->type a) 'DIRCHANGE))) nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
970 ;; All files are sorted by file name.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
971 ((string< (cvs-fileinfo->file-name a) (cvs-fileinfo->file-name b)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
972
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
973 ;;----------
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
974 (defun cvs-parse-error (stdout-buffer stderr-buffer err-buf pos &optional indicator)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
975 "Handle a parse error when parsing the output from cvs.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
976 Args: STDOUT-BUFFER STDERR-BUFFER ERR-BUF POS &optional INDICATOR.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
977
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
978 ERR-BUF should be 'STDOUT or 'STDERR."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
979
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
980 (setq pos (1- pos))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
981 (set-buffer cvs-buffer-name)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
982 (setq buffer-read-only nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
983 (erase-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
984 (insert "To: " pcl-cvs-bugs-address "\n")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
985 (insert "Subject: pcl-cvs release" pcl-cvs-version " parse error.\n")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
986 (insert (concat mail-header-separator "\n"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
987 (insert "This bug report is automatically generated by pcl-cvs\n")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
988 (insert "because it doesn't understand some output from CVS. Below\n")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
989 (insert "is detailed information about the error. Please send\n")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
990 (insert "this, together with any information you think might be\n")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
991 (insert "useful for me to fix the bug, to the address above. But\n")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
992 (insert "please check the \"known problems\" section of the\n")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
993 (insert "documentation first. Note that this buffer contains\n")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
994 (insert "information that you might consider confidential. You\n")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
995 (insert "are encouraged to read through it before sending it.\n")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
996 (insert "\n")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
997 (insert "Press C-c C-c to send this email.\n\n")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
998 (insert "Please state the version of these programs you are using:\n\n")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
999 (insert "RCS: \ndiff: \n\n")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1000
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1001 (let* ((stdout (save-excursion (set-buffer stdout-buffer) (buffer-string)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1002 (stderr (save-excursion (set-buffer stderr-buffer) (buffer-string)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1003 (errstr (if (eq err-buf 'STDOUT) stdout stderr))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1004 (errline-end (string-match "\n" errstr pos))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1005 (errline (substring errstr pos errline-end)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1006 (insert (format "Offending line (%d chars): >" (- errline-end pos)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1007 (insert errline)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1008 (insert "<\n")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1009 (insert "Sent to " (symbol-name err-buf) " at pos " (format "%d\n" pos))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1010 (if indicator
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1011 (insert "Optional args: \"" indicator "\".\n"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1012 (insert "\nEmacs-version: " (emacs-version) "\n")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1013 (insert "Pcl-cvs Version: "
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1014 "@(#)OrigId: pcl-cvs.el,v 1.93 1993/05/31 22:44:00 ceder Exp\n")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1015 (insert "CVS Version: "
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 0
diff changeset
1016 "@(#)lisp/pcl-cvs:$Name: r19-15b6 $:$Id: pcl-cvs.el,v 1.2 1996/12/29 00:15:02 steve Exp $\n\n")
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1017 (insert (format "--- Contents of stdout buffer (%d chars) ---\n"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1018 (length stdout)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1019 (insert stdout)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1020 (insert "--- End of stdout buffer ---\n")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1021 (insert (format "--- Contents of stderr buffer (%d chars) ---\n"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1022 (length stderr)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1023 (insert stderr)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1024 (insert "--- End of stderr buffer ---\n")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1025 (insert "\nEnd of bug report.\n")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1026 (require 'sendmail)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1027 (mail-mode)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1028 (error "CVS parse error - please report this bug.")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1029
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1030 ;;----------
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1031 (defun cvs-parse-update (stdout-buffer stderr-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1032 "Parse the output from `cvs update'.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1033
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1034 Args: STDOUT-BUFFER STDERR-BUFFER.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1035
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1036 This functions parses the from `cvs update' (which should be
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1037 separated in its stdout- and stderr-components) and prints a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1038 pretty representation of it in the *cvs* buffer.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1039
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1040 Signals an error if unexpected output was detected in the buffer."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1041
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1042 (let* ((head (cons 'dummy nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1043 (tail (cvs-parse-stderr stdout-buffer stderr-buffer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1044 head default-directory))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1045 (root-dir default-directory))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1046 (cvs-parse-stdout stdout-buffer stderr-buffer tail root-dir)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1047 (setq head (sort (cdr head) (function cvs-compare-fileinfos)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1048 (collection-clear cvs-cookie-handle)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1049 (collection-append-cookies cvs-cookie-handle head)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1050 (cvs-remove-stdout-shadows)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1051 (if cvs-auto-remove-handled-directories
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1052 (cvs-remove-empty-directories))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1053 (set-buffer cvs-buffer-name)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1054 (cvs-mode)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1055 ;; XEmacs - tedium should let you know when it's ended...
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1056 (if (pos-visible-in-window-p (point-min))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1057 nil ; assume that the user will see it...
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1058 (ding t 'ready)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1059 (message "CVS update is ready."))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1060 (goto-char (point-min))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1061 (tin-goto-previous cvs-cookie-handle (point-min) 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1062 (setq default-directory root-dir)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1063
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1064 ;;----------
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1065 (defun cvs-remove-stdout-shadows ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1066 "Remove entries in the *cvs* buffer that comes from both stdout and stderr.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1067 If there is two entries for a single file the second one should be
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1068 deleted. (Remember that sort uses a stable sort algorithm, so one can
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1069 be sure that the stderr entry is always first)."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1070
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1071 (collection-filter-tins cvs-cookie-handle
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1072 (function
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1073 (lambda (tin)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1074 (not (cvs-shadow-entry-p tin))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1075
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1076 ;;----------
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1077 (defun cvs-shadow-entry-p (tin)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1078 "Return non-nil if TIN is a shadow entry.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1079 Args: TIN.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1080
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1081 A TIN is a shadow entry if the previous tin contains the same file."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1082
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1083 (let* ((previous-tin (tin-previous cvs-cookie-handle tin))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1084 (curr (tin-cookie cvs-cookie-handle tin))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1085 (prev (and previous-tin
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1086 (tin-cookie cvs-cookie-handle previous-tin))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1087 (and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1088 prev curr
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1089 (string= (cvs-fileinfo->file-name prev)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1090 (cvs-fileinfo->file-name curr))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1091 (string= (cvs-fileinfo->dir prev)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1092 (cvs-fileinfo->dir curr))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1093 (or
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1094 (and (eq (cvs-fileinfo->type prev) 'CONFLICT)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1095 (eq (cvs-fileinfo->type curr) 'CONFLICT))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1096 (and (eq (cvs-fileinfo->type prev) 'MERGED)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1097 (eq (cvs-fileinfo->type curr) 'MODIFIED))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1098 (and (eq (cvs-fileinfo->type prev) 'REM-EXIST)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1099 (eq (cvs-fileinfo->type curr) 'REMOVED))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1100
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1101 ;;----------
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1102 (defun cvs-find-backup-file (filename &optional dirname)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1103 "Look for a backup file for FILENAME, optionally in directory DIRNAME, and if
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1104 there is one, return the name of the first file found as a string."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1105
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1106 (if (eq dirname nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1107 (setq dirname default-directory))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1108 (car (directory-files dirname nil (concat "^\\" cvs-bakprefix filename
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1109 "\\."))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1110
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1111 ;;----------
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1112 (defun cvs-find-backup-revision (filename)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1113 "Take FILENAME as the name of a cvs backup file and return the revision of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1114 that file as a string."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1115
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1116 (substring filename
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1117 (+ 1 (string-match "\\.\\([0-9.]+\\)$" filename))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1118
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1119 ;;----------
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1120 (defun cvs-parse-stderr (stdout-buffer stderr-buffer head dir)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1121 "Parse the output from CVS that is written to stderr.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1122 Args: STDOUT-BUFFER STDERR-BUFFER HEAD DIR
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1123
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1124 STDOUT-BUFFER holds the output that cvs sent to stdout. It is only
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1125 used to create a bug report in case there is a parse error.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1126 STDERR-BUFFER is the buffer that holds the output to parse.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1127 HEAD is a cons-cell, the head of the list that is built.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1128 DIR is the directory the `cvs update' was run in.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1129
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1130 This function returns the last cons-cell in the list that is built."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1131
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1132 (save-window-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1133 (set-buffer stderr-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1134 (goto-char (point-min))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1135 (let ((current-dir dir)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1136 (root-dir dir))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1137
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1138 (while (< (point) (point-max))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1139 (cond
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1140
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1141 ;; CVS is descending a subdirectory.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1142
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1143 ((looking-at
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1144 "^cvs \\(server\\|update\\): Updating \\(.*\\)$")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1145 (setq current-dir
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1146 (cvs-get-current-dir
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1147 root-dir
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1148 (buffer-substring (match-beginning 2) (match-end 2))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1149 (setcdr head (list (cvs-create-fileinfo
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1150 'DIRCHANGE
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1151 current-dir
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1152 "." ; the old version had nil here???
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1153 (buffer-substring (match-beginning 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1154 (match-end 0)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1155 (setq head (cdr head))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1156 (forward-line 1))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1157
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1158 ;; File removed, since it is removed (by third party) in repository.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1159
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1160 ((or (looking-at
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1161 "^cvs \\(update\\|server\\): warning: \\(.*\\) is not (any longer) pertinent")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1162 (looking-at
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1163 "^cvs \\(update\\|server\\): \\(.*\\) is no longer in the repository"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1164
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1165 (setcdr head (list (cvs-create-fileinfo
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1166 'CVS-REMOVED
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1167 current-dir
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1168 (file-name-nondirectory
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1169 (buffer-substring (match-beginning 2)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1170 (match-end 2)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1171 (buffer-substring (match-beginning 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1172 (match-end 0)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1173 (setq head (cdr head))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1174 (forward-line 1))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1175
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1176 ;; File removed by you, but recreated by cvs. Ignored. Will say
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1177 ;; "Updated" on the next line.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1178
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1179 ((looking-at
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1180 "^cvs \\(update\\|server\\): warning: .* was lost$")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1181 (forward-line 1))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1182
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1183 ;; File unknown for some reason.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1184 ;; FIXME: is it really a good idea to add this as unknown here?
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1185
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1186 ((looking-at
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1187 "cvs \\(update\\|server\\): nothing known about \\(.*\\)$")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1188 (let ((filename (buffer-substring (match-beginning 2)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1189 (match-end 2))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1190 (if (file-directory-p filename)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1191 (setcdr head (list (cvs-create-fileinfo
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1192 'UNKNOWN-DIR
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1193 current-dir
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1194 "."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1195 (buffer-substring (match-beginning 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1196 (match-end 0)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1197 (setcdr head (list (cvs-create-fileinfo
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1198 'UNKNOWN
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1199 current-dir
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1200 (file-name-nondirectory filename)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1201 (buffer-substring (match-beginning 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1202 (match-end 0)))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1203 (setq head (cdr head))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1204 (forward-line 1))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1205
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1206 ;; A file that has been created by you, but added to the cvs
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1207 ;; repository by another.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1208
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1209 ((looking-at
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1210 "^cvs \\(update\\|server\\): move away \\(.*\\); it is in the way$")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1211 (setcdr head (list (cvs-create-fileinfo
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1212 'MOVE-AWAY
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1213 current-dir
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1214 (file-name-nondirectory
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1215 (buffer-substring (match-beginning 2)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1216 (match-end 2)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1217 (buffer-substring (match-beginning 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1218 (match-end 0)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1219 (setq head (cdr head))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1220 (forward-line 1))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1221
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1222 ;; Cvs waits for a lock. Ignore.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1223
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1224 ((looking-at
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1225 "^cvs \\(update\\|server\\): \\[..:..:..\\] waiting for .*lock in ")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1226 (forward-line 1))
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 0
diff changeset
1227 ((looking-at
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 0
diff changeset
1228 "^cvs \\(update\\|server\\): \\[..:..:..\\] obtained lock in ")
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 0
diff changeset
1229 (forward-line 1))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1230
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1231 ;; File removed in repository, but edited by you.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1232
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1233 ((looking-at
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1234 "^cvs \\(update\\|server\\): conflict: \\(.*\\) is modified but no longer in the repository$")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1235 (setcdr head (list
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1236 (cvs-create-fileinfo
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1237 'REM-CONFLICT
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1238 current-dir
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1239 (file-name-nondirectory
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1240 (buffer-substring (match-beginning 2)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1241 (match-end 2)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1242 (buffer-substring (match-beginning 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1243 (match-end 0)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1244 (setq head (cdr head))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1245 (forward-line 1))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1246
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1247 ;; File removed in repository, but edited by someone else.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1248
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1249 ((looking-at
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1250 "^cvs \\(update\\|server\\): conflict: removed \\(.*\\) was modified by second party")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1251 (setcdr head
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1252 (list
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1253 (cvs-create-fileinfo
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1254 'MOD-CONFLICT
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1255 current-dir
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1256 (buffer-substring (match-beginning 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1257 (match-end 1))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1258 (buffer-substring (match-beginning 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1259 (match-end 0)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1260 (setq head (cdr head))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1261 (forward-line 1))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1262
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1263 ;; File removed in repository, but not in local directory.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1264
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1265 ((looking-at
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1266 "^cvs \\(update\\|server\\): \\(.*\\) should be removed and is still there")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1267 (setcdr head
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1268 (list
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1269 (cvs-create-fileinfo
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1270 'REM-EXIST
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1271 current-dir
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1272 (buffer-substring (match-beginning 2)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1273 (match-end 2))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1274 (buffer-substring (match-beginning 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1275 (match-end 0)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1276 (setq head (cdr head))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1277 (forward-line 1))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1278
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1279 ;; Error searching for repository
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1280
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1281 ((looking-at
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1282 "^cvs \\(update\\|server\\): in directory ")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1283 (let ((start (point)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1284 (forward-line 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1285 (cvs-skip-line stdout-buffer stderr-buffer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1286 (regexp-quote "cvs [update aborted]: there is no repository "))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1287 (setcdr head (list (cvs-create-fileinfo
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1288 'REPOS-MISSING
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1289 current-dir
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1290 nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1291 (buffer-substring start (point)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1292 (setq head (cdr head))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1293
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1294 ;; Silly warning from attempted conflict resolution. Ignored.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1295 ;; FIXME: Should it be?
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1296 ;; eg.: "cvs update: cannot find revision APC-web-update in file .cvsignore"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1297 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1298 ((looking-at
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1299 "^cvs \\(update\\|server\\): cannot find revision \\(.*\\) in file \\(.*\\)$")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1300 (forward-line 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1301 (message "%s" (buffer-substring (match-beginning 0) (match-end 0))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1302
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1303 ;; CVS has decided to merge someone elses changes into this document.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1304 ;; About to start an rcsmerge operation...
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1305 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1306 ((looking-at
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1307 "^RCS file: ")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1308
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1309 ;; skip the "RCS file:" line...
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1310 (forward-line 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1311
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1312 (let ((complex-start (point))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1313 base-revision ; the first revision retrieved to merge from
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1314 head-revision ; the second revision retrieved to merge from
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1315 filename ; the name of the file being merged
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1316 backup-file ; the name of the backup of the working file
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1317 backup-revision) ; the revision of the original working file
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1318
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1319 (setq base-revision
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1320 (cvs-skip-line stdout-buffer stderr-buffer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1321 "^retrieving revision \\(.*\\)$"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1322 1))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1323 (setq head-revision
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1324 (cvs-skip-line stdout-buffer stderr-buffer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1325 "^retrieving revision \\(.*\\)$"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1326 1))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1327 (setq filename
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1328 (cvs-skip-line stdout-buffer stderr-buffer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1329 "^Merging differences between [0-9.]+ and [0-9.]+ into \\(.*\\)$"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1330 1))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1331 (setq backup-file
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1332 (cvs-find-backup-file filename current-dir))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1333 (setq backup-revision
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1334 (cvs-find-backup-revision backup-file))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1335
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1336 ;; Was there a conflict during the merge?
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1337
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1338 (cond
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1339
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1340 ;;;; From CVS-1.3 & RCS-5.6.0.1 with GNU-Diffutils-2.5:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1341 ;;;; "cvs update -j OLD-REV -j NEW-REV ."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1342 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1343 ;; RCS file: /big/web-CVS/apc/cmd/Main/logout.sh,v
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1344 ;; retrieving revision 1.1.1.1
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1345 ;; retrieving revision 1.1.1.2
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1346 ;; Merging differences between 1.1.1.1 and 1.1.1.2 into logout.sh
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1347 ;; rcsmerge warning: overlaps during merge
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1348
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1349 ((looking-at
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1350 ;; Allow both RCS 5.5 and 5.6. (5.6 prints "rcs" and " warning").
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 0
diff changeset
1351 "^\\(rcs\\)?merge[:]*\\( warning\\)?: \\(overlaps\\|conflicts\\) during merge$")
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1352
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1353 ;; Yes, this is a conflict.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1354 (cvs-skip-line stdout-buffer stderr-buffer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1355 "^\\(rcs\\)?merge[:]*\\( warning\\)?: \\(overlaps\\|conflicts\\) during merge$")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1356
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1357 ;; this line doesn't seem to appear in all cases -- perhaps only
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1358 ;; in "-j A -j B" usage, in which case this indicates ????
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1359 (cvs-skip-line stdout-buffer stderr-buffer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1360 "^cvs \\(update\\|server\\): conflicts found in ")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1361
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1362 (let ((fileinfo
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1363 (cvs-create-fileinfo
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1364 'CONFLICT current-dir
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1365 filename
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1366 (buffer-substring complex-start (point)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1367
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1368 ;; squirrel away info about the files that were retrieved for merging
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1369 (cvs-set-fileinfo->base-revision fileinfo base-revision)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1370 (cvs-set-fileinfo->head-revision fileinfo head-revision)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1371 (cvs-set-fileinfo->backup-revision fileinfo backup-revision)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1372 (cvs-set-fileinfo->backup-file fileinfo backup-file)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1373
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1374 (setcdr head (list fileinfo))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1375 (setq head (cdr head))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1376
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1377 ;; Was it a conflict, and was RCS compiled without DIFF3_BIN, in
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1378 ;; which case this is a failed conflict resolution?
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1379
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1380 ((looking-at
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1381 ;; Allow both RCS 5.5 and 5.6. (5.6 prints "rcs" and " warning").
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1382 "^\\(rcs\\)?merge\\( warning\\)?: overlaps or other problems during merge$")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1383
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1384 (cvs-skip-line stdout-buffer stderr-buffer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1385 "^\\(rcs\\)?merge\\( warning\\)?: overlaps or other problems during merge$")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1386 (cvs-skip-line stdout-buffer stderr-buffer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1387 "^cvs update: could not merge ")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1388 (cvs-skip-line stdout-buffer stderr-buffer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1389 "^cvs update: restoring .* from backup file ")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1390 (let ((fileinfo
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1391 (cvs-create-fileinfo
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1392 'CONFLICT current-dir
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1393 filename
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1394 (buffer-substring complex-start (point)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1395 (setcdr head (list fileinfo))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1396 (setq head (cdr head))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1397
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1398 ;; Not a conflict; it must be a succesful merge.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1399
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1400 (t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1401 (let ((fileinfo
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1402 (cvs-create-fileinfo
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1403 'MERGED current-dir
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1404 filename
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1405 (buffer-substring complex-start (point)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1406 (cvs-set-fileinfo->base-revision fileinfo base-revision)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1407 (cvs-set-fileinfo->head-revision fileinfo head-revision)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1408 (cvs-set-fileinfo->backup-revision fileinfo backup-revision)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1409 (cvs-set-fileinfo->backup-file fileinfo backup-file)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1410 (setcdr head (list fileinfo))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1411 (setq head (cdr head)))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1412
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1413 ;; Error messages from CVS (incomplete)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1414
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1415 ((looking-at
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1416 "^cvs \\(update\\|server\\): \\(invalid option .*\\)$")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1417 (error "Interface problem with CVS: %s"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1418 (buffer-substring (match-beginning 2) (match-end 2))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1419
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1420 ;; network errors
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1421
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1422 ;; Kerberos connection attempted but failed. This is not
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1423 ;; really an error, as CVS will automatically fall back to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1424 ;; rsh. Plus it tries kerberos, if available, even when rsh
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1425 ;; is what you really wanted.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1426
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1427 ((looking-at
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1428 "^cvs update: kerberos connect:.*$")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1429 (forward-line 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1430 (message "Remote CVS: %s"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1431 (buffer-substring (match-beginning 0) (match-end 0))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1432
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1433 ;; And when kerberos *does* fail, cvs prints out some stuff
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1434 ;; as it tries rsh. Ignore that stuff too.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1435
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1436 ((looking-at
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1437 "^cvs update: trying to start server using rsh$")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1438 (forward-line 1))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1439
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1440 ((looking-at
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1441 "^\\([^:]*\\) Connection timed out")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1442 (error "Remote CVS: %s"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1443 (buffer-substring (match-beginning 0) (match-end 0))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1444
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1445 ((looking-at
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1446 "^Permission denied.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1447 (error "Remote CVS: %s"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1448 (buffer-substring (match-beginning 0) (match-end 0))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1449
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1450 ((looking-at
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1451 "^cvs \\[update aborted\\]: premature end of file from server")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1452 (error "Remote CVS: %s"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1453 (buffer-substring (match-beginning 0) (match-end 0))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1454
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1455 ;; Empty line. Probably inserted by mistake by user (or developer :-)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1456 ;; Ignore.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1457
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1458 ((looking-at
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1459 "^$")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1460 (forward-line 1))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1461
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1462 ;; top-level parser (cond) default clause
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1463
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1464 (t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1465 (cvs-skip-line stdout-buffer stderr-buffer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1466 "^UN-MATCHABLE-OUTPUT"))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1467
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1468 ;; cause this function to return the head of the parser output list
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1469 head)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1470
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1471 ;;----------
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1472 (defun cvs-parse-stdout (stdout-buffer stderr-buffer head root-dir)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1473 "Parse the output from CVS that is written to stderr.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1474 Args: STDOUT-BUFFER STDERR-BUFFER HEAD ROOT-DIR
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1475
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1476 STDOUT-BUFFER is the buffer that holds the output to parse.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1477 STDERR-BUFFER holds the output that cvs sent to stderr. It is only
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1478 used to create a bug report in case there is a parse error.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1479
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1480 HEAD is a cons-cell, the head of the list that is built.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1481 ROOT-DIR is the directory the `cvs update' was run in.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1482
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1483 This function doesn't return anything particular."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1484
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1485 (save-window-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1486 (set-buffer stdout-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1487 (goto-char (point-min))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1488 (while (< (point) (point-max))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1489 (cond
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1490
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1491 ;; M: The file is modified by the user, and untouched in the repository.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1492 ;; A: The file is "cvs add"ed, but not "cvs ci"ed.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1493 ;; R: The file is "cvs remove"ed, but not "cvs ci"ed.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1494 ;; C: Conflict (only useful if a join was done and stderr has info...)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1495 ;; U: The file is copied from the repository.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1496 ;; ?: Unknown file or directory.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1497
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1498 ((looking-at
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1499 "^\\([MARCUP?]\\) \\(.*\\)$")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1500 (let*
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1501 ((c (char-after (match-beginning 1)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1502 (full-path (concat (file-name-as-directory root-dir)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1503 (buffer-substring (match-beginning 2)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1504 (match-end 2))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1505 (isdir (file-directory-p full-path))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1506 (fileinfo (cvs-create-fileinfo
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1507 (cond ((eq c ?M) 'MODIFIED)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1508 ((eq c ?A) 'ADDED)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1509 ((eq c ?R) 'REMOVED)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1510 ((eq c ?C) 'CONFLICT)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1511 ((eq c ?U) 'UPDATED)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1512 ((eq c ?P) 'PATCHED)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1513 ((eq c ??) (if isdir
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1514 'UNKNOWN-DIR
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1515 'UNKNOWN)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1516 (substring (file-name-directory full-path) 0 -1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1517 (file-name-nondirectory full-path)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1518 (buffer-substring (match-beginning 0) (match-end 0)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1519 ;; Updated and Patched files require no further action.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1520 (if (memq c '(?U ?P))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1521 (cvs-set-fileinfo->handled fileinfo t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1522
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1523 ;; Link this last on the list.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1524 (setcdr head (list fileinfo))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1525 (setq head (cdr head))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1526 (forward-line 1)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1527
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1528 ;; Executing a program because of the -u option in modules.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1529 ((looking-at
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1530 "^cvs \\(update\\|server\\): Executing")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1531 ;; Skip by any output the program may generate to stdout.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1532 ;; Note that pcl-cvs will get seriously confused if the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1533 ;; program prints anything to stderr.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1534 (re-search-forward cvs-update-prog-output-skip-regexp)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1535 (forward-line 1))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1536
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1537 (t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1538 (cvs-parse-error stdout-buffer stderr-buffer 'STDOUT (point)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1539 "cvs-parse-stdout"))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1540
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1541 ;;----------
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1542 (defun cvs-pp (fileinfo)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1543 "Pretty print FILEINFO. Insert a printed representation in current buffer.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1544 For use by the cookie package."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1545
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1546 (let ((a (cvs-fileinfo->type fileinfo))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1547 (s (if (cvs-fileinfo->marked fileinfo)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1548 "*" " "))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1549 (f (cvs-fileinfo->file-name fileinfo))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1550 (ci (if (cvs-fileinfo->handled fileinfo)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1551 " " "ci")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1552 (insert
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1553 (cond
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1554 ((eq a 'UPDATED)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1555 (format "%s Updated %s" s f))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1556 ((eq a 'PATCHED)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1557 (format "%s Patched %s" s f))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1558 ((eq a 'MODIFIED)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1559 (format "%s Modified %s %s" s ci f))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1560 ((eq a 'MERGED)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1561 (format "%s Merged %s %s" s ci f))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1562 ((eq a 'CONFLICT)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1563 (format "%s Conflict %s" s f))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1564 ((eq a 'ADDED)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1565 (format "%s Added %s %s" s ci f))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1566 ((eq a 'REMOVED)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1567 (format "%s Removed %s %s" s ci f))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1568 ((eq a 'UNKNOWN)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1569 (format "%s Unknown %s" s f))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1570 ((eq a 'UNKNOWN-DIR)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1571 (format "%s Unknown dir %s" s f))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1572 ((eq a 'CVS-REMOVED)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1573 (format "%s Removed from repository: %s" s f))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1574 ((eq a 'REM-CONFLICT)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1575 (format "%s Conflict: Removed from repository, changed by you: %s" s f))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1576 ((eq a 'MOD-CONFLICT)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1577 (format "%s Conflict: Removed by you, changed in repository: %s" s f))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1578 ((eq a 'REM-EXIST)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1579 (format "%s Conflict: Removed by you, but still exists: %s" s f))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1580 ((eq a 'DIRCHANGE)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1581 (format "\nIn directory %s:" (cvs-fileinfo->dir fileinfo)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1582 ((eq a 'MOVE-AWAY)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1583 (format "%s Move away %s - it is in the way" s f))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1584 ((eq a 'REPOS-MISSING)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1585 (format " This repository directory is missing! Remove this directory manually."))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1586 ((eq a 'MESSAGE)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1587 (cvs-fileinfo->full-log fileinfo))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1588 (t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1589 (format "%s Internal error! %s" s f))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1590
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1591
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1592 ;;; You can define your own keymap in .emacs. pcl-cvs.el won't overwrite it.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1593
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1594 (if cvs-mode-map
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1595 nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1596 (setq cvs-mode-map (make-keymap))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1597 (suppress-keymap cvs-mode-map)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1598 (define-prefix-command 'cvs-mode-map-control-c-prefix)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1599 (define-key cvs-mode-map "\C-?" 'cvs-mode-unmark-up)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1600 (define-key cvs-mode-map "\C-k" 'cvs-mode-acknowledge)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1601 (define-key cvs-mode-map "\C-n" 'cvs-mode-next-line)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1602 (define-key cvs-mode-map "\C-p" 'cvs-mode-previous-line)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1603 ;; ^C- keys are used to set various flags to control CVS features
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1604 (define-key cvs-mode-map "\C-c" 'cvs-mode-map-control-c-prefix)
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 0
diff changeset
1605 (define-key cvs-mode-map "\C-c\C-c" 'cvs-change-cvsroot)
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 0
diff changeset
1606 (define-key cvs-mode-map "\C-c\C-d" 'cvs-set-diff-flags)
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 0
diff changeset
1607 (define-key cvs-mode-map "\C-c\C-l" 'cvs-set-log-flags)
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 0
diff changeset
1608 (define-key cvs-mode-map "\C-c\C-s" 'cvs-set-status-flags)
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 0
diff changeset
1609 (define-key cvs-mode-map "\C-c\C-u" 'cvs-set-update-optional-flags)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1610 ;; M- keys are usually those that operate on modules
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1611 (define-key cvs-mode-map "\M-\C-?" 'cvs-mode-unmark-all-files)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1612 (define-key cvs-mode-map "\M-C" 'cvs-mode-rcs2log) ; i.e. "Create a ChangeLog"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1613 (define-key cvs-mode-map "\M-a" 'cvs-mode-admin)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1614 (define-key cvs-mode-map "\M-c" 'cvs-mode-checkout)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1615 (define-key cvs-mode-map "\M-o" 'cvs-mode-checkout-other-window)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1616 (define-key cvs-mode-map "\M-p" 'cvs-mode-rdiff) ; i.e. "create a Patch"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1617 (define-key cvs-mode-map "\M-r" 'cvs-mode-release)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1618 (define-key cvs-mode-map "\M-t" 'cvs-mode-rtag)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1619 ;; keys that operate on files
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1620 (define-key cvs-mode-map " " 'cvs-mode-next-line)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1621 (define-key cvs-mode-map "?" 'describe-mode)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1622 (define-key cvs-mode-map "A" 'cvs-mode-add-change-log-entry-other-window)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1623 (define-key cvs-mode-map "B" 'cvs-mode-byte-compile-files)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1624 (define-key cvs-mode-map "C" 'cvs-mode-changelog-commit)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1625 (define-key cvs-mode-map "E" 'cvs-mode-emerge)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1626 (define-key cvs-mode-map "G" 'cvs-update)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1627 (define-key cvs-mode-map "M" 'cvs-mode-mark-all-files)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1628 (define-key cvs-mode-map "Q" 'cvs-examine)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1629 (define-key cvs-mode-map "R" 'cvs-mode-revert-updated-buffers)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1630 (define-key cvs-mode-map "U" 'cvs-mode-undo-local-changes)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1631 (define-key cvs-mode-map "a" 'cvs-mode-add)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1632 (define-key cvs-mode-map "b" 'cvs-mode-diff-backup)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1633 (define-key cvs-mode-map "c" 'cvs-mode-commit)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1634 (define-key cvs-mode-map "d" 'cvs-mode-diff-cvs)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1635 (define-key cvs-mode-map "e" 'cvs-mode-ediff)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1636 (define-key cvs-mode-map "f" 'cvs-mode-find-file)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1637 (define-key cvs-mode-map "g" 'cvs-mode-update-no-prompt)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1638 (define-key cvs-mode-map "i" 'cvs-mode-ignore)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1639 (define-key cvs-mode-map "l" 'cvs-mode-log)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1640 (define-key cvs-mode-map "m" 'cvs-mode-mark)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1641 (define-key cvs-mode-map "n" 'cvs-mode-next-line)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1642 (define-key cvs-mode-map "o" 'cvs-mode-find-file-other-window)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1643 (define-key cvs-mode-map "p" 'cvs-mode-previous-line)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1644 (define-key cvs-mode-map "q" 'bury-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1645 (define-key cvs-mode-map "r" 'cvs-mode-remove-file)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1646 (define-key cvs-mode-map "s" 'cvs-mode-status)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1647 (define-key cvs-mode-map "t" 'cvs-mode-tag)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1648 (define-key cvs-mode-map "u" 'cvs-mode-unmark)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1649 (define-key cvs-mode-map "v" 'cvs-mode-diff-vendor)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1650 (define-key cvs-mode-map "x" 'cvs-mode-remove-handled))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1651
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1652 ;;----------
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1653 (defun cvs-get-marked (&optional ignore-marks ignore-contents)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1654 "Return a list of all selected tins.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1655 Args: &optional IGNORE-MARKS IGNORE-CONTENTS.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1656
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1657 If there are any marked tins, and IGNORE-MARKS is nil, return them. Otherwise,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1658 if the cursor selects a directory, return all files in it, unless there are
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1659 none, in which case just return the directory; or unless IGNORE-CONTENTS is not
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1660 nil, in which case also just return the directory. Otherwise return (a list
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1661 containing) the file the cursor points to, or an empty list if it doesn't point
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1662 to a file at all."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1663
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1664 (cond
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1665 ;; Any marked cookies?
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1666 ((and (not ignore-marks)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1667 (collection-collect-tin cvs-cookie-handle 'cvs-fileinfo->marked)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1668 ;; Nope.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1669 ((and (not ignore-contents)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1670 (let ((sel (tin-locate cvs-cookie-handle (point))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1671 (cond
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1672 ;; If a directory is selected, all it members are returned.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1673 ((and sel (eq (cvs-fileinfo->type (tin-cookie cvs-cookie-handle
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1674 sel))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1675 'DIRCHANGE))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1676 (let ((retsel
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1677 (collection-collect-tin cvs-cookie-handle
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1678 'cvs-dir-member-p
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1679 (cvs-fileinfo->dir (tin-cookie
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1680 cvs-cookie-handle sel)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1681 (if retsel
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1682 retsel
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1683 (list sel))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1684 (t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1685 (list sel))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1686 (t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1687 (list (tin-locate cvs-cookie-handle (point))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1688
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1689 ;;----------
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1690 (defun cvs-dir-member-p (fileinfo dir)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1691 "Return true if FILEINFO represents a file in directory DIR."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1692
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1693 (and (not (eq (cvs-fileinfo->type fileinfo) 'DIRCHANGE))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1694 (string= (cvs-fileinfo->dir fileinfo) dir)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1695
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1696 ;;----------
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1697 (defun cvs-dir-empty-p (tin)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1698 "Return non-nil if TIN is a directory that is empty.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1699 Args: CVS-BUF TIN."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1700
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1701 (and (eq (cvs-fileinfo->type (tin-cookie cvs-cookie-handle tin)) 'DIRCHANGE)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1702 (or (not (tin-next cvs-cookie-handle tin))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1703 (eq (cvs-fileinfo->type
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1704 (tin-cookie cvs-cookie-handle
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1705 (tin-next cvs-cookie-handle tin)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1706 'DIRCHANGE))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1707
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1708 ;;----------
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1709 (defun cvs-mode-revert-updated-buffers ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1710 "Revert any buffers that are UPDATED, PATCHED, MERGED or CONFLICT."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1711
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1712 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1713 (cookie-map (function cvs-revert-fileinfo) cvs-cookie-handle))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1714
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1715 ;;----------
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1716 (defun cvs-revert-fileinfo (fileinfo)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1717 "Revert the buffer that holds the file in FILEINFO if it has changed,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1718 and if the type is UPDATED, PATCHED, MERGED or CONFLICT."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1719
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1720 (let* ((type (cvs-fileinfo->type fileinfo))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1721 (file (cvs-fileinfo->full-path fileinfo))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1722 (buffer (get-file-buffer file)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1723 ;; For a revert to happen...
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1724 (cond
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1725 ((and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1726 ;; ...the type must be one that justifies a revert...
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1727 (or (eq type 'UPDATED)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1728 (eq type 'PATCHED)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1729 (eq type 'MERGED)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1730 (eq type 'CONFLICT))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1731 ;; ...and the user must be editing the file...
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1732 buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1733 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1734 (set-buffer buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1735 (cond
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1736 ((buffer-modified-p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1737 (error "%s: edited since last cvs-update."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1738 (buffer-file-name)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1739 ;; Go ahead and revert the file.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1740 (t (revert-buffer 'dont-use-auto-save-file 'dont-ask))))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1741
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1742 ;;----------
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1743 (defun cvs-mode-remove-handled ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1744 "Remove all lines that are handled.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1745 Empty directories are removed."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1746
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1747 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1748 ;; Pass one: remove files that are handled.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1749 (collection-filter-cookies cvs-cookie-handle
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1750 (function
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1751 (lambda (fileinfo)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1752 (not (cvs-fileinfo->handled fileinfo)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1753 ;; Pass two: remove empty directories.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1754 (if cvs-auto-remove-handled-directories
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1755 (cvs-remove-empty-directories)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1756
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1757 ;;----------
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1758 (defun cvs-remove-empty-directories ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1759 "Remove empty directories in the *cvs* buffer."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1760
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1761 (collection-filter-tins cvs-cookie-handle
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1762 (function
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1763 (lambda (tin)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1764 (not (cvs-dir-empty-p tin))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1765
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1766 ;;----------
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1767 (defun cvs-mode-mark (pos)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1768 "Mark a fileinfo.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1769 Args: POS.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1770
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1771 If the fileinfo is a directory, all the contents of that directory are marked
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1772 instead. A directory can never be marked. POS is a buffer position."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1773
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1774 (interactive "d")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1775 (let* ((tin (tin-locate cvs-cookie-handle pos))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1776 (sel (tin-cookie cvs-cookie-handle tin)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1777 (cond
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1778 ;; Does POS point to a directory? If so, mark all files in that directory.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1779 ((eq (cvs-fileinfo->type sel) 'DIRCHANGE)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1780 (cookie-map
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1781 (function (lambda (f dir)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1782 (cond
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1783 ((cvs-dir-member-p f dir)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1784 (cvs-set-fileinfo->marked f t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1785 t)))) ; Tell cookie to redisplay this cookie.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1786 cvs-cookie-handle
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1787 (cvs-fileinfo->dir sel)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1788 (t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1789 (cvs-set-fileinfo->marked sel t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1790 (tin-invalidate cvs-cookie-handle tin)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1791 (tin-goto-next cvs-cookie-handle pos 1)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1792
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1793 ;;----------
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1794 (defun cvs-committable (tin)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1795 "Check if the TIN is committable.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1796 It is committable if it
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1797 a) is not handled and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1798 b) is either MODIFIED, ADDED, REMOVED, MERGED or CONFLICT."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1799
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1800 (let* ((fileinfo (tin-cookie cvs-cookie-handle tin))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1801 (type (cvs-fileinfo->type fileinfo)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1802 (and (not (cvs-fileinfo->handled fileinfo))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1803 (or (eq type 'MODIFIED)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1804 (eq type 'ADDED)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1805 (eq type 'REMOVED)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1806 (eq type 'MERGED)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1807 (eq type 'CONFLICT)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1808
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1809 ;;----------
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1810 (defun cvs-mode-commit ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1811 "Check in all marked files, or the current file.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1812 The user will be asked for a log message in a buffer.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1813 If cvs-erase-input-buffer is non-nil that buffer will be erased.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1814 Otherwise mark and point will be set around the entire contents of the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1815 buffer so that it is easy to kill the contents of the buffer with \\[kill-region]."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1816
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1817 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1818 (let* ((cvs-buf (current-buffer))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1819 (marked (cvs-filter (function cvs-committable)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1820 (cvs-get-marked))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1821 (if (null marked)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1822 (error "Nothing to commit!")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1823 (pop-to-buffer (get-buffer-create cvs-commit-prompt-buffer))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1824 (goto-char (point-min))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1825
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1826 (if cvs-erase-input-buffer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1827 (erase-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1828 (push-mark (point-max)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1829 (cvs-edit-mode)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1830 (make-local-variable 'cvs-commit-list)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1831 (setq cvs-commit-list marked)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1832 (message "Press C-c C-c when you are done editing."))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1833
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1834 ;;----------
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1835 (defun cvs-edit-done ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1836 "Commit the files to the repository."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1837
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1838 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1839 (if (null cvs-commit-list)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1840 (error "You have already committed the files"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1841 (if (and (> (point-max) 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1842 (/= (char-after (1- (point-max))) ?\n)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1843 (or (eq cvs-commit-buffer-require-final-newline t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1844 (and cvs-commit-buffer-require-final-newline
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1845 (yes-or-no-p
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1846 (format "Buffer %s does not end in newline. Add one? "
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1847 (buffer-name))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1848 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1849 (goto-char (point-max))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1850 (insert ?\n)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1851 (save-some-buffers)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1852 (let ((cc-list cvs-commit-list)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1853 (cc-buffer (get-buffer cvs-buffer-name))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1854 (msg-buffer (current-buffer))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1855 (msg (buffer-substring (point-min) (point-max))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1856 (pop-to-buffer cc-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1857 (bury-buffer msg-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1858 (cvs-use-temp-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1859 (message "Committing...")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1860 (if (cvs-execute-list cc-list cvs-program
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1861 (if cvs-cvsroot
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1862 (list "-d" cvs-cvsroot "commit" "-m" msg)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1863 (list "commit" "-m" msg))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1864 "Committing %s...")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1865 (error "Something went wrong. Check the %s buffer carefully."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1866 cvs-temp-buffer-name))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1867 ;; FIXME: don't do any of this if the commit fails.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1868 (let ((ccl cc-list))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1869 (while ccl
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1870 (cvs-after-commit-function (tin-cookie cvs-cookie-handle (car ccl)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1871 (setq ccl (cdr ccl))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1872 (apply 'tin-invalidate cvs-cookie-handle cc-list)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1873 (set-buffer msg-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1874 (setq cvs-commit-list nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1875 (set-buffer cc-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1876 (if cvs-auto-remove-handled
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1877 (cvs-mode-remove-handled)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1878
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1879 (message "Committing... Done."))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1880
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1881 ;;----------
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1882 (defun cvs-after-commit-function (fileinfo)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1883 "Do everything that needs to be done when FILEINFO has been committed.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1884 The fileinfo->handle is set, and if the buffer is present it is reverted."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1885
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1886 (cvs-set-fileinfo->handled fileinfo t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1887 (if cvs-auto-revert-after-commit
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1888 (let* ((file (cvs-fileinfo->full-path fileinfo))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1889 (buffer (get-file-buffer file)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1890 ;; For a revert to happen...
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1891 (if buffer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1892 ;; ...the user must be editing the file...
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1893 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1894 (set-buffer buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1895 (if (not (buffer-modified-p))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1896 ;; ...but it must be unmodified.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1897 (revert-buffer 'dont-use-auto-save-file 'dont-ask)))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1898
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1899 ;;----------
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1900 (defun cvs-execute-list (tin-list program constant-args &optional message-fmt)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1901 "Run PROGRAM on all elements on TIN-LIST.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1902 Args: TIN-LIST PROGRAM CONSTANT-ARGS.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1903
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1904 The PROGRAM will be called with pwd set to the directory the files reside
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1905 in. CONSTANT-ARGS should be a list of strings. The arguments given to the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1906 program will be CONSTANT-ARGS followed by all the files (from TIN-LIST) that
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1907 resides in that directory. If the files in TIN-LIST resides in different
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1908 directories the PROGRAM will be run once for each directory (if all files in
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1909 the same directory appears after each other).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1910
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1911 Any output from PROGRAM will be inserted in the current buffer.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1912
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1913 This function return nil if all went well, or the numerical exit status or a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1914 signal name as a string. Note that PROGRAM might be called several times. This
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1915 will return non-nil if something goes wrong, but there is no way to know which
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1916 process that failed.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1917
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1918 If MESSAGE-FMT is not nil, then message is called to display progress with
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1919 MESSAGE-FMT as the string. MESSAGE-FMT should contain one %s for the arg-list
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1920 being passed to PROGRAM."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1921
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1922 ;; FIXME: something seems wrong with the error checking here....
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1923
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1924 (let ((exitstatus nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1925 (while tin-list
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1926 (let ((current-dir (cvs-fileinfo->dir (tin-cookie cvs-cookie-handle
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1927 (car tin-list))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1928 arg-list
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1929 arg-str)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1930
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1931 ;; Collect all marked files in this directory.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1932
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1933 (while (and tin-list
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1934 (string= current-dir
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1935 (cvs-fileinfo->dir (tin-cookie cvs-cookie-handle
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1936 (car tin-list)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1937 (setq arg-list
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1938 (cons (cvs-fileinfo->file-name
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1939 (tin-cookie cvs-cookie-handle (car tin-list)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1940 arg-list))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1941 (setq tin-list (cdr tin-list)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1942
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1943 (setq arg-list (nreverse arg-list))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1944
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1945 ;; Execute the command on all the files that were collected.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1946
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1947 (if message-fmt
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1948 (message message-fmt
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1949 (mapconcat 'cvs-quote-multiword-string
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1950 arg-list
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1951 " ")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1952 (setq default-directory (file-name-as-directory current-dir))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1953 (insert (format "=== cd %s\n" default-directory))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1954 (insert (format "=== %s %s\n\n"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1955 program
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1956 (mapconcat 'cvs-quote-multiword-string
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1957 (nconc (copy-sequence constant-args)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1958 arg-list)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1959 " ")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1960 (let ((res (apply 'call-process program nil t t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1961 (nconc (copy-sequence constant-args) arg-list))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1962 ;; Remember the first, or highest, exitstatus.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1963 (if (and (not (and (integerp res) (zerop res)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1964 (or (null exitstatus)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1965 (and (integerp exitstatus) (= 1 exitstatus))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1966 (setq exitstatus res)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1967 (goto-char (point-max))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1968 (if message-fmt
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1969 (message message-fmt
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1970 (mapconcat 'cvs-quote-multiword-string
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1971 (nconc (copy-sequence arg-list) '("Done."))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1972 " ")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1973 exitstatus))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1974
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1975 ;;----------
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1976 ;;;; +++ not currently used!
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1977 (defun cvs-execute-single-file-list (tin-list extractor program constant-args
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1978 &optional cleanup message-fmt)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1979 "Run PROGRAM on all elements on TIN-LIST.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1980 Args: TIN-LIST EXTRACTOR PROGRAM CONSTANT-ARGS &optional CLEANUP.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1981
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1982 The PROGRAM will be called with pwd set to the directory the files
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1983 reside in. CONSTANT-ARGS is a list of strings to pass as arguments to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1984 PROGRAM. The arguments given to the program will be CONSTANT-ARGS
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1985 followed by the list that EXTRACTOR returns.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1986
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1987 EXTRACTOR will be called once for each file on TIN-LIST. It is given
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1988 one argument, the cvs-fileinfo. It can return t, which means ignore
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1989 this file, or a list of arguments to send to the program.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1990
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1991 If CLEANUP is not nil, the filenames returned by EXTRACTOR are deleted.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1992
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1993 If MESSAGE-FMT is not nil, then message is called to display progress with
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1994 MESSAGE-FMT as the string. MESSAGE-FMT should contain one %s for the arg-list
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1995 being passed to PROGRAM."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1996
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1997 (while tin-list
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1998 (let ((current-dir (file-name-as-directory
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1999 (cvs-fileinfo->dir
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2000 (tin-cookie cvs-cookie-handle
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2001 (car tin-list)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2002 (arg-list
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2003 (funcall extractor
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2004 (tin-cookie cvs-cookie-handle (car tin-list)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2005
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2006 ;; Execute the command unless extractor returned t.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2007
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2008 (if (eq arg-list t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2009 nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2010 (setq default-directory current-dir)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2011 (insert (format "=== cd %s\n" default-directory))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2012 (insert (format "=== %s %s\n\n"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2013 program
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2014 (mapconcat 'cvs-quote-multiword-string
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2015 (nconc (copy-sequence constant-args)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2016 arg-list)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2017 " ")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2018 (if message-fmt
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2019 (message message-fmt (mapconcat 'cvs-quote-multiword-string
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2020 arg-list
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2021 " ")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2022 (apply 'call-process program nil t t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2023 (nconc (copy-sequence constant-args) arg-list))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2024 (goto-char (point-max))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2025 (if message-fmt
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2026 (message message-fmt (mapconcat 'cvs-quote-multiword-string
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2027 (nconc arg-list '("Done."))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2028 " ")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2029 (if cleanup
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2030 (while arg-list
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2031 ;;;; (kill-buffer ?????)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2032 (delete-file (car arg-list))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2033 (setq arg-list (cdr arg-list))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2034 (setq tin-list (cdr tin-list))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2035
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2036 ;;----------
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2037 (defun cvs-edit-mode ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2038 "\\<cvs-edit-mode-map>Mode for editing cvs log messages.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2039 Commands:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2040 \\[cvs-edit-done] checks in the file when you are ready.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2041 This mode is based on fundamental mode."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2042
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2043 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2044 (use-local-map cvs-edit-mode-map)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2045 (setq major-mode 'cvs-edit-mode)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2046 (setq mode-name "CVS Log")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2047 (auto-fill-mode 1))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2048
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2049 ;;----------
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2050 (if cvs-edit-mode-map
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2051 nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2052 (setq cvs-edit-mode-map (make-sparse-keymap))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2053 (define-prefix-command 'cvs-edit-mode-control-c-prefix)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2054 (define-key cvs-edit-mode-map "\C-c" 'cvs-edit-mode-control-c-prefix)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2055 (define-key cvs-edit-mode-map "\C-c\C-c" 'cvs-edit-done))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2056
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2057 ;;----------
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2058 (defun cvs-diffable (tins)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2059 "Return a list of all tins on TINS that it makes sense to run
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2060 ``cvs diff'' on."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2061
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2062 ;; +++ There is an unnecessary (nreverse) here. Get the list the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2063 ;; other way around instead!
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2064 (let ((result nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2065 (while tins
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2066 (let ((type (cvs-fileinfo->type
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2067 (tin-cookie cvs-cookie-handle (car tins)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2068 (if (or (eq type 'MODIFIED)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2069 (eq type 'UPDATED)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2070 (eq type 'PATCHED)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2071 (eq type 'MERGED)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2072 (eq type 'CONFLICT)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2073 (eq type 'REMOVED) ;+++Does this line make sense?
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2074 (eq type 'ADDED)) ;+++Does this line make sense?
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2075 (setq result (cons (car tins) result)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2076 (setq tins (cdr tins))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2077 (nreverse result)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2078
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2079 ;;----------
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2080 (defun cvs-mode-diff-cvs (&optional ignore-marks)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2081 "Diff the selected files against the head revisions in the repository.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2082
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2083 If the variable cvs-diff-ignore-marks is non-nil any marked files will not be
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2084 considered to be selected. An optional prefix argument will invert the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2085 influence from cvs-diff-ignore-marks.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2086
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2087 The flags in the variable cvs-diff-flags will be passed to ``cvs diff''.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2088
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2089 The resulting diffs are placed in the cvs-fileinfo->cvs-diff-buffer."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2090
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2091 (interactive "P")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2092 (if (not (listp cvs-diff-flags))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2093 (error "cvs-diff-flags should be set using cvs-set-diff-flags."))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2094 (save-some-buffers)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2095 (message "cvsdiffing...")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2096 (let ((marked-file-list (cvs-diffable
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2097 (cvs-get-marked
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2098 (or (and ignore-marks (not cvs-diff-ignore-marks))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2099 (and (not ignore-marks) cvs-diff-ignore-marks))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2100 (while marked-file-list
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2101 (let ((fileinfo-to-diff (tin-cookie cvs-cookie-handle
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2102 (car marked-file-list)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2103 (local-def-directory (file-name-as-directory
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2104 (cvs-fileinfo->dir
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2105 (tin-cookie cvs-cookie-handle
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2106 (car marked-file-list))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2107 (message "cvsdiffing %s..."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2108 (cvs-fileinfo->file-name fileinfo-to-diff))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2109
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2110 ;; FIXME: this seems messy to test and set buffer name at this point....
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2111 (if (not (cvs-fileinfo->cvs-diff-buffer fileinfo-to-diff))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2112 (cvs-set-fileinfo->cvs-diff-buffer fileinfo-to-diff
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2113 (concat "*cvs-diff-"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2114 (cvs-fileinfo->file-name
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2115 fileinfo-to-diff)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2116 "-in-"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2117 local-def-directory
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2118 "*")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2119 (display-buffer (get-buffer-create
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2120 (cvs-fileinfo->cvs-diff-buffer fileinfo-to-diff)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2121 (set-buffer (cvs-fileinfo->cvs-diff-buffer fileinfo-to-diff))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2122 (setq buffer-read-only nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2123 (setq default-directory local-def-directory)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2124 (erase-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2125 (insert (format "=== cd %s\n" default-directory))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2126 (insert (format "=== cvs %s\n\n"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2127 (mapconcat 'cvs-quote-multiword-string
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2128 (nconc (if cvs-cvsroot
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2129 (list "-d" cvs-cvsroot "diff")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2130 '("diff"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2131 (copy-sequence cvs-diff-flags)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2132 (list (cvs-fileinfo->file-name
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2133 fileinfo-to-diff)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2134 " ")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2135 (if (apply 'call-process cvs-program nil t t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2136 (nconc (if cvs-cvsroot
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2137 (list "-d" cvs-cvsroot "diff")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2138 '("diff"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2139 (copy-sequence cvs-diff-flags)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2140 (list (cvs-fileinfo->file-name fileinfo-to-diff))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2141 (message "cvsdiffing %s... Done."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2142 (cvs-fileinfo->file-name fileinfo-to-diff))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2143 (message "cvsdiffing %s... No differences found."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2144 (cvs-fileinfo->file-name fileinfo-to-diff)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2145 (goto-char (point-max))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2146 (setq marked-file-list (cdr marked-file-list)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2147 (message "cvsdiffing... Done."))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2148
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2149 ;;----------
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2150 (defun cvs-mode-diff-backup (&optional ignore-marks)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2151 "Diff the files against the backup file.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2152 This command can be used on files that are marked with \"Merged\"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2153 or \"Conflict\" in the *cvs* buffer.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2154
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2155 If the variable cvs-diff-ignore-marks is non-nil any marked files will
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2156 not be considered to be selected. An optional prefix argument will
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2157 invert the influence from cvs-diff-ignore-marks.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2158
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2159 The flags in cvs-diff-flags will be passed to ``diff''.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2160
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2161 The resulting diffs are placed in the cvs-fileinfo->backup-diff-buffer."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2162
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2163 (interactive "P")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2164 (if (not (listp cvs-diff-flags))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2165 (error "cvs-diff-flags should be set using cvs-set-diff-flags."))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2166 (save-some-buffers)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2167 (let ((marked-file-list (cvs-filter
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2168 (function cvs-backup-diffable)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2169 (cvs-get-marked
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2170 (or
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2171 (and ignore-marks (not cvs-diff-ignore-marks))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2172 (and (not ignore-marks) cvs-diff-ignore-marks))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2173 (if (null marked-file-list)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2174 (error "No ``Conflict'' or ``Merged'' file selected!"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2175 (message "backup diff...")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2176 (while marked-file-list
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2177 (let ((fileinfo-to-diff (tin-cookie cvs-cookie-handle
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2178 (car marked-file-list)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2179 (local-def-directory (file-name-as-directory
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2180 (cvs-fileinfo->dir
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2181 (tin-cookie cvs-cookie-handle
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2182 (car marked-file-list)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2183 (backup-temp-files (cvs-diff-backup-extractor
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2184 (tin-cookie cvs-cookie-handle
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2185 (car marked-file-list)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2186 (message "backup diff %s..."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2187 (cvs-fileinfo->file-name fileinfo-to-diff))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2188
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2189 ;; FIXME: this seems messy to test and set buffer name at this point....
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2190 (if (not (cvs-fileinfo->backup-diff-buffer fileinfo-to-diff))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2191 (cvs-set-fileinfo->backup-diff-buffer fileinfo-to-diff
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2192 (concat "*cvs-diff-"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2193 (cvs-fileinfo->backup-file
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2194 fileinfo-to-diff)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2195 "-to-"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2196 (cvs-fileinfo->file-name
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2197 fileinfo-to-diff)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2198 "-in"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2199 local-def-directory
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2200 "*")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2201 (display-buffer (get-buffer-create
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2202 (cvs-fileinfo->backup-diff-buffer fileinfo-to-diff)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2203 (set-buffer (cvs-fileinfo->backup-diff-buffer fileinfo-to-diff))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2204 (setq buffer-read-only nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2205 (setq default-directory local-def-directory)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2206 (erase-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2207 (insert (format "=== cd %s\n" default-directory))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2208 (insert (format "=== %s %s\n\n"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2209 cvs-diff-program
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2210 (mapconcat 'cvs-quote-multiword-string
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2211 (nconc (copy-sequence cvs-diff-flags)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2212 backup-temp-files)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2213 " ")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2214 (apply 'call-process cvs-diff-program nil t t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2215 (nconc (copy-sequence cvs-diff-flags) backup-temp-files))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2216 (goto-char (point-max))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2217 (message "backup diff %s... Done."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2218 (cvs-fileinfo->file-name fileinfo-to-diff))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2219 (setq marked-file-list (cdr marked-file-list)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2220 (message "backup diff... Done."))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2221
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2222 ;;----------
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2223 (defun cvs-mode-diff-vendor (&optional ignore-marks)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2224 "Diff the revisions merged into the current file. I.e. show what changes
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2225 were merged in.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2226
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2227 This command can be used on files that are marked with \"Merged\"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2228 or \"Conflict\" in the *cvs* buffer.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2229
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2230 If the variable cvs-diff-ignore-marks is non-nil any marked files will
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2231 not be considered to be selected. An optional prefix argument will
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2232 invert the influence from cvs-diff-ignore-marks.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2233
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2234 The flags in cvs-diff-flags will be passed to ``diff''.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2235
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2236 The resulting diffs are placed in the cvs-fileinfo->vendor-diff-buffer."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2237
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2238 (interactive "P")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2239 (if (not (listp cvs-diff-flags))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2240 (error "cvs-diff-flags should be set using cvs-set-diff-flags."))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2241 (save-some-buffers)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2242 (let ((marked-file-list (cvs-filter
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2243 (function cvs-vendor-diffable)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2244 (cvs-get-marked
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2245 (or
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2246 (and ignore-marks (not cvs-diff-ignore-marks))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2247 (and (not ignore-marks) cvs-diff-ignore-marks))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2248 (if (null marked-file-list)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2249 (error "No ``Conflict'' or ``Merged'' file selected!"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2250 (message "vendor diff...")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2251 (while marked-file-list
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2252 (let ((fileinfo-to-diff (tin-cookie cvs-cookie-handle
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2253 (car marked-file-list)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2254 (local-def-directory (file-name-as-directory
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2255 (cvs-fileinfo->dir
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2256 (tin-cookie cvs-cookie-handle
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2257 (car marked-file-list)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2258 (vendor-temp-files (cvs-diff-vendor-extractor
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2259 (tin-cookie cvs-cookie-handle
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2260 (car marked-file-list)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2261 (message "vendor diff %s..."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2262 (cvs-fileinfo->file-name fileinfo-to-diff))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2263 (if (not (cvs-fileinfo->vendor-diff-buffer fileinfo-to-diff))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2264 (cvs-set-fileinfo->vendor-diff-buffer fileinfo-to-diff
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2265 (concat "*cvs-diff-"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2266 (cvs-fileinfo->file-name
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2267 fileinfo-to-diff)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2268 "-of-"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2269 (cvs-fileinfo->base-revision
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2270 fileinfo-to-diff)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2271 "-to-"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2272 (cvs-fileinfo->head-revision
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2273 fileinfo-to-diff)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2274 "-in-"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2275 local-def-directory
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2276 "*")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2277 (display-buffer (get-buffer-create
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2278 (cvs-fileinfo->vendor-diff-buffer fileinfo-to-diff)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2279 (set-buffer (cvs-fileinfo->vendor-diff-buffer fileinfo-to-diff))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2280 (setq buffer-read-only nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2281 (setq default-directory local-def-directory)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2282 (erase-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2283 (insert (format "=== cd %s\n" default-directory))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2284 (insert (format "=== %s %s\n\n"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2285 cvs-diff-program
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2286 (mapconcat 'cvs-quote-multiword-string
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2287 (nconc (copy-sequence cvs-diff-flags)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2288 vendor-temp-files)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2289 " ")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2290 (apply 'call-process cvs-diff-program nil t t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2291 (nconc (copy-sequence cvs-diff-flags) vendor-temp-files))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2292 (goto-char (point-max))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2293 (message "vendor diff %s... Done."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2294 (cvs-fileinfo->file-name fileinfo-to-diff))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2295 (while vendor-temp-files
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2296 (cvs-kill-buffer-visiting (car vendor-temp-files))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2297 (delete-file (car vendor-temp-files))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2298 (setq vendor-temp-files (cdr vendor-temp-files)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2299 (setq marked-file-list (cdr marked-file-list)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2300 (message "vendor diff... Done."))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2301
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2302 ;;----------
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2303 (defun cvs-backup-diffable (tin)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2304 "Check if the TIN is backup-diffable.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2305 It must have a backup file to be diffable."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2306
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2307 (file-readable-p
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2308 (cvs-fileinfo->backup-file (tin-cookie cvs-cookie-handle tin))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2309
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2310 ;;----------
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2311 (defun cvs-vendor-diffable (tin)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2312 "Check if the TIN is vendor-diffable.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2313 It must have head and base revision info to be diffable."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2314
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2315 (and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2316 (cvs-fileinfo->base-revision (tin-cookie cvs-cookie-handle tin))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2317 (cvs-fileinfo->head-revision (tin-cookie cvs-cookie-handle tin))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2318
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2319 ;;----------
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2320 (defun cvs-diff-backup-extractor (fileinfo)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2321 "Return the filename and the name of the backup file as a list.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2322 Signal an error if there is no backup file."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2323
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2324 (if (not (file-readable-p (cvs-fileinfo->backup-file fileinfo)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2325 (error "%s has no backup file."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2326 (concat
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2327 (file-name-as-directory (cvs-fileinfo->dir fileinfo))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2328 (cvs-fileinfo->file-name fileinfo))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2329 (list (cvs-fileinfo->backup-file fileinfo)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2330 (cvs-fileinfo->file-name fileinfo)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2331
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2332 ;;----------
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2333 (defun cvs-diff-vendor-extractor (fileinfo)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2334 "Retrieve and return the filenames of the vendor branch revisions as a list.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2335 Signal an error if there is no info for the vendor revisions."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2336
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2337 (list (cvs-retrieve-revision-to-tmpfile fileinfo
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2338 (cvs-fileinfo->base-revision
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2339 fileinfo))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2340 (cvs-retrieve-revision-to-tmpfile fileinfo
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2341 (cvs-fileinfo->head-revision
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2342 fileinfo))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2343
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2344 ;;----------
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2345 (defun cvs-mode-find-file-other-window (pos)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2346 "Select a buffer containing the file in another window.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2347 Args: POS."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2348
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2349 (interactive "d")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2350 (let ((tin (tin-locate cvs-cookie-handle pos)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2351 (if tin
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2352 (let ((type (cvs-fileinfo->type (tin-cookie cvs-cookie-handle tin))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2353 (cond
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2354 ((or (eq type 'REMOVED)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2355 (eq type 'CVS-REMOVED))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2356 (error "Can't visit a removed file."))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2357 ((eq type 'DIRCHANGE)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2358 (let ((obuf (current-buffer))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2359 (odir default-directory))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2360 (setq default-directory
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2361 (file-name-as-directory
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2362 (cvs-fileinfo->dir
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2363 (tin-cookie cvs-cookie-handle tin))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2364 (dired-other-window default-directory)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2365 (set-buffer obuf)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2366 (setq default-directory odir)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2367 (t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2368 (find-file-other-window (cvs-full-path tin)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2369 (error "There is no file to find."))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2370
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2371 ;;----------
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2372 (defun cvs-fileinfo->full-path (fileinfo)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2373 "Return the full path for the file that is described in FILEINFO."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2374
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2375 (concat
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2376 (file-name-as-directory
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2377 (cvs-fileinfo->dir fileinfo))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2378 (cvs-fileinfo->file-name fileinfo)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2379
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2380 ;;----------
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2381 (defun cvs-full-path (tin)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2382 "Return the full path for the file that is described in TIN."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2383
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2384 (cvs-fileinfo->full-path (tin-cookie cvs-cookie-handle tin)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2385
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2386 ;;----------
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2387 (defun cvs-mode-find-file (pos)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2388 "Select a buffer containing the file in another window.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2389 Args: POS."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2390
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2391 (interactive "d")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2392 (let* ((cvs-buf (current-buffer))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2393 (tin (tin-locate cvs-cookie-handle pos)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2394 (if tin
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2395 (let* ((fileinfo (tin-cookie cvs-cookie-handle tin))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2396 (type (cvs-fileinfo->type fileinfo)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2397 (cond
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2398 ((or (eq type 'REMOVED)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2399 (eq type 'CVS-REMOVED))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2400 (error "Can't visit a removed file."))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2401 ((eq type 'DIRCHANGE)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2402 (let ((odir default-directory))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2403 (setq default-directory
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2404 (file-name-as-directory (cvs-fileinfo->dir fileinfo)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2405 (dired default-directory)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2406 (set-buffer cvs-buf)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2407 (setq default-directory odir)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2408 (t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2409 (find-file (cvs-full-path tin)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2410 (error "There is no file to find."))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2411
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2412 ;;----------
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2413 (defun cvs-mode-mark-all-files ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2414 "Mark all files.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2415 Directories are not marked."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2416
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2417 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2418 (cookie-map (function (lambda (cookie)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2419 (cond
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2420 ((not (eq (cvs-fileinfo->type cookie) 'DIRCHANGE))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2421 (cvs-set-fileinfo->marked cookie t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2422 t))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2423 cvs-cookie-handle))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2424
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2425 ;;----------
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2426 (defun cvs-mode-unmark (pos)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2427 "Unmark a fileinfo.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2428 Args: POS."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2429
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2430 (interactive "d")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2431 (let* ((tin (tin-locate cvs-cookie-handle pos))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2432 (sel (tin-cookie cvs-cookie-handle tin)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2433 (cond
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2434 ((eq (cvs-fileinfo->type sel) 'DIRCHANGE)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2435 (cookie-map
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2436 (function (lambda (f dir)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2437 (cond
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2438 ((cvs-dir-member-p f dir)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2439 (cvs-set-fileinfo->marked f nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2440 t))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2441 cvs-cookie-handle
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2442 (cvs-fileinfo->dir sel)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2443 (t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2444 (cvs-set-fileinfo->marked sel nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2445 (tin-invalidate cvs-cookie-handle tin)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2446 (tin-goto-next cvs-cookie-handle pos 1)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2447
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2448 ;;----------
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2449 (defun cvs-mode-unmark-all-files ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2450 "Unmark all files.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2451 Directories are also unmarked, but that doesn't matter, since
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2452 they should always be unmarked."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2453
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2454 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2455 (cookie-map (function (lambda (cookie)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2456 (cvs-set-fileinfo->marked cookie nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2457 t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2458 cvs-cookie-handle))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2459
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2460 ;;----------
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2461 (defun cvs-do-removal (tins)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2462 "Remove files.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2463 Args: TINS.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2464
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2465 TINS is a list of tins that the user wants to delete. The files are deleted.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2466 If the type of the tin is 'UNKNOWN or 'UNKNOWN-DIR the tin is removed from the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2467 buffer. If it is anything else the file is added to a list that should be `cvs
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2468 remove'd and the tin is changed to be of type 'REMOVED.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2469
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2470 Returns a list of tins files that should be `cvs remove'd."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2471
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2472 (cvs-use-temp-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2473 (mapcar 'cvs-insert-full-path tins)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2474 (cond
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2475 ((and tins (yes-or-no-p (format "Delete %d files? " (length tins))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2476 (let (files-to-remove)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2477 (while tins
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2478 (let* ((tin (car tins))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2479 (fileinfo (tin-cookie cvs-cookie-handle tin))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2480 (filepath (cvs-full-path tin))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2481 (type (cvs-fileinfo->type fileinfo)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2482 (if (or (eq type 'REMOVED)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2483 (eq type 'CVS-REMOVED))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2484 nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2485 ;; if it doesn't exist, as a file or directory, ignore it
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2486 (cond ((file-directory-p filepath)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2487 (call-process cvs-rmdir-program nil nil nil filepath))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2488 ((file-exists-p filepath)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2489 (delete-file filepath)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2490 (if (or (eq type 'UNKNOWN)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2491 (eq type 'UNKNOWN-DIR)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2492 (eq type 'MOVE-AWAY))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2493 (tin-delete cvs-cookie-handle tin)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2494 (setq files-to-remove (cons tin files-to-remove))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2495 (cvs-set-fileinfo->type fileinfo 'REMOVED)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2496 (cvs-set-fileinfo->handled fileinfo nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2497 (tin-invalidate cvs-cookie-handle tin))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2498 (setq tins (cdr tins)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2499 files-to-remove))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2500 (t nil)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2501
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2502 ;;----------
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2503 (defun cvs-mode-remove-file ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2504 "Remove all marked files."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2505
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2506 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2507 (let ((files-to-remove (cvs-do-removal (cvs-get-marked))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2508 (if (null files-to-remove)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2509 nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2510 (cvs-use-temp-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2511 (message "removing from repository...")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2512 (if (cvs-execute-list files-to-remove cvs-program
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2513 (if cvs-cvsroot
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2514 (list "-d" cvs-cvsroot "remove")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2515 '("remove"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2516 "removing %s from repository...")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2517 (error "CVS exited with non-zero exit status.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2518 (message "removing from repository... Done.")))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2519
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2520 ;;----------
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2521 (defun cvs-mode-undo-local-changes ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2522 "Undo local changes to all marked files.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2523 The file is removed and `cvs update FILE' is run."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2524
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2525 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2526 (let ((tins-to-undo (cvs-get-marked)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2527 (cvs-use-temp-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2528 (mapcar 'cvs-insert-full-path tins-to-undo)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2529 (cond
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2530 ((and tins-to-undo (yes-or-no-p (format "Undo changes to %d files? "
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2531 (length tins-to-undo))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2532 (let (files-to-update)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2533 (while tins-to-undo
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2534 (let* ((tin (car tins-to-undo))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2535 (fileinfo (tin-cookie cvs-cookie-handle tin))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2536 (type (cvs-fileinfo->type fileinfo)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2537 (cond
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2538 ((or
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2539 (eq type 'UPDATED)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2540 (eq type 'PATCHED)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2541 (eq type 'MODIFIED)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2542 (eq type 'MERGED)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2543 (eq type 'CONFLICT)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2544 (eq type 'CVS-REMOVED)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2545 (eq type 'REM-CONFLICT)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2546 (eq type 'MOVE-AWAY)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2547 (eq type 'REMOVED))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2548 (if (not (eq type 'REMOVED))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2549 (delete-file (cvs-full-path tin)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2550 (setq files-to-update (cons tin files-to-update))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2551 (cvs-set-fileinfo->type fileinfo 'UPDATED)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2552 (cvs-set-fileinfo->handled fileinfo t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2553 (tin-invalidate cvs-cookie-handle tin))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2554
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2555 ((eq type 'MOD-CONFLICT)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2556 (error "Use cvs-mode-add instead on %s."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2557 (cvs-fileinfo->file-name fileinfo)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2558
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2559 ((eq type 'REM-CONFLICT)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2560 (error "Can't deal with a file you have removed and recreated."))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2561
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2562 ((eq type 'DIRCHANGE)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2563 (error "Undo on directories not supported (yet)."))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2564
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2565 ((eq type 'ADDED)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2566 (error "There is no old revision to get for %s"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2567 (cvs-fileinfo->file-name fileinfo)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2568 (t (error "cvs-mode-undo-local-changes: can't handle an %s"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2569 type)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2570
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2571 (setq tins-to-undo (cdr tins-to-undo))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2572 (cvs-use-temp-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2573 (message "Re-getting files from repository...")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2574 (if (cvs-execute-list files-to-update cvs-program
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2575 (if cvs-cvsroot
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2576 (list "-d" cvs-cvsroot "update")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2577 '("update"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2578 "Re-getting %s from repository...")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2579 (error "CVS exited with non-zero exit status.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2580 (message "Re-getting files from repository... Done.")))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2581
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2582 ;;----------
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2583 (defun cvs-mode-acknowledge ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2584 "Remove all marked files from the buffer."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2585
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2586 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2587 (mapcar (function (lambda (tin)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2588 (tin-delete cvs-cookie-handle tin)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2589 (cvs-get-marked)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2590
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2591 ;;----------
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2592 (defun cvs-mode-unmark-up (pos)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2593 "Unmark the file on the previous line.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2594 Takes one argument POS, a buffer position."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2595
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2596 (interactive "d")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2597 (let ((tin (tin-goto-previous cvs-cookie-handle pos 1)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2598 (cond
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2599 (tin
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2600 (cvs-set-fileinfo->marked (tin-cookie cvs-cookie-handle tin)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2601 nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2602 (tin-invalidate cvs-cookie-handle tin)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2603
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2604 ;;----------
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2605 (defun cvs-mode-previous-line (arg)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2606 "Go to the previous line.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2607 If a prefix argument is given, move by that many lines."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2608
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2609 (interactive "p")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2610 (tin-goto-previous cvs-cookie-handle (point) arg))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2611
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2612 ;;----------
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2613 (defun cvs-mode-next-line (arg)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2614 "Go to the next line.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2615 If a prefix argument is given, move by that many lines."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2616
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2617 (interactive "p")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2618 (tin-goto-next cvs-cookie-handle (point) arg))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2619
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2620 ;;----------
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2621 (defun cvs-add-file-update-buffer (tin)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2622 "Sub-function to cvs-mode-add. Internal use only. Update the display. Return
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2623 non-nil if `cvs add' should be called on this file.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2624 Args: TIN.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2625
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2626 Returns 'DIR, 'ADD, 'ADD-DIR, or 'RESURRECT."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2627
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2628 (let ((fileinfo (tin-cookie cvs-cookie-handle tin)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2629 (cond
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2630 ((eq (cvs-fileinfo->type fileinfo) 'UNKNOWN-DIR)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2631 (cvs-set-fileinfo->full-log fileinfo "new directory added with cvs-mode-add")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2632 'ADD-DIR)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2633 ((eq (cvs-fileinfo->type fileinfo) 'UNKNOWN)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2634 (cvs-set-fileinfo->type fileinfo 'ADDED)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2635 (cvs-set-fileinfo->full-log fileinfo "new file added with cvs-mode-add")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2636 (tin-invalidate cvs-cookie-handle tin)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2637 'ADD)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2638 ((eq (cvs-fileinfo->type fileinfo) 'REMOVED)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2639 (cvs-set-fileinfo->type fileinfo 'UPDATED)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2640 (cvs-set-fileinfo->full-log fileinfo "file resurrected with cvs-mode-add")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2641 (cvs-set-fileinfo->handled fileinfo t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2642 (tin-invalidate cvs-cookie-handle tin)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2643 'RESURRECT))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2644
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2645 ;;----------
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2646 (defun cvs-add-sub (cvs-buf candidates)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2647 "Internal use only.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2648 Args: CVS-BUF CANDIDATES.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2649
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2650 CANDIDATES is a list of tins. Updates the CVS-BUF and returns a list of lists.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2651 The first list is unknown tins that shall be `cvs add -m msg'ed.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2652 The second list is unknown directory tins that shall be `cvs add -m msg'ed.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2653 The third list is removed files that shall be `cvs add'ed (resurrected)."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2654
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2655 (let (add add-dir resurrect)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2656 (while candidates
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2657 (let ((type (cvs-add-file-update-buffer (car candidates))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2658 (cond ((eq type 'ADD)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2659 (setq add (cons (car candidates) add)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2660 ((eq type 'ADD-DIR)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2661 (setq add-dir (cons (car candidates) add-dir)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2662 ((eq type 'RESURRECT)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2663 (setq resurrect (cons (car candidates) resurrect)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2664 (setq candidates (cdr candidates)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2665 (list add add-dir resurrect)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2666
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2667 ;;----------
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2668 (defun cvs-mode-add ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2669 "Add marked files to the cvs repository."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2670
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2671 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2672 (let* ((buf (current-buffer))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2673 (marked (cvs-get-marked))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2674 (result (cvs-add-sub buf marked))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2675 (added (car result))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2676 (newdirs (car (cdr result)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2677 (resurrect (car (cdr (cdr result))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2678 (msg (if (or added newdirs)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2679 (read-from-minibuffer "Enter description: "))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2680
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2681 (if (or resurrect (or added newdirs))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2682 (cvs-use-temp-buffer))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2683
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2684 (cond (resurrect
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2685 (message "Resurrecting files from repository...")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2686 (if (cvs-execute-list resurrect
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2687 cvs-program
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2688 (if cvs-cvsroot
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2689 (list "-d" cvs-cvsroot "add")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2690 '("add"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2691 "Resurrecting %s from repository...")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2692 (error "CVS exited with non-zero exit status.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2693 (message "Resurrecting files from repository... Done."))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2694
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2695 (cond (added
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2696 (message "Adding new files to repository...")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2697 (if (cvs-execute-list added
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2698 cvs-program
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2699 (if cvs-cvsroot
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2700 (list "-d" cvs-cvsroot "add" "-m" msg)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2701 (list "add" "-m" msg))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2702 "Adding %s to repository...")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2703 (error "CVS exited with non-zero exit status.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2704 (message "Adding new files to repository... Done."))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2705
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2706 (cond (newdirs
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2707 (message "Adding new directories to repository...")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2708 (if (cvs-execute-list newdirs
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2709 cvs-program
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2710 (if cvs-cvsroot
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2711 (list "-d" cvs-cvsroot "add" "-m" msg)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2712 (list "add" "-m" msg))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2713 "Adding %s to repository...")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2714 (error "CVS exited with non-zero exit status.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2715 (while newdirs
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2716 (let* ((tin (car newdirs))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2717 (fileinfo (tin-cookie cvs-cookie-handle tin))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2718 (newdir (cvs-fileinfo->file-name fileinfo)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2719 (cvs-set-fileinfo->dir fileinfo
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2720 (concat (cvs-fileinfo->dir fileinfo)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2721 "/"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2722 newdir))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2723 (cvs-set-fileinfo->type fileinfo 'DIRCHANGE)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2724 (cvs-set-fileinfo->file-name fileinfo ".")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2725 (tin-invalidate cvs-cookie-handle tin)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2726 (setq newdirs (cdr newdirs))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2727 ;; FIXME: this should really run cvs-update-no-prompt on the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2728 ;; subdir and insert everthing in the current list.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2729 (message "You must re-update to visit the new directories."))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2730
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2731 ;;----------
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2732 (defun cvs-mode-ignore ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2733 "Arrange so that CVS ignores the selected files and directories.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2734 This command ignores files/dirs that are flagged as `Unknown'."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2735
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2736 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2737 (mapcar (function (lambda (tin)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2738 (let* ((fileinfo (tin-cookie cvs-cookie-handle tin))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2739 (type (cvs-fileinfo->type fileinfo)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2740 (cond ((or (eq type 'UNKNOWN)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2741 (eq type 'UNKNOWN-DIR))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2742 (cvs-append-to-ignore fileinfo)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2743 (tin-delete cvs-cookie-handle tin))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2744 (cvs-get-marked)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2745
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2746 ;;----------
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2747 (defun cvs-append-to-ignore (fileinfo)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2748 "Append the file in fileinfo to the .cvsignore file"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2749
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2750 (save-window-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2751 (set-buffer (find-file-noselect (concat (file-name-as-directory
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2752 (cvs-fileinfo->dir fileinfo))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2753 ".cvsignore")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2754 (goto-char (point-max))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2755 (if (not (zerop (current-column)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2756 (insert "\n"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2757 (insert (cvs-fileinfo->file-name fileinfo) "\n")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2758 (if cvs-sort-ignore-file
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2759 (sort-lines nil (point-min) (point-max)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2760 (save-buffer)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2761
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2762 ;;----------
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2763 (defun cvs-mode-status ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2764 "Show cvs status for all marked files."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2765
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2766 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2767 (save-some-buffers)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2768 (if (not (listp cvs-status-flags))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2769 (error "cvs-status-flags should be set using cvs-set-status-flags."))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2770 (let ((marked (cvs-get-marked nil t)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2771 (cvs-use-temp-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2772 (message "Running cvs status ...")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2773 (if (cvs-execute-list marked
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2774 cvs-program
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2775 (append (if cvs-cvsroot (list "-d" cvs-cvsroot))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2776 (list "-Q" "status")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2777 cvs-status-flags)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2778 "Running cvs -Q status %s...")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2779 (error "CVS exited with non-zero exit status.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2780 (message "Running cvs -Q status ... Done."))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2781
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2782 ;;----------
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2783 (defun cvs-mode-log ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2784 "Display the cvs log of all selected files."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2785
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2786 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2787 (if (not (listp cvs-log-flags))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2788 (error "cvs-log-flags should be set using cvs-set-log-flags."))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2789 (let ((marked (cvs-get-marked nil t)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2790 (cvs-use-temp-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2791 (message "Running cvs log ...")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2792 (if (cvs-execute-list marked
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2793 cvs-program
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2794 (append (if cvs-cvsroot (list "-d" cvs-cvsroot))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2795 (list "log")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2796 cvs-log-flags)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2797 "Running cvs log %s...")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2798 (error "CVS exited with non-zero exit status.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2799 (message "Running cvs log ... Done."))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2800
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2801 ;;----------
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2802 (defun cvs-mode-tag ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2803 "Run 'cvs tag' on all selected files."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2804
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2805 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2806 (if (not (listp cvs-tag-flags))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2807 (error "cvs-tag-flags should be set using cvs-set-tag-flags."))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2808 (let ((marked (cvs-get-marked nil t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2809 (tag-args (cvs-make-list (read-string "Tag name (and flags): "))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2810 (cvs-use-temp-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2811 (message "Running cvs tag ...")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2812 (if (cvs-execute-list marked
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2813 cvs-program
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2814 (append (if cvs-cvsroot (list "-d" cvs-cvsroot))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2815 (list "tag")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2816 cvs-tag-flags
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2817 tag-args)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2818 "Running cvs tag %s...")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2819 (error "CVS exited with non-zero exit status.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2820 (message "Running cvs tag ... Done."))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2821
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2822 ;;----------
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2823 (defun cvs-mode-rtag ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2824 "Run 'cvs rtag' on all selected files."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2825
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2826 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2827 (if (not (listp cvs-rtag-flags))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2828 (error "cvs-rtag-flags should be set using cvs-set-rtag-flags."))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2829 (let ((marked (cvs-get-marked nil t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2830 ;; FIXME: should give selection from the modules file
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2831 (module-name (read-string "Module name: "))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2832 ;; FIXME: should also ask for an existing tag *or* date
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2833 (rtag-args (cvs-make-list (read-string "Tag name (and flags): "))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2834 (cvs-use-temp-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2835 (message "Running cvs rtag ...")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2836 (if (cvs-execute-list marked
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2837 cvs-program
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2838 (append (if cvs-cvsroot (list "-d" cvs-cvsroot))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2839 (list "rtag")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2840 cvs-rtag-flags
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2841 rtag-args
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2842 (list module-name))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2843 "Running cvs rtag %s...")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2844 (error "CVS rtag exited with non-zero exit status.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2845 (message "Running cvs rtag ... Done."))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2846
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2847 ;;----------
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2848 (defun cvs-mode-byte-compile-files ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2849 "Run byte-compile-file on all selected files that end in '.el'."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2850
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2851 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2852 (let ((marked (cvs-get-marked)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2853 (while marked
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2854 (let ((filename (cvs-full-path (car marked))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2855 (if (string-match "\\.el$" filename)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2856 (byte-compile-file filename)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2857 (setq marked (cdr marked)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2858
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2859 ;;----------
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2860 (defun cvs-insert-full-path (tin)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2861 "Insert full path to the file described in TIN in the current buffer."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2862
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2863 (insert (format "%s\n" (cvs-full-path tin))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2864
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2865 ;;----------
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2866 (defun cvs-mode-add-change-log-entry-other-window (pos)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2867 "Add a ChangeLog entry in the ChangeLog of the current directory.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2868 Args: POS."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2869
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2870 (interactive "d")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2871 (let* ((cvs-buf (current-buffer))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2872 (odir default-directory)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2873 (obfname buffer-file-name)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2874 (tin (tin-locate cvs-cookie-handle pos))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2875 (fileinfo (tin-cookie cvs-cookie-handle tin))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2876 (fname (cvs-fileinfo->file-name fileinfo))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2877 (dname (file-name-as-directory (cvs-fileinfo->dir fileinfo))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2878 (setq change-log-default-name nil) ; this rarely correct in 19.28
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2879 (setq buffer-file-name (cond (fname
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2880 fname)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2881 (t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2882 nil)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2883 (setq default-directory (cond (dname
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2884 dname)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2885 (t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2886 odir)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2887 (add-change-log-entry-other-window)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2888 (set-buffer cvs-buf)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2889 (setq default-directory odir)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2890 (setq buffer-file-name obfname)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2891
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2892 ;;----------
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2893 (defun print-cvs-tin (foo)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2894 "Debug utility."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2895
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2896 (let ((cookie (tin-cookie cvs-cookie-handle foo))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2897 (stream (get-buffer-create "pcl-cvs-debug")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2898 (princ "==============\n" stream)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2899 (princ (cvs-fileinfo->file-name cookie) stream)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2900 (princ "\n" stream)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2901 (princ (cvs-fileinfo->dir cookie) stream)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2902 (princ "\n" stream)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2903 (princ (cvs-fileinfo->full-log cookie) stream)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2904 (princ "\n" stream)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2905 (princ (cvs-fileinfo->marked cookie) stream)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2906 (princ "\n" stream)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2907
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2908 ;;----------
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2909 ;; NOTE: the variable cvs-emerge-tmp-head-file will be "free" when compiling
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2910 (defun cvs-mode-emerge (pos)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2911 "Emerge appropriate revisions of the selected file.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2912 Args: POS."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2913
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2914 (interactive "d")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2915 (let* ((cvs-buf (current-buffer))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2916 (tin (tin-locate cvs-cookie-handle pos)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2917 (if (boundp 'cvs-emerge-tmp-head-file)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2918 (error "There can only be one emerge session active at a time."))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2919 (if tin
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2920 (let* ((fileinfo (tin-cookie cvs-cookie-handle tin))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2921 (type (cvs-fileinfo->type fileinfo)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2922 (cond
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2923 ((eq type 'MODIFIED) ; merge repository head rev. with working file
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2924 (require 'emerge)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2925 (setq cvs-emerge-tmp-head-file ; trick to prevent multiple runs
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2926 (cvs-retrieve-revision-to-tmpfile fileinfo))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2927 (unwind-protect
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2928 (if (not (emerge-files
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2929 t ; arg
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2930 (cvs-fileinfo->full-path fileinfo) ; file-A
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2931 ;; this is an un-avoidable compiler reference to a free variable
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2932 cvs-emerge-tmp-head-file ; file-B
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2933 (cvs-fileinfo->full-path fileinfo) ; file-out
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2934 nil ; start-hooks
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2935 '(lambda () ; quit-hooks
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2936 (delete-file cvs-emerge-tmp-head-file)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2937 (makunbound 'cvs-emerge-tmp-head-file))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2938 (error "Emerge session failed"))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2939
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2940 ;; re-do the same merge rcsmerge supposedly just did....
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2941 ((or (eq type 'MERGED)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2942 (eq type 'CONFLICT)) ; merge backup-working=A, head=B, base=ancestor
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2943 (require 'emerge)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2944 (setq cvs-emerge-tmp-head-file ; trick to prevent multiple runs
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2945 (cvs-retrieve-revision-to-tmpfile fileinfo
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2946 (cvs-fileinfo->head-revision
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2947 fileinfo)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2948 (let ((cvs-emerge-tmp-backup-working-file
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2949 (cvs-fileinfo->backup-file fileinfo))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2950 (cvs-emerge-tmp-ancestor-file
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2951 (cvs-retrieve-revision-to-tmpfile fileinfo
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2952 (cvs-fileinfo->base-revision
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2953 fileinfo))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2954 (unwind-protect
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2955 (if (not (emerge-files-with-ancestor
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2956 t ; arg
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2957 cvs-emerge-tmp-backup-working-file ; file-A
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2958 ;; this is an un-avoidable compiler reference to a free variable
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2959 cvs-emerge-tmp-head-file ; file-B
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2960 cvs-emerge-tmp-ancestor-file ; file-ancestor
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2961 (cvs-fileinfo->full-path fileinfo) ; file-out
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2962 nil ; start-hooks
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2963 '(lambda () ; quit-hooks
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2964 (delete-file cvs-emerge-tmp-backup-file)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2965 (delete-file cvs-emerge-tmp-ancestor-file)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2966 (delete-file cvs-emerge-tmp-head-file)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2967 (makunbound 'cvs-emerge-tmp-head-file))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2968 (error "Emerge session failed")))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2969 (t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2970 (error "Can only e-merge \"Modified\", \"Merged\" or \"Conflict\" files"))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2971 (error "There is no file to e-merge."))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2972
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2973 ;;----------
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2974 ;; NOTE: the variable ediff-version may be "free" when compiling
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2975 (defun cvs-mode-ediff (pos)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2976 "Ediff appropriate revisions of the selected file.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2977 Args: POS."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2978
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2979 (interactive "d")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2980 (if (boundp 'cvs-ediff-tmp-head-file)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2981 (error "There can only be one ediff session active at a time."))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2982 (require 'ediff)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2983 (if (and (boundp 'ediff-version)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2984 (>= (string-to-number ediff-version) 2.0)) ; FIXME real number?
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2985 (run-ediff-from-cvs-buffer pos)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2986 (cvs-old-ediff-interface pos)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2987
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2988 (defun cvs-old-ediff-interface (pos)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2989 "Emerge like interface for older ediffs.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2990 Args: POS"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2991
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2992 (let* ((cvs-buf (current-buffer))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2993 (tin (tin-locate cvs-cookie-handle pos)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2994 (if tin
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2995 (let* ((fileinfo (tin-cookie cvs-cookie-handle tin))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2996 (type (cvs-fileinfo->type fileinfo)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2997 (cond
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2998 ((eq type 'MODIFIED) ; diff repository head rev. with working file
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2999 ;; should this be inside the unwind-protect, and should the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3000 ;; makeunbound be an unwindform?
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3001 (setq cvs-ediff-tmp-head-file ; trick to prevent multiple runs
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3002 (cvs-retrieve-revision-to-tmpfile fileinfo))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3003 (unwind-protect
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3004 (if (not (ediff-files ; check correct ordering of args
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3005 (cvs-fileinfo->full-path fileinfo) ; file-A
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3006 ;; this is an un-avoidable compiler reference to a free variable
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3007 cvs-ediff-tmp-head-file ; file-B
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3008 '(lambda () ; startup-hooks
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3009 (make-local-hook 'ediff-cleanup-hooks)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3010 (add-hook 'ediff-cleanup-hooks
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3011 '(lambda ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3012 (ediff-janitor)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3013 (delete-file cvs-ediff-tmp-head-file)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3014 (makunbound 'cvs-ediff-tmp-head-file))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3015 nil t))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3016 (error "Ediff session failed"))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3017
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3018 ;; look at the merge rcsmerge supposedly just did....
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3019 ((or (eq type 'MERGED)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3020 (eq type 'CONFLICT)) ; diff backup-working=A, head=B, base=ancestor
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3021 (if (not (boundp 'ediff-version))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3022 (error "ediff version way too old for 3-way diff"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3023 (if (<= (string-to-number ediff-version) 1.9) ; FIXME real number?
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3024 (error "ediff version %s too old for 3-way diff" ediff-version))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3025 (setq cvs-ediff-tmp-head-file ; trick to prevent multiple runs
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3026 (cvs-retrieve-revision-to-tmpfile fileinfo
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3027 (cvs-fileinfo->head-revision
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3028 fileinfo)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3029 (let ((cvs-ediff-tmp-backup-working-file
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3030 (cvs-fileinfo->backup-file fileinfo))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3031 (cvs-ediff-tmp-ancestor-file
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3032 (cvs-retrieve-revision-to-tmpfile fileinfo
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3033 (cvs-fileinfo->base-revision
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3034 fileinfo))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3035 (unwind-protect
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3036 (if (not (ediff-files3 ; check correct ordering of args
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3037 cvs-ediff-tmp-backup-working-file ; file-A
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3038 ;; this is an un-avoidable compiler reference to a free variable
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3039 cvs-ediff-tmp-head-file ; file-B
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3040 cvs-ediff-tmp-ancestor-file ; file-ancestor
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3041 '(lambda () ; start-hooks
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3042 (make-local-hook 'ediff-cleanup-hooks)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3043 (add-hook 'ediff-cleanup-hooks
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3044 '(lambda ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3045 (ediff-janitor)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3046 (delete-file cvs-ediff-tmp-backup-file)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3047 (delete-file cvs-ediff-tmp-ancestor-file)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3048 (delete-file cvs-ediff-tmp-head-file)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3049 (makunbound 'cvs-ediff-tmp-head-file))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3050 nil t))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3051 (error "Ediff session failed")))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3052
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3053 ((not (or (eq type 'UNKNOWN)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3054 (eq type 'UNKNOWN-DIR))) ; i.e. UPDATED or PATCHED ????
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3055 ;; this should really diff the current working file with the previous
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3056 ;; rev. on the current branch (i.e. not the head, since that's what
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3057 ;; the current file should be)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3058 (setq cvs-ediff-tmp-head-file ; trick to prevent multiple runs
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3059 (cvs-retrieve-revision-to-tmpfile fileinfo
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3060 (read-string "Rev #/tag to diff against: "
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3061 (cvs-fileinfo->head-revision
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3062 fileinfo))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3063 (unwind-protect
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3064 (if (not (ediff-files ; check correct ordering of args
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3065 (cvs-fileinfo->full-path fileinfo) ; file-A
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3066 ;; this is an un-avoidable compiler reference to a free variable
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3067 cvs-ediff-tmp-head-file ; file-B
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3068 '(lambda () ; startup-hooks
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3069 (make-local-hook 'ediff-cleanup-hooks)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3070 (add-hook 'ediff-cleanup-hooks
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3071 '(lambda ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3072 (ediff-janitor)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3073 (delete-file cvs-ediff-tmp-head-file)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3074 (makunbound 'cvs-ediff-tmp-head-file))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3075 nil t))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3076 (error "Ediff session failed"))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3077 (t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3078 (error "Can not ediff \"Unknown\" files"))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3079 (error "There is no file to ediff."))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3080
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3081 ;;----------
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3082 (defun cvs-retrieve-revision-to-tmpfile (fileinfo &optional revision)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3083 "Retrieve the latest revision of the file in FILEINFO to a temporary file.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3084 If second optional argument REVISION is given, retrieve that revision instead."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3085
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3086 (let
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3087 ((temp-name (make-temp-name
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3088 (concat (file-name-as-directory
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3089 (or (getenv "TMPDIR") "/tmp"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3090 "pcl-cvs." revision))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3091 (cvs-kill-buffer-visiting temp-name)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3092 (if (and revision
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3093 (stringp revision)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3094 (not (string= revision "")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3095 (message "Retrieving revision %s..." revision)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3096 (message "Retrieving latest revision..."))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3097 (let ((res (call-process cvs-shell nil nil nil "-c"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3098 (concat cvs-program " update -p "
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3099 (if (and revision
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3100 (stringp revision)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3101 (not (string= revision "")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3102 (concat "-r " revision " ")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3103 "")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3104 (cvs-fileinfo->full-path fileinfo)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3105 " > " temp-name))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3106 (if (and res (not (and (integerp res) (zerop res))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3107 (error "Something went wrong retrieving revision %s: %s"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3108 revision res))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3109
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3110 (if revision
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3111 (message "Retrieving revision %s... Done." revision)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3112 (message "Retrieving latest revision... Done."))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3113 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3114 (set-buffer (find-file-noselect temp-name))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3115 (rename-buffer (concat " " (file-name-nondirectory temp-name)) t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3116 temp-name)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3117
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3118 ;;----------
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3119 (defun cvs-kill-buffer-visiting (filename)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3120 "If there is any buffer visiting FILENAME, kill it (without confirmation)."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3121
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3122 (let ((l (buffer-list)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3123 (while l
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3124 (if (string= (buffer-file-name (car l)) filename)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3125 (kill-buffer (car l)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3126 (setq l (cdr l)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3127
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3128 ;;----------
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3129 (defun cvs-change-cvsroot ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3130 "Ask for a new cvsroot."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3131
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3132 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3133 (cvs-set-cvsroot (read-file-name "New CVSROOT: " cvs-cvsroot)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3134
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3135 ;;----------
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3136 (defun cvs-set-cvsroot (newroot)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3137 "Change the cvsroot."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3138
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3139 (if (or (file-directory-p (expand-file-name "CVSROOT" newroot))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3140 (y-or-n-p (concat "Warning: no CVSROOT found inside repository."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3141 " Change cvs-cvsroot anyhow?")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3142 (setq cvs-cvsroot newroot)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3143
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3144 ;;----------
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3145 (defun cvs-set-diff-flags ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3146 "Ask for new setting of cvs-diff-flags."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3147
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3148 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3149 (let ((old-value (mapconcat 'identity
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3150 (copy-sequence cvs-diff-flags) " ")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3151 (setq cvs-diff-flags
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3152 (cvs-make-list (read-string "Diff flags: " old-value)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3153
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3154 ;;----------
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3155 (defun cvs-set-update-optional-flags ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3156 "Ask for new setting of cvs-update-optional-flags."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3157
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3158 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3159 (let ((old-value (mapconcat 'identity
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3160 (copy-sequence cvs-update-optional-flags) " ")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3161 (setq cvs-update-optional-flags
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3162 (cvs-make-list (read-string "Update optional flags: " old-value)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3163
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3164 ;;----------
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3165 (defun cvs-set-status-flags ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3166 "Ask for new setting of cvs-status-flags."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3167
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3168 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3169 (let ((old-value (mapconcat 'identity
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3170 (copy-sequence cvs-status-flags) " ")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3171 (setq cvs-status-flags
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3172 (cvs-make-list (read-string "Status flags: " old-value)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3173
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3174 ;;----------
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3175 (defun cvs-set-log-flags ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3176 "Ask for new setting of cvs-log-flags."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3177
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3178 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3179 (let ((old-value (mapconcat 'identity
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3180 (copy-sequence cvs-log-flags) " ")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3181 (setq cvs-log-flags
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3182 (cvs-make-list (read-string "Log flags: " old-value)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3183
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3184 ;;----------
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3185 (defun cvs-set-tag-flags ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3186 "Ask for new setting of cvs-tag-flags."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3187
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3188 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3189 (let ((old-value (mapconcat 'identity
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3190 (copy-sequence cvs-tag-flags) " ")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3191 (setq cvs-tag-flags
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3192 (cvs-make-list (read-string "Tag flags: " old-value)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3193
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3194 ;;----------
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3195 (defun cvs-set-rtag-flags ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3196 "Ask for new setting of cvs-rtag-flags."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3197
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3198 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3199 (let ((old-value (mapconcat 'identity
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3200 (copy-sequence cvs-rtag-flags) " ")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3201 (setq cvs-rtag-flags
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3202 (cvs-make-list (read-string "Rtag flags: " old-value)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3203
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3204 ;;----------
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3205 (if (string-match "XEmacs" emacs-version)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3206 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3207 ;; now marked to autload in pcl-cvs-xemacs
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3208 ;(autoload 'pcl-cvs-fontify "pcl-cvs-xemacs")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3209 (add-hook 'cvs-mode-hook 'pcl-cvs-fontify)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3210
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3211 (defun cvs-changelog-name (directory)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3212 "Return the name of the ChangeLog file that handles DIRECTORY.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3213 This is in DIRECTORY or one of its parents.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3214 Signal an error if we can't find an appropriate ChangeLog file."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3215 (let ((dir (file-name-as-directory directory))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3216 file)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3217 (while (and dir
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3218 (not (file-exists-p
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3219 (setq file (expand-file-name "ChangeLog" dir)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3220 (let ((last dir))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3221 (setq dir (file-name-directory (directory-file-name dir)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3222 (if (equal last dir)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3223 (setq dir nil))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3224 (or dir
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3225 (error "Can't find ChangeLog for %s" directory))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3226 file))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3227
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3228 (defun cvs-narrow-changelog ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3229 "Narrow to the top page of the current buffer, a ChangeLog file.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3230 Actually, the narrowed region doesn't include the date line.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3231 A \"page\" in a ChangeLog file is the area between two dates."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3232 (or (eq major-mode 'change-log-mode)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3233 (error "cvs-narrow-changelog: current buffer isn't a ChangeLog"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3234
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3235 (goto-char (point-min))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3236
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3237 ;; Skip date line and subsequent blank lines.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3238 (forward-line 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3239 (if (looking-at "[ \t\n]*\n")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3240 (goto-char (match-end 0)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3241
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3242 (let ((start (point)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3243 (forward-page 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3244 (narrow-to-region start (point))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3245 (goto-char (point-min))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3246
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3247 (defun cvs-changelog-paragraph ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3248 "Return the bounds of the ChangeLog paragraph containing point.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3249 If we are between paragraphs, return the previous paragraph."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3250 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3251 (beginning-of-line)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3252 (if (looking-at "^[ \t]*$")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3253 (skip-chars-backward " \t\n" (point-min)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3254 (list (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3255 (if (re-search-backward "^[ \t]*\n" nil 'or-to-limit)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3256 (goto-char (match-end 0)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3257 (point))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3258 (if (re-search-forward "^[ \t\n]*$" nil t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3259 (match-beginning 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3260 (point)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3261
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3262 (defun cvs-changelog-subparagraph ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3263 "Return the bounds of the ChangeLog subparagraph containing point.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3264 A subparagraph is a block of non-blank lines beginning with an asterisk.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3265 If we are between sub-paragraphs, return the previous subparagraph."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3266 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3267 (end-of-line)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3268 (if (search-backward "*" nil t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3269 (list (progn (beginning-of-line) (point))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3270 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3271 (forward-line 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3272 (if (re-search-forward "^[ \t]*[\n*]" nil t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3273 (match-beginning 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3274 (point-max))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3275 (list (point) (point)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3276
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3277 (defun cvs-changelog-entry ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3278 "Return the bounds of the ChangeLog entry containing point.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3279 The variable `cvs-changelog-full-paragraphs' decides whether an
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3280 \"entry\" is a paragraph or a subparagraph; see its documentation string
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3281 for more details."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3282 (if cvs-changelog-full-paragraphs
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3283 (cvs-changelog-paragraph)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3284 (cvs-changelog-subparagraph)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3285
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3286 ;; NOTE: the variable user-full-name may be "free" when compiling
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3287 (defun cvs-changelog-ours-p ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3288 "See if ChangeLog entry at point is for the current user, today.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3289 Return non-nil iff it is."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3290 ;; Code adapted from add-change-log-entry.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3291 (looking-at (concat (regexp-quote (substring (current-time-string)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3292 0 10))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3293 ".* "
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3294 (regexp-quote (substring (current-time-string) -4))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3295 "[ \t]+"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3296 (regexp-quote (if (and (boundp 'add-log-full-name)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3297 add-log-full-name)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3298 add-log-full-name
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3299 user-full-name))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3300 " <"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3301 (regexp-quote (if (and (boundp 'add-log-mailing-address)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3302 add-log-mailing-address)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3303 add-log-mailing-address
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3304 user-mail-address)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3305
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3306 (defun cvs-relative-path (base child)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3307 "Return a directory path relative to BASE for CHILD.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3308 If CHILD doesn't seem to be in a subdirectory of BASE, just return
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3309 the full path to CHILD."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3310 (let ((base (file-name-as-directory (expand-file-name base)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3311 (child (expand-file-name child)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3312 (or (string= base (substring child 0 (length base)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3313 (error "cvs-relative-path: %s isn't in %s" child base))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3314 (substring child (length base))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3315
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3316 (defun cvs-changelog-entries (file)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3317 "Return the ChangeLog entries for FILE, and the ChangeLog they came from.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3318 The return value looks like this:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3319 (LOGBUFFER (ENTRYSTART . ENTRYEND) ...)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3320 where LOGBUFFER is the name of the ChangeLog buffer, and each
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3321 \(ENTRYSTART . ENTRYEND\) pair is a buffer region."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3322 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3323 (set-buffer (find-file-noselect
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3324 (cvs-changelog-name
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3325 (file-name-directory
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3326 (expand-file-name file)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3327 (or (eq major-mode 'change-log-mode)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3328 (change-log-mode))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3329 (goto-char (point-min))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3330 (if (looking-at "[ \t\n]*\n")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3331 (goto-char (match-end 0)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3332 (if (not (cvs-changelog-ours-p))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3333 (list (current-buffer))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3334 (save-restriction
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3335 (cvs-narrow-changelog)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3336 (goto-char (point-min))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3337
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3338 ;; Search for the name of FILE relative to the ChangeLog. If that
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3339 ;; doesn't occur anywhere, they're not using full relative
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3340 ;; filenames in the ChangeLog, so just look for FILE; we'll accept
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3341 ;; some false positives.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3342 (let ((pattern (cvs-relative-path
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3343 (file-name-directory buffer-file-name) file)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3344 (if (or (string= pattern "")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3345 (not (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3346 (search-forward pattern nil t))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3347 (setq pattern file))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3348
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3349 (let (texts)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3350 (while (search-forward pattern nil t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3351 (let ((entry (cvs-changelog-entry)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3352 (setq texts (cons entry texts))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3353 (goto-char (elt entry 1))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3354
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3355 (cons (current-buffer) texts)))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3356
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3357 (defun cvs-changelog-insert-entries (buffer regions)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3358 "Insert those regions in BUFFER specified in REGIONS.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3359 Sort REGIONS front-to-back first."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3360 (let ((regions (sort regions 'car-less-than-car))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3361 (last))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3362 (while regions
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3363 (if (and last (< last (car (car regions))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3364 (newline))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3365 (setq last (elt (car regions) 1))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3366 (apply 'insert-buffer-substring buffer (car regions))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3367 (setq regions (cdr regions)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3368
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3369 (defun cvs-union (set1 set2)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3370 "Return the union of SET1 and SET2, according to `equal'."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3371 (while set2
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3372 (or (member (car set2) set1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3373 (setq set1 (cons (car set2) set1)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3374 (setq set2 (cdr set2)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3375 set1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3376
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3377 (defun cvs-insert-changelog-entries (files)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3378 "Given a list of files FILES, insert the ChangeLog entries for them."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3379 (let ((buffer-entries nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3380
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3381 ;; Add each buffer to buffer-entries, and associate it with the list
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3382 ;; of entries we want from that file.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3383 (while files
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3384 (let* ((entries (cvs-changelog-entries (car files)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3385 (pair (assq (car entries) buffer-entries)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3386 (if pair
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3387 (setcdr pair (cvs-union (cdr pair) (cdr entries)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3388 (setq buffer-entries (cons entries buffer-entries))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3389 (setq files (cdr files)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3390
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3391 ;; Now map over each buffer in buffer-entries, sort the entries for
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3392 ;; each buffer, and extract them as strings.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3393 (while buffer-entries
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3394 (cvs-changelog-insert-entries (car (car buffer-entries))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3395 (cdr (car buffer-entries)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3396 (if (and (cdr buffer-entries) (cdr (car buffer-entries)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3397 (newline))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3398 (setq buffer-entries (cdr buffer-entries)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3399
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3400 (defun cvs-edit-delete-common-indentation ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3401 "Unindent the current buffer rigidly until at least one line is flush left."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3402 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3403 (let ((common 100000))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3404 (goto-char (point-min))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3405 (while (< (point) (point-max))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3406 (if (not (looking-at "^[ \t]*$"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3407 (setq common (min common (current-indentation))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3408 (forward-line 1))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3409 (indent-rigidly (point-min) (point-max) (- common)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3410
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3411 (defun cvs-mode-changelog-commit ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3412 "Check in all marked files, or the current file.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3413 Ask the user for a log message in a buffer.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3414
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3415 This is just like `\\[cvs-mode-commit]', except that it tries to provide
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3416 appropriate default log messages by looking at the ChangeLog. The
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3417 idea is to write your ChangeLog entries first, and then use this
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3418 command to commit your changes.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3419
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3420 To select default log text, we:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3421 - find the ChangeLog entries for the files to be checked in,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3422 - verify that the top entry in the ChangeLog is on the current date
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3423 and by the current user; if not, we don't provide any default text,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3424 - search the ChangeLog entry for paragraphs containing the names of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3425 the files we're checking in, and finally
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3426 - use those paragraphs as the log text."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3427
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3428 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3429
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3430 (let* ((cvs-buf (current-buffer))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3431 (marked (cvs-filter (function cvs-committable)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3432 (cvs-get-marked))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3433 (if (null marked)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3434 (error "Nothing to commit!")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3435 (pop-to-buffer (get-buffer-create cvs-commit-prompt-buffer))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3436 (goto-char (point-min))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3437
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3438 (erase-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3439 (cvs-insert-changelog-entries
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3440 (mapcar (lambda (tin)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3441 (let ((cookie (tin-cookie cvs-cookie-handle tin)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3442 (expand-file-name
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3443 (cvs-fileinfo->file-name cookie)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3444 (cvs-fileinfo->dir cookie))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3445 marked))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3446 (cvs-edit-delete-common-indentation)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3447
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3448 (cvs-edit-mode)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3449 (make-local-variable 'cvs-commit-list)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3450 (setq cvs-commit-list marked)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3451 (message "Press C-c C-c when you are done editing."))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3452
10
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 0
diff changeset
3453 (provide 'pcl-cvs)
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 0
diff changeset
3454
49a24b4fd526 Import from CVS: tag r19-15b6
cvs
parents: 0
diff changeset
3455 ;;; pcl-cvs.el ends here