annotate lisp/vc-cvs.el @ 33980:3aa61201a0ab

(comment-indent): Save excursion around call to comment-indent-function.
author Stefan Monnier <monnier@iro.umontreal.ca>
date Wed, 29 Nov 2000 05:11:01 +0000
parents 6cab2125de9c
children 78bce41f17c5
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
31384
f6cb7dfe5e7c (vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1 ;;; vc-cvs.el --- non-resident support for CVS version-control
f6cb7dfe5e7c (vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
2
f6cb7dfe5e7c (vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
3 ;; Copyright (C) 1995,98,99,2000 Free Software Foundation, Inc.
f6cb7dfe5e7c (vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
4
f6cb7dfe5e7c (vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
5 ;; Author: FSF (see vc.el for full credits)
f6cb7dfe5e7c (vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
6 ;; Maintainer: Andre Spiegel <spiegel@gnu.org>
f6cb7dfe5e7c (vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
7
33637
6cab2125de9c (vc-cvs-checkout): Fix bug that broke C-x v ~-style checkouts.
André Spiegel <spiegel@gnu.org>
parents: 33560
diff changeset
8 ;; $Id: vc-cvs.el,v 1.12 2000/11/16 18:10:52 spiegel Exp $
31384
f6cb7dfe5e7c (vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
9
f6cb7dfe5e7c (vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
10 ;; This file is part of GNU Emacs.
f6cb7dfe5e7c (vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
11
f6cb7dfe5e7c (vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
12 ;; GNU Emacs is free software; you can redistribute it and/or modify
f6cb7dfe5e7c (vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
13 ;; it under the terms of the GNU General Public License as published by
f6cb7dfe5e7c (vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
14 ;; the Free Software Foundation; either version 2, or (at your option)
f6cb7dfe5e7c (vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
15 ;; any later version.
f6cb7dfe5e7c (vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
16
f6cb7dfe5e7c (vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
17 ;; GNU Emacs is distributed in the hope that it will be useful,
f6cb7dfe5e7c (vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
18 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
f6cb7dfe5e7c (vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
19 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
f6cb7dfe5e7c (vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
20 ;; GNU General Public License for more details.
f6cb7dfe5e7c (vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
21
f6cb7dfe5e7c (vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
22 ;; You should have received a copy of the GNU General Public License
f6cb7dfe5e7c (vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
23 ;; along with GNU Emacs; see the file COPYING. If not, write to the
f6cb7dfe5e7c (vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
24 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
f6cb7dfe5e7c (vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
25 ;; Boston, MA 02111-1307, USA.
f6cb7dfe5e7c (vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
26
f6cb7dfe5e7c (vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
27 ;;; Commentary:
f6cb7dfe5e7c (vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
28
f6cb7dfe5e7c (vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
29 ;;; Code:
f6cb7dfe5e7c (vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
30
33560
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
31 ;;;
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
32 ;;; Customization options
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
33 ;;;
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
34
31384
f6cb7dfe5e7c (vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
35 (defcustom vc-cvs-register-switches nil
f6cb7dfe5e7c (vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
36 "*Extra switches for registering a file into CVS.
f6cb7dfe5e7c (vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
37 A string or list of strings passed to the checkin program by
f6cb7dfe5e7c (vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
38 \\[vc-register]."
f6cb7dfe5e7c (vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
39 :type '(choice (const :tag "None" nil)
f6cb7dfe5e7c (vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
40 (string :tag "Argument String")
f6cb7dfe5e7c (vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
41 (repeat :tag "Argument List"
f6cb7dfe5e7c (vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
42 :value ("")
f6cb7dfe5e7c (vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
43 string))
31475
b25e22223eb9 DOc fixes.
Dave Love <fx@gnu.org>
parents: 31404
diff changeset
44 :version "21.1"
31384
f6cb7dfe5e7c (vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
45 :group 'vc)
f6cb7dfe5e7c (vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
46
f6cb7dfe5e7c (vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
47 (defcustom vc-cvs-header (or (cdr (assoc 'CVS vc-header-alist)) '("\$Id\$"))
f6cb7dfe5e7c (vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
48 "*Header keywords to be inserted by `vc-insert-headers'."
31475
b25e22223eb9 DOc fixes.
Dave Love <fx@gnu.org>
parents: 31404
diff changeset
49 :version "21.1"
31384
f6cb7dfe5e7c (vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
50 :type 'string
f6cb7dfe5e7c (vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
51 :group 'vc)
f6cb7dfe5e7c (vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
52
f6cb7dfe5e7c (vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
53 (defcustom vc-cvs-use-edit t
f6cb7dfe5e7c (vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
54 "*Non-nil means to use `cvs edit' to \"check out\" a file.
f6cb7dfe5e7c (vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
55 This is only meaningful if you don't use the implicit checkout model
f6cb7dfe5e7c (vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
56 \(i.e. if you have $CVSREAD set)."
f6cb7dfe5e7c (vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
57 :type 'boolean
31475
b25e22223eb9 DOc fixes.
Dave Love <fx@gnu.org>
parents: 31404
diff changeset
58 :version "21.1"
31384
f6cb7dfe5e7c (vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
59 :group 'vc)
f6cb7dfe5e7c (vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
60
f6cb7dfe5e7c (vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
61 (defcustom vc-cvs-stay-local t
31475
b25e22223eb9 DOc fixes.
Dave Love <fx@gnu.org>
parents: 31404
diff changeset
62 "*Non-nil means use local operations when possible for remote repositories.
b25e22223eb9 DOc fixes.
Dave Love <fx@gnu.org>
parents: 31404
diff changeset
63 This avoids slow queries over the network. Turning this option on
b25e22223eb9 DOc fixes.
Dave Love <fx@gnu.org>
parents: 31404
diff changeset
64 will instruct VC to use only heuristics and past information to
b25e22223eb9 DOc fixes.
Dave Love <fx@gnu.org>
parents: 31404
diff changeset
65 determine the current status of a file. The value can also be a
b25e22223eb9 DOc fixes.
Dave Love <fx@gnu.org>
parents: 31404
diff changeset
66 regular expression to match against the host name of a repository;
b25e22223eb9 DOc fixes.
Dave Love <fx@gnu.org>
parents: 31404
diff changeset
67 then VC only stays local for hosts that match it."
31384
f6cb7dfe5e7c (vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
68 :type '(choice (const :tag "Always stay local" t)
f6cb7dfe5e7c (vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
69 (string :tag "Host regexp")
f6cb7dfe5e7c (vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
70 (const :tag "Don't stay local" nil))
31475
b25e22223eb9 DOc fixes.
Dave Love <fx@gnu.org>
parents: 31404
diff changeset
71 :version "21.1"
31384
f6cb7dfe5e7c (vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
72 :group 'vc)
f6cb7dfe5e7c (vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
73
33560
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
74
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
75 ;;;
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
76 ;;; Internal variables
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
77 ;;;
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
78
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
79 (defvar vc-cvs-local-month-numbers
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
80 '(("Jan" . 1) ("Feb" . 2) ("Mar" . 3) ("Apr" . 4)
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
81 ("May" . 5) ("Jun" . 6) ("Jul" . 7) ("Aug" . 8)
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
82 ("Sep" . 9) ("Oct" . 10) ("Nov" . 11) ("Dec" . 12))
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
83 "Local association list of month numbers.")
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
84
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
85
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
86 ;;;
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
87 ;;; State-querying functions
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
88 ;;;
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
89
31384
f6cb7dfe5e7c (vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
90 ;;;###autoload (defun vc-cvs-registered (f)
f6cb7dfe5e7c (vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
91 ;;;###autoload (when (file-readable-p (expand-file-name
f6cb7dfe5e7c (vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
92 ;;;###autoload "CVS/Entries" (file-name-directory f)))
f6cb7dfe5e7c (vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
93 ;;;###autoload (require 'vc-cvs)
f6cb7dfe5e7c (vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
94 ;;;###autoload (vc-cvs-registered f)))
f6cb7dfe5e7c (vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
95
f6cb7dfe5e7c (vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
96 (defun vc-cvs-registered (file)
f6cb7dfe5e7c (vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
97 "Check if FILE is CVS registered."
f6cb7dfe5e7c (vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
98 (let ((dirname (or (file-name-directory file) ""))
f6cb7dfe5e7c (vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
99 (basename (file-name-nondirectory file))
f6cb7dfe5e7c (vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
100 ;; make sure that the file name is searched case-sensitively
f6cb7dfe5e7c (vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
101 (case-fold-search nil))
f6cb7dfe5e7c (vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
102 (if (file-readable-p (expand-file-name "CVS/Entries" dirname))
f6cb7dfe5e7c (vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
103 (with-temp-buffer
f6cb7dfe5e7c (vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
104 (vc-insert-file (expand-file-name "CVS/Entries" dirname))
f6cb7dfe5e7c (vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
105 (goto-char (point-min))
31475
b25e22223eb9 DOc fixes.
Dave Love <fx@gnu.org>
parents: 31404
diff changeset
106 (cond
b25e22223eb9 DOc fixes.
Dave Love <fx@gnu.org>
parents: 31404
diff changeset
107 ((re-search-forward
31384
f6cb7dfe5e7c (vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
108 (concat "^/" (regexp-quote basename) "/") nil t)
f6cb7dfe5e7c (vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
109 (beginning-of-line)
f6cb7dfe5e7c (vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
110 (vc-cvs-parse-entry file)
f6cb7dfe5e7c (vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
111 t)
f6cb7dfe5e7c (vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
112 (t nil)))
f6cb7dfe5e7c (vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
113 nil)))
f6cb7dfe5e7c (vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
114
f6cb7dfe5e7c (vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
115 (defun vc-cvs-state (file)
f6cb7dfe5e7c (vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
116 "CVS-specific version of `vc-state'."
f6cb7dfe5e7c (vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
117 (if (vc-cvs-stay-local-p file)
f6cb7dfe5e7c (vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
118 (let ((state (vc-file-getprop file 'vc-state)))
f6cb7dfe5e7c (vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
119 ;; If we should stay local, use the heuristic but only if
f6cb7dfe5e7c (vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
120 ;; we don't have a more precise state already available.
f6cb7dfe5e7c (vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
121 (if (memq state '(up-to-date edited))
f6cb7dfe5e7c (vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
122 (vc-cvs-state-heuristic file)
f6cb7dfe5e7c (vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
123 state))
f6cb7dfe5e7c (vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
124 (with-temp-buffer
f6cb7dfe5e7c (vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
125 (cd (file-name-directory file))
f6cb7dfe5e7c (vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
126 (vc-do-command t 0 "cvs" file "status")
f6cb7dfe5e7c (vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
127 (vc-cvs-parse-status t))))
f6cb7dfe5e7c (vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
128
f6cb7dfe5e7c (vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
129 (defun vc-cvs-state-heuristic (file)
f6cb7dfe5e7c (vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
130 "CVS-specific state heuristic."
f6cb7dfe5e7c (vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
131 ;; If the file has not changed since checkout, consider it `up-to-date'.
f6cb7dfe5e7c (vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
132 ;; Otherwise consider it `edited'.
f6cb7dfe5e7c (vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
133 (let ((checkout-time (vc-file-getprop file 'vc-checkout-time))
f6cb7dfe5e7c (vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
134 (lastmod (nth 5 (file-attributes file))))
f6cb7dfe5e7c (vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
135 (if (equal checkout-time lastmod)
f6cb7dfe5e7c (vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
136 'up-to-date
f6cb7dfe5e7c (vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
137 'edited)))
f6cb7dfe5e7c (vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
138
33560
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
139 (defun vc-cvs-dir-state (dir)
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
140 "Find the CVS state of all files in DIR."
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
141 (if (vc-cvs-stay-local-p dir)
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
142 (vc-cvs-dir-state-heuristic dir)
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
143 (let ((default-directory dir))
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
144 ;; Don't specify DIR in this command, the default-directory is
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
145 ;; enough. Otherwise it might fail with remote repositories.
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
146 (with-temp-buffer
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
147 (vc-do-command t 0 "cvs" nil "status" "-l")
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
148 (goto-char (point-min))
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
149 (while (re-search-forward "^=+\n\\([^=\n].*\n\\|\n\\)+" nil t)
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
150 (narrow-to-region (match-beginning 0) (match-end 0))
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
151 (vc-cvs-parse-status)
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
152 (goto-char (point-max))
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
153 (widen))))))
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
154
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
155 (defun vc-cvs-workfile-version (file)
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
156 "CVS-specific version of `vc-workfile-version'."
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
157 ;; There is no need to consult RCS headers under CVS, because we
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
158 ;; get the workfile version for free when we recognize that a file
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
159 ;; is registered in CVS.
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
160 (vc-cvs-registered file)
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
161 (vc-file-getprop file 'vc-workfile-version))
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
162
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
163 (defun vc-cvs-latest-on-branch-p (file)
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
164 "Return t iff current workfile version of FILE is the latest on its branch."
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
165 ;; Since this is only used as a sanity check for vc-cancel-version,
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
166 ;; and that is not supported under CVS at all, we can safely return t here.
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
167 ;; TODO: Think of getting rid of this altogether.
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
168 t)
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
169
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
170 (defun vc-cvs-checkout-model (file)
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
171 "CVS-specific version of `vc-checkout-model'."
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
172 (if (or (getenv "CVSREAD")
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
173 ;; If the file is not writable (despite CVSREAD being
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
174 ;; undefined), this is probably because the file is being
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
175 ;; "watched" by other developers.
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
176 ;; (If vc-mistrust-permissions was t, we actually shouldn't
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
177 ;; trust this, but there is no other way to learn this from CVS
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
178 ;; at the moment (version 1.9).)
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
179 (string-match "r-..-..-." (nth 8 (file-attributes file))))
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
180 'announce
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
181 'implicit))
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
182
31404
f2ab9420390f 2000-09-05 Stefan Monnier <monnier@cs.yale.edu>
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 31384
diff changeset
183 (defun vc-cvs-mode-line-string (file)
f2ab9420390f 2000-09-05 Stefan Monnier <monnier@cs.yale.edu>
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 31384
diff changeset
184 "Return string for placement into the modeline for FILE.
f2ab9420390f 2000-09-05 Stefan Monnier <monnier@cs.yale.edu>
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 31384
diff changeset
185 Compared to the default implementation, this function handles the
f2ab9420390f 2000-09-05 Stefan Monnier <monnier@cs.yale.edu>
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 31384
diff changeset
186 special case of a CVS file that is added but not yet comitted."
f2ab9420390f 2000-09-05 Stefan Monnier <monnier@cs.yale.edu>
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 31384
diff changeset
187 (let ((state (vc-state file))
f2ab9420390f 2000-09-05 Stefan Monnier <monnier@cs.yale.edu>
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 31384
diff changeset
188 (rev (vc-workfile-version file)))
f2ab9420390f 2000-09-05 Stefan Monnier <monnier@cs.yale.edu>
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 31384
diff changeset
189 (cond ((string= rev "0")
f2ab9420390f 2000-09-05 Stefan Monnier <monnier@cs.yale.edu>
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 31384
diff changeset
190 ;; A file that is added but not yet comitted.
f2ab9420390f 2000-09-05 Stefan Monnier <monnier@cs.yale.edu>
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 31384
diff changeset
191 "CVS @@")
f2ab9420390f 2000-09-05 Stefan Monnier <monnier@cs.yale.edu>
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 31384
diff changeset
192 ((or (eq state 'up-to-date)
f2ab9420390f 2000-09-05 Stefan Monnier <monnier@cs.yale.edu>
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 31384
diff changeset
193 (eq state 'needs-patch))
f2ab9420390f 2000-09-05 Stefan Monnier <monnier@cs.yale.edu>
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 31384
diff changeset
194 (concat "CVS-" rev))
f2ab9420390f 2000-09-05 Stefan Monnier <monnier@cs.yale.edu>
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 31384
diff changeset
195 ((stringp state)
f2ab9420390f 2000-09-05 Stefan Monnier <monnier@cs.yale.edu>
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 31384
diff changeset
196 (concat "CVS:" state ":" rev))
f2ab9420390f 2000-09-05 Stefan Monnier <monnier@cs.yale.edu>
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 31384
diff changeset
197 (t
f2ab9420390f 2000-09-05 Stefan Monnier <monnier@cs.yale.edu>
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 31384
diff changeset
198 ;; Not just for the 'edited state, but also a fallback
f2ab9420390f 2000-09-05 Stefan Monnier <monnier@cs.yale.edu>
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 31384
diff changeset
199 ;; for all other states. Think about different symbols
f2ab9420390f 2000-09-05 Stefan Monnier <monnier@cs.yale.edu>
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 31384
diff changeset
200 ;; for 'needs-patch and 'needs-merge.
f2ab9420390f 2000-09-05 Stefan Monnier <monnier@cs.yale.edu>
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 31384
diff changeset
201 (concat "CVS:" rev)))))
f2ab9420390f 2000-09-05 Stefan Monnier <monnier@cs.yale.edu>
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 31384
diff changeset
202
33560
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
203 (defun vc-cvs-dired-state-info (file)
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
204 "CVS-specific version of `vc-dired-state-info'."
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
205 (let* ((cvs-state (vc-state file))
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
206 (state (cond ((eq cvs-state 'edited) "modified")
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
207 ((eq cvs-state 'needs-patch) "patch")
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
208 ((eq cvs-state 'needs-merge) "merge")
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
209 ;; FIXME: those two states cannot occur right now
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
210 ((eq cvs-state 'unlocked-changes) "conflict")
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
211 ((eq cvs-state 'locally-added) "added")
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
212 )))
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
213 (if state (concat "(" state ")"))))
31384
f6cb7dfe5e7c (vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
214
f6cb7dfe5e7c (vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
215
33560
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
216 ;;;
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
217 ;;; State-changing functions
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
218 ;;;
31384
f6cb7dfe5e7c (vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
219
33560
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
220 (defun vc-cvs-register (file &optional rev comment)
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
221 "Register FILE into the CVS version-control system.
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
222 COMMENT can be used to provide an initial description of FILE.
31384
f6cb7dfe5e7c (vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
223
33560
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
224 `vc-register-switches' and `vc-cvs-register-switches' are passed to
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
225 the CVS command (in that order)."
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
226 (let ((switches (list
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
227 (if (stringp vc-register-switches)
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
228 (list vc-register-switches)
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
229 vc-register-switches)
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
230 (if (stringp vc-cvs-register-switches)
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
231 (list vc-cvs-register-switches)
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
232 vc-cvs-register-switches))))
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
233
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
234 (apply 'vc-do-command nil 0 "cvs" file
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
235 "add"
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
236 (and comment (string-match "[^\t\n ]" comment)
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
237 (concat "-m" comment))
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
238 switches)))
31384
f6cb7dfe5e7c (vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
239
33560
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
240 (defun vc-cvs-responsible-p (file)
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
241 "Return non-nil if CVS thinks it is responsible for FILE."
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
242 (file-directory-p (expand-file-name "CVS"
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
243 (if (file-directory-p file)
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
244 file
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
245 (file-name-directory file)))))
31384
f6cb7dfe5e7c (vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
246
33560
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
247 (defun vc-cvs-could-register (file)
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
248 "Return non-nil if FILE could be registered in CVS.
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
249 This is only possible if CVS is responsible for FILE's directory."
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
250 (vc-cvs-responsible-p file))
31384
f6cb7dfe5e7c (vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
251
f6cb7dfe5e7c (vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
252 (defun vc-cvs-checkin (file rev comment)
f6cb7dfe5e7c (vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
253 "CVS-specific version of `vc-backend-checkin'."
f6cb7dfe5e7c (vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
254 (let ((switches (if (stringp vc-checkin-switches)
f6cb7dfe5e7c (vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
255 (list vc-checkin-switches)
f6cb7dfe5e7c (vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
256 vc-checkin-switches))
f6cb7dfe5e7c (vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
257 status)
f6cb7dfe5e7c (vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
258 ;; explicit check-in to the trunk requires a double check-in (first
f6cb7dfe5e7c (vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
259 ;; unexplicit) (CVS-1.3)
f6cb7dfe5e7c (vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
260 (if (and rev (vc-trunk-p rev))
f6cb7dfe5e7c (vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
261 (apply 'vc-do-command nil 1 "cvs" file
f6cb7dfe5e7c (vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
262 "ci" "-m" "intermediate"
f6cb7dfe5e7c (vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
263 switches))
f6cb7dfe5e7c (vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
264 (setq status (apply 'vc-do-command nil 1 "cvs" file
f6cb7dfe5e7c (vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
265 "ci" (if rev (concat "-r" rev))
f6cb7dfe5e7c (vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
266 (concat "-m" comment)
f6cb7dfe5e7c (vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
267 switches))
f6cb7dfe5e7c (vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
268 (set-buffer "*vc*")
f6cb7dfe5e7c (vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
269 (goto-char (point-min))
32948
3c95af2888f6 (vc-cvs-checkin): Check both status and error message after command.
André Spiegel <spiegel@gnu.org>
parents: 32747
diff changeset
270 (when (not (zerop status))
3c95af2888f6 (vc-cvs-checkin): Check both status and error message after command.
André Spiegel <spiegel@gnu.org>
parents: 32747
diff changeset
271 ;; Check checkin problem.
3c95af2888f6 (vc-cvs-checkin): Check both status and error message after command.
André Spiegel <spiegel@gnu.org>
parents: 32747
diff changeset
272 (cond
3c95af2888f6 (vc-cvs-checkin): Check both status and error message after command.
André Spiegel <spiegel@gnu.org>
parents: 32747
diff changeset
273 ((re-search-forward "Up-to-date check failed" nil t)
3c95af2888f6 (vc-cvs-checkin): Check both status and error message after command.
André Spiegel <spiegel@gnu.org>
parents: 32747
diff changeset
274 (vc-file-setprop file 'vc-state 'needs-merge)
3c95af2888f6 (vc-cvs-checkin): Check both status and error message after command.
André Spiegel <spiegel@gnu.org>
parents: 32747
diff changeset
275 (error (substitute-command-keys
3c95af2888f6 (vc-cvs-checkin): Check both status and error message after command.
André Spiegel <spiegel@gnu.org>
parents: 32747
diff changeset
276 (concat "Up-to-date check failed: "
3c95af2888f6 (vc-cvs-checkin): Check both status and error message after command.
André Spiegel <spiegel@gnu.org>
parents: 32747
diff changeset
277 "type \\[vc-next-action] to merge in changes"))))
3c95af2888f6 (vc-cvs-checkin): Check both status and error message after command.
André Spiegel <spiegel@gnu.org>
parents: 32747
diff changeset
278 (t
3c95af2888f6 (vc-cvs-checkin): Check both status and error message after command.
André Spiegel <spiegel@gnu.org>
parents: 32747
diff changeset
279 (pop-to-buffer (current-buffer))
3c95af2888f6 (vc-cvs-checkin): Check both status and error message after command.
André Spiegel <spiegel@gnu.org>
parents: 32747
diff changeset
280 (goto-char (point-min))
3c95af2888f6 (vc-cvs-checkin): Check both status and error message after command.
André Spiegel <spiegel@gnu.org>
parents: 32747
diff changeset
281 (shrink-window-if-larger-than-buffer)
3c95af2888f6 (vc-cvs-checkin): Check both status and error message after command.
André Spiegel <spiegel@gnu.org>
parents: 32747
diff changeset
282 (error "Check-in failed"))))
31384
f6cb7dfe5e7c (vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
283 ;; Update file properties
f6cb7dfe5e7c (vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
284 (vc-file-setprop
f6cb7dfe5e7c (vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
285 file 'vc-workfile-version
f6cb7dfe5e7c (vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
286 (vc-parse-buffer "^\\(new\\|initial\\) revision: \\([0-9.]+\\)" 2))
f6cb7dfe5e7c (vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
287 ;; Forget the checkout model of the file, because we might have
f6cb7dfe5e7c (vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
288 ;; guessed wrong when we found the file. After commit, we can
f6cb7dfe5e7c (vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
289 ;; tell it from the permissions of the file (see
f6cb7dfe5e7c (vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
290 ;; vc-cvs-checkout-model).
f6cb7dfe5e7c (vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
291 (vc-file-setprop file 'vc-checkout-model nil)
f6cb7dfe5e7c (vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
292 ;; if this was an explicit check-in, remove the sticky tag
f6cb7dfe5e7c (vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
293 (if rev (vc-do-command t 0 "cvs" file "update" "-A"))))
f6cb7dfe5e7c (vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
294
f6cb7dfe5e7c (vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
295 (defun vc-cvs-checkout (file &optional writable rev workfile)
f6cb7dfe5e7c (vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
296 "Retrieve a revision of FILE into a WORKFILE.
f6cb7dfe5e7c (vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
297 WRITABLE non-nil means that the file should be writable.
f6cb7dfe5e7c (vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
298 REV is the revision to check out into WORKFILE."
f6cb7dfe5e7c (vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
299 (let ((filename (or workfile file))
f6cb7dfe5e7c (vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
300 (file-buffer (get-file-buffer file))
f6cb7dfe5e7c (vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
301 switches)
f6cb7dfe5e7c (vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
302 (message "Checking out %s..." filename)
f6cb7dfe5e7c (vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
303 (save-excursion
f6cb7dfe5e7c (vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
304 ;; Change buffers to get local value of vc-checkout-switches.
f6cb7dfe5e7c (vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
305 (if file-buffer (set-buffer file-buffer))
f6cb7dfe5e7c (vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
306 (setq switches (if (stringp vc-checkout-switches)
f6cb7dfe5e7c (vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
307 (list vc-checkout-switches)
f6cb7dfe5e7c (vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
308 vc-checkout-switches))
f6cb7dfe5e7c (vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
309 ;; Save this buffer's default-directory
f6cb7dfe5e7c (vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
310 ;; and use save-excursion to make sure it is restored
f6cb7dfe5e7c (vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
311 ;; in the same buffer it was saved in.
f6cb7dfe5e7c (vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
312 (let ((default-directory default-directory))
f6cb7dfe5e7c (vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
313 (save-excursion
f6cb7dfe5e7c (vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
314 ;; Adjust the default-directory so that the check-out creates
f6cb7dfe5e7c (vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
315 ;; the file in the right place.
f6cb7dfe5e7c (vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
316 (setq default-directory (file-name-directory filename))
f6cb7dfe5e7c (vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
317 (if workfile
33549
8a998774febc (vc-cvs-revert): Use `cvs unedit' only if `vc-cvs-use-edit' is on.
André Spiegel <spiegel@gnu.org>
parents: 33545
diff changeset
318 (let ((failed t)
33637
6cab2125de9c (vc-cvs-checkout): Fix bug that broke C-x v ~-style checkouts.
André Spiegel <spiegel@gnu.org>
parents: 33560
diff changeset
319 (backup-name (if (string= file workfile)
33549
8a998774febc (vc-cvs-revert): Use `cvs unedit' only if `vc-cvs-use-edit' is on.
André Spiegel <spiegel@gnu.org>
parents: 33545
diff changeset
320 (car (find-backup-file-name filename)))))
8a998774febc (vc-cvs-revert): Use `cvs unedit' only if `vc-cvs-use-edit' is on.
André Spiegel <spiegel@gnu.org>
parents: 33545
diff changeset
321 (when backup-name
8a998774febc (vc-cvs-revert): Use `cvs unedit' only if `vc-cvs-use-edit' is on.
André Spiegel <spiegel@gnu.org>
parents: 33545
diff changeset
322 (copy-file filename backup-name
8a998774febc (vc-cvs-revert): Use `cvs unedit' only if `vc-cvs-use-edit' is on.
André Spiegel <spiegel@gnu.org>
parents: 33545
diff changeset
323 'ok-if-already-exists 'keep-date)
8a998774febc (vc-cvs-revert): Use `cvs unedit' only if `vc-cvs-use-edit' is on.
André Spiegel <spiegel@gnu.org>
parents: 33545
diff changeset
324 (unless (file-writable-p filename)
8a998774febc (vc-cvs-revert): Use `cvs unedit' only if `vc-cvs-use-edit' is on.
André Spiegel <spiegel@gnu.org>
parents: 33545
diff changeset
325 (set-file-modes filename
8a998774febc (vc-cvs-revert): Use `cvs unedit' only if `vc-cvs-use-edit' is on.
André Spiegel <spiegel@gnu.org>
parents: 33545
diff changeset
326 (logior (file-modes filename) 128))))
31384
f6cb7dfe5e7c (vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
327 (unwind-protect
f6cb7dfe5e7c (vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
328 (progn
f6cb7dfe5e7c (vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
329 (let ((coding-system-for-read 'no-conversion)
f6cb7dfe5e7c (vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
330 (coding-system-for-write 'no-conversion))
f6cb7dfe5e7c (vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
331 (with-temp-file filename
f6cb7dfe5e7c (vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
332 (apply 'vc-do-command
f6cb7dfe5e7c (vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
333 (current-buffer) 0 "cvs" file
f6cb7dfe5e7c (vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
334 "-Q" ; suppress diagnostic output
f6cb7dfe5e7c (vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
335 "update"
f6cb7dfe5e7c (vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
336 (and rev (not (string= rev ""))
f6cb7dfe5e7c (vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
337 (concat "-r" rev))
f6cb7dfe5e7c (vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
338 "-p"
f6cb7dfe5e7c (vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
339 switches)))
f6cb7dfe5e7c (vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
340 (setq failed nil))
33549
8a998774febc (vc-cvs-revert): Use `cvs unedit' only if `vc-cvs-use-edit' is on.
André Spiegel <spiegel@gnu.org>
parents: 33545
diff changeset
341 (if failed
33637
6cab2125de9c (vc-cvs-checkout): Fix bug that broke C-x v ~-style checkouts.
André Spiegel <spiegel@gnu.org>
parents: 33560
diff changeset
342 (if backup-name
6cab2125de9c (vc-cvs-checkout): Fix bug that broke C-x v ~-style checkouts.
André Spiegel <spiegel@gnu.org>
parents: 33560
diff changeset
343 (rename-file backup-name filename
6cab2125de9c (vc-cvs-checkout): Fix bug that broke C-x v ~-style checkouts.
André Spiegel <spiegel@gnu.org>
parents: 33560
diff changeset
344 'ok-if-already-exists)
6cab2125de9c (vc-cvs-checkout): Fix bug that broke C-x v ~-style checkouts.
André Spiegel <spiegel@gnu.org>
parents: 33560
diff changeset
345 (if (file-exists-p filename)
6cab2125de9c (vc-cvs-checkout): Fix bug that broke C-x v ~-style checkouts.
André Spiegel <spiegel@gnu.org>
parents: 33560
diff changeset
346 (delete-file filename)))
33549
8a998774febc (vc-cvs-revert): Use `cvs unedit' only if `vc-cvs-use-edit' is on.
André Spiegel <spiegel@gnu.org>
parents: 33545
diff changeset
347 (and backup-name
8a998774febc (vc-cvs-revert): Use `cvs unedit' only if `vc-cvs-use-edit' is on.
André Spiegel <spiegel@gnu.org>
parents: 33545
diff changeset
348 (not vc-make-backup-files)
8a998774febc (vc-cvs-revert): Use `cvs unedit' only if `vc-cvs-use-edit' is on.
André Spiegel <spiegel@gnu.org>
parents: 33545
diff changeset
349 (delete-file backup-name)))))
31384
f6cb7dfe5e7c (vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
350 (if (and (file-exists-p file) (not rev))
f6cb7dfe5e7c (vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
351 ;; If no revision was specified, just make the file writable
f6cb7dfe5e7c (vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
352 ;; if necessary (using `cvs-edit' if requested).
f6cb7dfe5e7c (vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
353 (and writable (not (eq (vc-cvs-checkout-model file) 'implicit))
f6cb7dfe5e7c (vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
354 (if vc-cvs-use-edit
f6cb7dfe5e7c (vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
355 (vc-do-command nil 0 "cvs" file "edit")
f6cb7dfe5e7c (vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
356 (set-file-modes file (logior (file-modes file) 128))
f6cb7dfe5e7c (vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
357 (if file-buffer (toggle-read-only -1))))
f6cb7dfe5e7c (vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
358 ;; Check out a particular version (or recreate the file).
f6cb7dfe5e7c (vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
359 (vc-file-setprop file 'vc-workfile-version nil)
f6cb7dfe5e7c (vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
360 (apply 'vc-do-command nil 0 "cvs" file
f6cb7dfe5e7c (vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
361 (and writable
f6cb7dfe5e7c (vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
362 (or (not (file-exists-p file))
31475
b25e22223eb9 DOc fixes.
Dave Love <fx@gnu.org>
parents: 31404
diff changeset
363 (not (eq (vc-cvs-checkout-model file)
31384
f6cb7dfe5e7c (vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
364 'implicit)))
f6cb7dfe5e7c (vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
365 "-w")
f6cb7dfe5e7c (vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
366 "update"
f6cb7dfe5e7c (vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
367 ;; default for verbose checkout: clear the sticky tag so
f6cb7dfe5e7c (vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
368 ;; that the actual update will get the head of the trunk
31475
b25e22223eb9 DOc fixes.
Dave Love <fx@gnu.org>
parents: 31404
diff changeset
369 (if (or (not rev) (string= rev ""))
b25e22223eb9 DOc fixes.
Dave Love <fx@gnu.org>
parents: 31404
diff changeset
370 "-A"
31384
f6cb7dfe5e7c (vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
371 (concat "-r" rev))
31404
f2ab9420390f 2000-09-05 Stefan Monnier <monnier@cs.yale.edu>
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 31384
diff changeset
372 switches))))
31384
f6cb7dfe5e7c (vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
373 (vc-mode-line file)
f6cb7dfe5e7c (vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
374 (message "Checking out %s...done" filename)))))
f6cb7dfe5e7c (vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
375
33560
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
376 (defun vc-cvs-revert (file)
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
377 "Revert FILE to the version it was based on."
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
378 ;; Check out via standard output (caused by the final argument
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
379 ;; FILE below), so that no sticky tag is set.
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
380 (vc-cvs-checkout file nil (vc-workfile-version file) file)
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
381 ;; If "cvs edit" was used to make the file writable,
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
382 ;; call "cvs unedit" now to undo that.
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
383 (if (and (not (eq (vc-cvs-checkout-model file) 'implicit))
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
384 vc-cvs-use-edit)
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
385 (vc-do-command nil 0 "cvs" file "unedit")))
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
386
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
387 (defun vc-cvs-merge (file first-version &optional second-version)
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
388 "Merge changes into current working copy of FILE.
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
389 The changes are between FIRST-VERSION and SECOND-VERSION."
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
390 (vc-do-command nil 0 "cvs" file
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
391 "update" "-kk"
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
392 (concat "-j" first-version)
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
393 (concat "-j" second-version))
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
394 (vc-file-setprop file 'vc-state 'edited)
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
395 (save-excursion
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
396 (set-buffer (get-buffer "*vc*"))
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
397 (goto-char (point-min))
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
398 (if (re-search-forward "conflicts during merge" nil t)
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
399 1 ; signal error
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
400 0))) ; signal success
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
401
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
402 (defun vc-cvs-merge-news (file)
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
403 "Merge in any new changes made to FILE."
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
404 (message "Merging changes into %s..." file)
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
405 (save-excursion
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
406 ;; (vc-file-setprop file 'vc-workfile-version nil)
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
407 (vc-file-setprop file 'vc-checkout-time 0)
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
408 (vc-do-command nil 0 "cvs" file "update")
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
409 ;; Analyze the merge result reported by CVS, and set
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
410 ;; file properties accordingly.
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
411 (set-buffer (get-buffer "*vc*"))
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
412 (goto-char (point-min))
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
413 ;; get new workfile version
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
414 (if (re-search-forward (concat "^Merging differences between "
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
415 "[01234567890.]* and "
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
416 "\\([01234567890.]*\\) into")
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
417 nil t)
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
418 (vc-file-setprop file 'vc-workfile-version (match-string 1))
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
419 (vc-file-setprop file 'vc-workfile-version nil))
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
420 ;; get file status
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
421 (prog1
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
422 (if (eq (buffer-size) 0)
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
423 0 ;; there were no news; indicate success
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
424 (if (re-search-forward
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
425 (concat "^\\([CMUP] \\)?"
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
426 (regexp-quote (file-name-nondirectory file))
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
427 "\\( already contains the differences between \\)?")
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
428 nil t)
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
429 (cond
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
430 ;; Merge successful, we are in sync with repository now
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
431 ((or (match-string 2)
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
432 (string= (match-string 1) "U ")
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
433 (string= (match-string 1) "P "))
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
434 (vc-file-setprop file 'vc-state 'up-to-date)
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
435 (vc-file-setprop file 'vc-checkout-time
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
436 (nth 5 (file-attributes file)))
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
437 0);; indicate success to the caller
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
438 ;; Merge successful, but our own changes are still in the file
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
439 ((string= (match-string 1) "M ")
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
440 (vc-file-setprop file 'vc-state 'edited)
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
441 0);; indicate success to the caller
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
442 ;; Conflicts detected!
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
443 (t
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
444 (vc-file-setprop file 'vc-state 'edited)
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
445 1);; signal the error to the caller
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
446 )
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
447 (pop-to-buffer "*vc*")
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
448 (error "Couldn't analyze cvs update result")))
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
449 (message "Merging changes into %s...done" file))))
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
450
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
451
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
452 ;;;
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
453 ;;; History functions
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
454 ;;;
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
455
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
456 (defun vc-cvs-print-log (file)
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
457 "Get change log associated with FILE."
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
458 (vc-do-command t (if (vc-cvs-stay-local-p file) 'async 0)
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
459 "cvs" file "log"))
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
460
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
461 (defun vc-cvs-show-log-entry (version)
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
462 (when (re-search-forward
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
463 ;; also match some context, for safety
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
464 (concat "----\nrevision " version
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
465 "\\(\tlocked by:.*\n\\|\n\\)date: ") nil t)
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
466 ;; set the display window so that
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
467 ;; the whole log entry is displayed
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
468 (let (start end lines)
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
469 (beginning-of-line) (forward-line -1) (setq start (point))
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
470 (if (not (re-search-forward "^----*\nrevision" nil t))
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
471 (setq end (point-max))
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
472 (beginning-of-line) (forward-line -1) (setq end (point)))
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
473 (setq lines (count-lines start end))
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
474 (cond
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
475 ;; if the global information and this log entry fit
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
476 ;; into the window, display from the beginning
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
477 ((< (count-lines (point-min) end) (window-height))
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
478 (goto-char (point-min))
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
479 (recenter 0)
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
480 (goto-char start))
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
481 ;; if the whole entry fits into the window,
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
482 ;; display it centered
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
483 ((< (1+ lines) (window-height))
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
484 (goto-char start)
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
485 (recenter (1- (- (/ (window-height) 2) (/ lines 2)))))
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
486 ;; otherwise (the entry is too large for the window),
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
487 ;; display from the start
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
488 (t
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
489 (goto-char start)
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
490 (recenter 0))))))
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
491
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
492 (defun vc-cvs-diff (file &optional oldvers newvers)
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
493 "Get a difference report using CVS between two versions of FILE."
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
494 (let (options status
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
495 (diff-switches-list (if (listp diff-switches)
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
496 diff-switches
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
497 (list diff-switches))))
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
498 (if (string= (vc-workfile-version file) "0")
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
499 ;; This file is added but not yet committed; there is no master file.
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
500 (if (or oldvers newvers)
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
501 (error "No revisions of %s exist" file)
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
502 ;; we regard this as "changed".
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
503 ;; diff it against /dev/null.
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
504 (apply 'vc-do-command t
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
505 1 "diff" file
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
506 (append diff-switches-list '("/dev/null"))))
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
507 (setq status
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
508 (apply 'vc-do-command t
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
509 (if (vc-cvs-stay-local-p file) 'async 1)
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
510 "cvs" file "diff"
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
511 (and oldvers (concat "-r" oldvers))
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
512 (and newvers (concat "-r" newvers))
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
513 diff-switches-list))
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
514 (if (vc-cvs-stay-local-p file)
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
515 1 ;; async diff, pessimistic assumption
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
516 status))))
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
517
33545
5411250e7971 (vc-cvs-annotate-command): New optional arg VERSION. Use
André Spiegel <spiegel@gnu.org>
parents: 32959
diff changeset
518 (defun vc-cvs-annotate-command (file buffer &optional version)
5411250e7971 (vc-cvs-annotate-command): New optional arg VERSION. Use
André Spiegel <spiegel@gnu.org>
parents: 32959
diff changeset
519 "Execute \"cvs annotate\" on FILE, inserting the contents in BUFFER.
5411250e7971 (vc-cvs-annotate-command): New optional arg VERSION. Use
André Spiegel <spiegel@gnu.org>
parents: 32959
diff changeset
520 Optional arg VERSION is a version to annotate from."
5411250e7971 (vc-cvs-annotate-command): New optional arg VERSION. Use
André Spiegel <spiegel@gnu.org>
parents: 32959
diff changeset
521 (vc-do-command buffer 0 "cvs" file "annotate" (if version
5411250e7971 (vc-cvs-annotate-command): New optional arg VERSION. Use
André Spiegel <spiegel@gnu.org>
parents: 32959
diff changeset
522 (concat "-r" version))))
31384
f6cb7dfe5e7c (vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
523
f6cb7dfe5e7c (vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
524 (defun vc-cvs-annotate-difference (point)
31475
b25e22223eb9 DOc fixes.
Dave Love <fx@gnu.org>
parents: 31404
diff changeset
525 "Return the difference between the time of the line and the current time.
b25e22223eb9 DOc fixes.
Dave Love <fx@gnu.org>
parents: 31404
diff changeset
526 Return values are as defined for `current-time'."
31384
f6cb7dfe5e7c (vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
527 ;; We need a list of months and their corresponding numbers.
f6cb7dfe5e7c (vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
528 (if (looking-at "^\\S-+\\s-+\\S-+\\s-+\\([0-9]+\\)-\\(\\sw+\\)-\\([0-9]+\\)): ")
f6cb7dfe5e7c (vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
529 (progn
f6cb7dfe5e7c (vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
530 (let* ((day (string-to-number (match-string 1)))
f6cb7dfe5e7c (vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
531 (month (cdr (assoc (match-string 2) vc-cvs-local-month-numbers)))
f6cb7dfe5e7c (vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
532 (year-tmp (string-to-number (match-string 3)))
f6cb7dfe5e7c (vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
533 ;; Years 0..68 are 2000..2068.
f6cb7dfe5e7c (vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
534 ;; Years 69..99 are 1969..1999.
f6cb7dfe5e7c (vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
535 (year (+ (cond ((> 69 year-tmp) 2000)
f6cb7dfe5e7c (vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
536 ((> 100 year-tmp) 1900)
f6cb7dfe5e7c (vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
537 (t 0))
f6cb7dfe5e7c (vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
538 year-tmp)))
f6cb7dfe5e7c (vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
539 (goto-char (match-end 0)) ; Position at end makes for nicer overlay result
f6cb7dfe5e7c (vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
540 (- (car (current-time))
f6cb7dfe5e7c (vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
541 (car (encode-time 0 0 0 day month year)))))
f6cb7dfe5e7c (vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
542 ;; If we did not look directly at an annotation, there might be
f6cb7dfe5e7c (vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
543 ;; some further down. This is the case if we are positioned at
f6cb7dfe5e7c (vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
544 ;; the very top of the buffer, for instance.
31475
b25e22223eb9 DOc fixes.
Dave Love <fx@gnu.org>
parents: 31404
diff changeset
545 (if (re-search-forward
31384
f6cb7dfe5e7c (vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
546 "^\\S-+\\s-+\\S-+\\s-+\\([0-9]+\\)-\\(\\sw+\\)-\\([0-9]+\\)): " nil t)
f6cb7dfe5e7c (vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
547 (progn
f6cb7dfe5e7c (vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
548 (beginning-of-line nil)
f6cb7dfe5e7c (vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
549 (vc-cvs-annotate-difference (point))))))
f6cb7dfe5e7c (vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
550
33560
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
551
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
552 ;;;
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
553 ;;; Snapshot system
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
554 ;;;
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
555
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
556 (defun vc-cvs-create-snapshot (dir name branchp)
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
557 "Assign to DIR's current version a given NAME.
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
558 If BRANCHP is non-nil, the name is created as a branch (and the current
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
559 workspace is immediately moved to that new branch)."
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
560 (vc-do-command nil 0 "cvs" dir "tag" "-c" (if branchp "-b") name)
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
561 (when branchp (vc-do-command nil 0 "cvs" dir "update" "-r" name)))
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
562
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
563 (defun vc-cvs-retrieve-snapshot (dir name update)
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
564 "Retrieve a snapshot at and below DIR.
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
565 NAME is the name of the snapshot; if it is empty, do a `cvs update'.
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
566 If UPDATE is non-nil, then update (resynch) any affected buffers."
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
567 (with-current-buffer (get-buffer-create "*vc*")
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
568 (let ((default-directory dir))
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
569 (erase-buffer)
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
570 (if (or (not name) (string= name ""))
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
571 (vc-do-command t 0 "cvs" nil "update")
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
572 (vc-do-command t 0 "cvs" nil "update" "-r" name))
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
573 (when update
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
574 (goto-char (point-min))
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
575 (while (not (eobp))
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
576 (if (looking-at "\\([CMUP]\\) \\(.*\\)")
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
577 (let* ((file (expand-file-name (match-string 2) dir))
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
578 (state (match-string 1))
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
579 (buffer (find-buffer-visiting file)))
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
580 (when buffer
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
581 (cond
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
582 ((or (string= state "U")
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
583 (string= state "P"))
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
584 (vc-file-setprop file 'vc-state 'up-to-date)
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
585 (vc-file-setprop file 'vc-workfile-version nil)
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
586 (vc-file-setprop file 'vc-checkout-time
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
587 (nth 5 (file-attributes file))))
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
588 ((or (string= state "M")
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
589 (string= state "C"))
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
590 (vc-file-setprop file 'vc-state 'edited)
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
591 (vc-file-setprop file 'vc-workfile-version nil)
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
592 (vc-file-setprop file 'vc-checkout-time 0)))
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
593 (vc-resynch-buffer file t t))))
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
594 (forward-line 1))))))
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
595
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
596
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
597 ;;;
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
598 ;;; Miscellaneous
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
599 ;;;
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
600
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
601 (defun vc-cvs-make-version-backups-p (file)
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
602 "Return non-nil if version backups should be made for FILE."
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
603 (vc-cvs-stay-local-p file))
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
604
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
605 (defun vc-cvs-check-headers ()
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
606 "Check if the current file has any headers in it."
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
607 (save-excursion
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
608 (goto-char (point-min))
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
609 (re-search-forward "\\$[A-Za-z\300-\326\330-\366\370-\377]+\
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
610 \\(: [\t -#%-\176\240-\377]*\\)?\\$" nil t)))
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
611
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
612
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
613 ;;;
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
614 ;;; Internal functions
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
615 ;;;
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
616
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
617 (defun vc-cvs-stay-local-p (file)
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
618 "Return non-nil if VC should stay local when handling FILE."
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
619 (if vc-cvs-stay-local
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
620 (let* ((dirname (if (file-directory-p file)
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
621 (directory-file-name file)
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
622 (file-name-directory file)))
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
623 (prop
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
624 (or (vc-file-getprop dirname 'vc-cvs-stay-local-p)
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
625 (let ((rootname (expand-file-name "CVS/Root" dirname)))
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
626 (vc-file-setprop
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
627 dirname 'vc-cvs-stay-local-p
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
628 (when (file-readable-p rootname)
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
629 (with-temp-buffer
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
630 (vc-insert-file rootname)
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
631 (goto-char (point-min))
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
632 (if (looking-at "\\([^:]*\\):")
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
633 (if (not (stringp vc-cvs-stay-local))
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
634 'yes
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
635 (let ((hostname (match-string 1)))
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
636 (if (string-match vc-cvs-stay-local hostname)
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
637 'yes
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
638 'no)))
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
639 'no))))))))
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
640 (if (eq prop 'yes) t nil))))
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
641
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
642 (defun vc-cvs-parse-status (&optional full)
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
643 "Parse output of \"cvs status\" command in the current buffer.
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
644 Set file properties accordingly. Unless FULL is t, parse only
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
645 essential information."
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
646 (let (file status)
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
647 (goto-char (point-min))
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
648 (if (re-search-forward "^File: " nil t)
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
649 (cond
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
650 ((looking-at "no file") nil)
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
651 ((re-search-forward "\\=\\([^ \t]+\\)" nil t)
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
652 (setq file (expand-file-name (match-string 1)))
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
653 (vc-file-setprop file 'vc-backend 'CVS)
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
654 (if (not (re-search-forward "\\=[ \t]+Status: \\(.*\\)" nil t))
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
655 (setq status "Unknown")
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
656 (setq status (match-string 1)))
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
657 (if (and full
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
658 (re-search-forward
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
659 "\\(RCS Version\\|RCS Revision\\|Repository revision\\):\
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
660 \[\t ]+\\([0-9.]+\\)"
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
661 nil t))
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
662 (vc-file-setprop file 'vc-latest-version (match-string 2)))
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
663 (cond
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
664 ((string-match "Up-to-date" status)
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
665 (vc-file-setprop file 'vc-checkout-time
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
666 (nth 5 (file-attributes file)))
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
667 'up-to-date)
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
668 ((string-match "Locally Modified" status) 'edited)
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
669 ((string-match "Needs Merge" status) 'needs-merge)
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
670 ((string-match "Needs \\(Checkout\\|Patch\\)" status) 'needs-patch)
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
671 (t 'edited)))))))
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
672
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
673 (defun vc-cvs-dir-state-heuristic (dir)
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
674 "Find the CVS state of all files in DIR, using only local information."
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
675 (with-temp-buffer
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
676 (vc-insert-file (expand-file-name "CVS/Entries" dir))
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
677 (goto-char (point-min))
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
678 (while (not (eobp))
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
679 (when (looking-at "/\\([^/]*\\)/")
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
680 (let ((file (expand-file-name (match-string 1) dir)))
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
681 (unless (vc-file-getprop file 'vc-state)
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
682 (vc-cvs-parse-entry file t))))
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
683 (forward-line 1))))
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
684
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
685 (defun vc-cvs-parse-entry (file &optional set-state)
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
686 "Parse a line from CVS/Entries.
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
687 Compare modification time to that of the FILE, set file properties
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
688 accordingly. However, `vc-state' is set only if optional arg SET-STATE
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
689 is non-nil."
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
690 (cond
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
691 ;; entry for a "locally added" file (not yet committed)
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
692 ((looking-at "/[^/]+/0/")
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
693 (vc-file-setprop file 'vc-checkout-time 0)
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
694 (vc-file-setprop file 'vc-workfile-version "0")
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
695 (if set-state (vc-file-setprop file 'vc-state 'edited)))
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
696 ;; normal entry
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
697 ((looking-at
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
698 (concat "/[^/]+"
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
699 ;; revision
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
700 "/\\([^/]*\\)"
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
701 ;; timestamp
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
702 "/[A-Z][a-z][a-z]" ;; week day (irrelevant)
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
703 " \\([A-Z][a-z][a-z]\\)" ;; month name
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
704 " *\\([0-9]*\\)" ;; day of month
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
705 " \\([0-9]*\\):\\([0-9]*\\):\\([0-9]*\\)" ;; hms
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
706 " \\([0-9]*\\)" ;; year
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
707 ;; optional conflict field
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
708 "\\(+[^/]*\\)?/"))
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
709 (vc-file-setprop file 'vc-workfile-version (match-string 1))
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
710 ;; compare checkout time and modification time
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
711 (let ((second (string-to-number (match-string 6)))
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
712 (minute (string-to-number (match-string 5)))
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
713 (hour (string-to-number (match-string 4)))
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
714 (day (string-to-number (match-string 3)))
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
715 (year (string-to-number (match-string 7)))
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
716 (month (/ (string-match
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
717 (match-string 2)
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
718 "xxxJanFebMarAprMayJunJulAugSepOctNovDec")
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
719 3))
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
720 (mtime (nth 5 (file-attributes file))))
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
721 (cond ((equal mtime
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
722 (encode-time second minute hour day month year 0))
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
723 (vc-file-setprop file 'vc-checkout-time mtime)
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
724 (if set-state (vc-file-setprop file 'vc-state 'up-to-date)))
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
725 (t
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
726 (vc-file-setprop file 'vc-checkout-time 0)
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
727 (if set-state (vc-file-setprop file 'vc-state 'edited))))))
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
728 ;; entry with arbitrary text as timestamp
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
729 ;; (this means we should consider it modified)
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
730 ((looking-at
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
731 (concat "/[^/]+"
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
732 ;; revision
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
733 "/\\([^/]*\\)"
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
734 ;; timestamp (arbitrary text)
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
735 "/[^/]*"
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
736 ;; optional conflict field
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
737 "\\(+[^/]*\\)?/"))
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
738 (vc-file-setprop file 'vc-workfile-version (match-string 1))
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
739 (vc-file-setprop file 'vc-checkout-time 0)
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
740 (if set-state (vc-file-setprop file 'vc-state 'edited)))))
da206bbad86b Functions reordered.
André Spiegel <spiegel@gnu.org>
parents: 33554
diff changeset
741
31384
f6cb7dfe5e7c (vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
742 (provide 'vc-cvs)
f6cb7dfe5e7c (vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
743
f6cb7dfe5e7c (vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
744 ;;; vc-cvs.el ends here