Mercurial > emacs
annotate lisp/vc-cvs.el @ 59971:c20f0be3ae10
*** empty log message ***
author | Kim F. Storm <storm@cua.dk> |
---|---|
date | Mon, 07 Feb 2005 11:44:19 +0000 |
parents | fd6e4e55ca84 |
children | aac0a33f5772 3dcba0bc766b cb67264d6096 |
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 |
51733
2b72fd42f02e
(vc-cvs-repository-hostname): New operation.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
51164
diff
changeset
|
3 ;; Copyright (C) 1995,98,99,2000,2001,02,2003 Free Software Foundation, Inc. |
31384
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 |
57913
f5d7d9bbc021
(vc-cvs-annotate-command): Delete extraneous lines from beginning of buffer.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
54465
diff
changeset
|
8 ;; $Id$ |
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 |
35702
395d188bb71d
replaced require with autoloads
Sam Steingold <sds@gnu.org>
parents:
35584
diff
changeset
|
31 (eval-when-compile |
35839
7349d241e60b
Remove autoloads. Require vc when compiling.
André Spiegel <spiegel@gnu.org>
parents:
35821
diff
changeset
|
32 (require 'vc)) |
35584 | 33 |
35569 | 34 ;;; |
33560 | 35 ;;; Customization options |
36 ;;; | |
37 | |
44197
e255f8fa4f62
(vc-cvs-global-switches): New user option.
André Spiegel <spiegel@gnu.org>
parents:
44104
diff
changeset
|
38 (defcustom vc-cvs-global-switches nil |
e255f8fa4f62
(vc-cvs-global-switches): New user option.
André Spiegel <spiegel@gnu.org>
parents:
44104
diff
changeset
|
39 "*Global switches to pass to any CVS command." |
e255f8fa4f62
(vc-cvs-global-switches): New user option.
André Spiegel <spiegel@gnu.org>
parents:
44104
diff
changeset
|
40 :type '(choice (const :tag "None" nil) |
e255f8fa4f62
(vc-cvs-global-switches): New user option.
André Spiegel <spiegel@gnu.org>
parents:
44104
diff
changeset
|
41 (string :tag "Argument String") |
e255f8fa4f62
(vc-cvs-global-switches): New user option.
André Spiegel <spiegel@gnu.org>
parents:
44104
diff
changeset
|
42 (repeat :tag "Argument List" |
e255f8fa4f62
(vc-cvs-global-switches): New user option.
André Spiegel <spiegel@gnu.org>
parents:
44104
diff
changeset
|
43 :value ("") |
e255f8fa4f62
(vc-cvs-global-switches): New user option.
André Spiegel <spiegel@gnu.org>
parents:
44104
diff
changeset
|
44 string)) |
45255
20c79f08a7da
Change all post-21.1 :version attributes to 21.4.
Eli Zaretskii <eliz@gnu.org>
parents:
44462
diff
changeset
|
45 :version "21.4" |
44197
e255f8fa4f62
(vc-cvs-global-switches): New user option.
André Spiegel <spiegel@gnu.org>
parents:
44104
diff
changeset
|
46 :group 'vc) |
e255f8fa4f62
(vc-cvs-global-switches): New user option.
André Spiegel <spiegel@gnu.org>
parents:
44104
diff
changeset
|
47 |
31384
f6cb7dfe5e7c
(vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
48 (defcustom vc-cvs-register-switches nil |
f6cb7dfe5e7c
(vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
49 "*Extra switches for registering a file into CVS. |
f6cb7dfe5e7c
(vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
50 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
|
51 \\[vc-register]." |
f6cb7dfe5e7c
(vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
52 :type '(choice (const :tag "None" nil) |
f6cb7dfe5e7c
(vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
53 (string :tag "Argument String") |
f6cb7dfe5e7c
(vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
54 (repeat :tag "Argument List" |
f6cb7dfe5e7c
(vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
55 :value ("") |
f6cb7dfe5e7c
(vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
56 string)) |
31475 | 57 :version "21.1" |
31384
f6cb7dfe5e7c
(vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
58 :group 'vc) |
f6cb7dfe5e7c
(vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
59 |
35821
6b1ff979e045
(vc-cvs-diff-switches): New customization option.
André Spiegel <spiegel@gnu.org>
parents:
35702
diff
changeset
|
60 (defcustom vc-cvs-diff-switches nil |
6b1ff979e045
(vc-cvs-diff-switches): New customization option.
André Spiegel <spiegel@gnu.org>
parents:
35702
diff
changeset
|
61 "*A string or list of strings specifying extra switches for cvs diff under VC." |
6b1ff979e045
(vc-cvs-diff-switches): New customization option.
André Spiegel <spiegel@gnu.org>
parents:
35702
diff
changeset
|
62 :type '(choice (const :tag "None" nil) |
6b1ff979e045
(vc-cvs-diff-switches): New customization option.
André Spiegel <spiegel@gnu.org>
parents:
35702
diff
changeset
|
63 (string :tag "Argument String") |
6b1ff979e045
(vc-cvs-diff-switches): New customization option.
André Spiegel <spiegel@gnu.org>
parents:
35702
diff
changeset
|
64 (repeat :tag "Argument List" |
6b1ff979e045
(vc-cvs-diff-switches): New customization option.
André Spiegel <spiegel@gnu.org>
parents:
35702
diff
changeset
|
65 :value ("") |
6b1ff979e045
(vc-cvs-diff-switches): New customization option.
André Spiegel <spiegel@gnu.org>
parents:
35702
diff
changeset
|
66 string)) |
6b1ff979e045
(vc-cvs-diff-switches): New customization option.
André Spiegel <spiegel@gnu.org>
parents:
35702
diff
changeset
|
67 :version "21.1" |
6b1ff979e045
(vc-cvs-diff-switches): New customization option.
André Spiegel <spiegel@gnu.org>
parents:
35702
diff
changeset
|
68 :group 'vc) |
6b1ff979e045
(vc-cvs-diff-switches): New customization option.
André Spiegel <spiegel@gnu.org>
parents:
35702
diff
changeset
|
69 |
31384
f6cb7dfe5e7c
(vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
70 (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
|
71 "*Header keywords to be inserted by `vc-insert-headers'." |
31475 | 72 :version "21.1" |
35177 | 73 :type '(repeat string) |
31384
f6cb7dfe5e7c
(vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
74 :group 'vc) |
f6cb7dfe5e7c
(vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
75 |
f6cb7dfe5e7c
(vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
76 (defcustom vc-cvs-use-edit t |
f6cb7dfe5e7c
(vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
77 "*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
|
78 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
|
79 \(i.e. if you have $CVSREAD set)." |
f6cb7dfe5e7c
(vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
80 :type 'boolean |
31475 | 81 :version "21.1" |
31384
f6cb7dfe5e7c
(vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
82 :group 'vc) |
f6cb7dfe5e7c
(vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
83 |
50671
0737c3a76291
(vc-cvs-stay-local): Keep the old default. Simplify doc string.
André Spiegel <spiegel@gnu.org>
parents:
50668
diff
changeset
|
84 (defcustom vc-cvs-stay-local t |
31475 | 85 "*Non-nil means use local operations when possible for remote repositories. |
38288
6934c28c6bc5
(vc-cvs-stay-local): doc fix.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
37358
diff
changeset
|
86 This avoids slow queries over the network and instead uses heuristics |
6934c28c6bc5
(vc-cvs-stay-local): doc fix.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
37358
diff
changeset
|
87 and past information to determine the current status of a file. |
50671
0737c3a76291
(vc-cvs-stay-local): Keep the old default. Simplify doc string.
André Spiegel <spiegel@gnu.org>
parents:
50668
diff
changeset
|
88 |
50668
01d84e9d30e0
Patch by Wolfgang Scherer <Wolfgang.Scherer@gmx.de>
André Spiegel <spiegel@gnu.org>
parents:
50645
diff
changeset
|
89 The value can also be a regular expression or list of regular |
01d84e9d30e0
Patch by Wolfgang Scherer <Wolfgang.Scherer@gmx.de>
André Spiegel <spiegel@gnu.org>
parents:
50645
diff
changeset
|
90 expressions to match against the host name of a repository; then VC |
50671
0737c3a76291
(vc-cvs-stay-local): Keep the old default. Simplify doc string.
André Spiegel <spiegel@gnu.org>
parents:
50668
diff
changeset
|
91 only stays local for hosts that match it. Alternatively, the value |
57913
f5d7d9bbc021
(vc-cvs-annotate-command): Delete extraneous lines from beginning of buffer.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
54465
diff
changeset
|
92 can be a list of regular expressions where the first element is the |
f5d7d9bbc021
(vc-cvs-annotate-command): Delete extraneous lines from beginning of buffer.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
54465
diff
changeset
|
93 symbol `except'; then VC always stays local except for hosts matched |
50671
0737c3a76291
(vc-cvs-stay-local): Keep the old default. Simplify doc string.
André Spiegel <spiegel@gnu.org>
parents:
50668
diff
changeset
|
94 by these regular expressions." |
31384
f6cb7dfe5e7c
(vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
95 :type '(choice (const :tag "Always stay local" t) |
50668
01d84e9d30e0
Patch by Wolfgang Scherer <Wolfgang.Scherer@gmx.de>
André Spiegel <spiegel@gnu.org>
parents:
50645
diff
changeset
|
96 (const :tag "Don't stay local" nil) |
57913
f5d7d9bbc021
(vc-cvs-annotate-command): Delete extraneous lines from beginning of buffer.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
54465
diff
changeset
|
97 (list :format "\nExamine hostname and %v" :tag "Examine hostname ..." |
50668
01d84e9d30e0
Patch by Wolfgang Scherer <Wolfgang.Scherer@gmx.de>
André Spiegel <spiegel@gnu.org>
parents:
50645
diff
changeset
|
98 (set :format "%v" :inline t (const :format "%t" :tag "don't" except)) |
01d84e9d30e0
Patch by Wolfgang Scherer <Wolfgang.Scherer@gmx.de>
André Spiegel <spiegel@gnu.org>
parents:
50645
diff
changeset
|
99 (regexp :format " stay local,\n%t: %v" :tag "if it matches") |
01d84e9d30e0
Patch by Wolfgang Scherer <Wolfgang.Scherer@gmx.de>
André Spiegel <spiegel@gnu.org>
parents:
50645
diff
changeset
|
100 (repeat :format "%v%i\n" :inline t (regexp :tag "or")))) |
31475 | 101 :version "21.1" |
31384
f6cb7dfe5e7c
(vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
102 :group 'vc) |
f6cb7dfe5e7c
(vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
103 |
43447
79cf46e34420
Patch by Martin.Lorentzson@telia.com.
André Spiegel <spiegel@gnu.org>
parents:
42657
diff
changeset
|
104 (defcustom vc-cvs-sticky-date-format-string "%c" |
79cf46e34420
Patch by Martin.Lorentzson@telia.com.
André Spiegel <spiegel@gnu.org>
parents:
42657
diff
changeset
|
105 "*Format string for mode-line display of sticky date. |
79cf46e34420
Patch by Martin.Lorentzson@telia.com.
André Spiegel <spiegel@gnu.org>
parents:
42657
diff
changeset
|
106 Format is according to `format-time-string'. Only used if |
79cf46e34420
Patch by Martin.Lorentzson@telia.com.
André Spiegel <spiegel@gnu.org>
parents:
42657
diff
changeset
|
107 `vc-cvs-sticky-tag-display' is t." |
79cf46e34420
Patch by Martin.Lorentzson@telia.com.
André Spiegel <spiegel@gnu.org>
parents:
42657
diff
changeset
|
108 :type '(string) |
45255
20c79f08a7da
Change all post-21.1 :version attributes to 21.4.
Eli Zaretskii <eliz@gnu.org>
parents:
44462
diff
changeset
|
109 :version "21.4" |
43447
79cf46e34420
Patch by Martin.Lorentzson@telia.com.
André Spiegel <spiegel@gnu.org>
parents:
42657
diff
changeset
|
110 :group 'vc) |
79cf46e34420
Patch by Martin.Lorentzson@telia.com.
André Spiegel <spiegel@gnu.org>
parents:
42657
diff
changeset
|
111 |
79cf46e34420
Patch by Martin.Lorentzson@telia.com.
André Spiegel <spiegel@gnu.org>
parents:
42657
diff
changeset
|
112 (defcustom vc-cvs-sticky-tag-display t |
79cf46e34420
Patch by Martin.Lorentzson@telia.com.
André Spiegel <spiegel@gnu.org>
parents:
42657
diff
changeset
|
113 "*Specify the mode-line display of sticky tags. |
79cf46e34420
Patch by Martin.Lorentzson@telia.com.
André Spiegel <spiegel@gnu.org>
parents:
42657
diff
changeset
|
114 Value t means default display, nil means no display at all. If the |
79cf46e34420
Patch by Martin.Lorentzson@telia.com.
André Spiegel <spiegel@gnu.org>
parents:
42657
diff
changeset
|
115 value is a function or macro, it is called with the sticky tag and |
79cf46e34420
Patch by Martin.Lorentzson@telia.com.
André Spiegel <spiegel@gnu.org>
parents:
42657
diff
changeset
|
116 its' type as parameters, in that order. TYPE can have three different |
79cf46e34420
Patch by Martin.Lorentzson@telia.com.
André Spiegel <spiegel@gnu.org>
parents:
42657
diff
changeset
|
117 values: `symbolic-name' (TAG is a string), `revision-number' (TAG is a |
79cf46e34420
Patch by Martin.Lorentzson@telia.com.
André Spiegel <spiegel@gnu.org>
parents:
42657
diff
changeset
|
118 string) and `date' (TAG is a date as returned by `encode-time'). The |
79cf46e34420
Patch by Martin.Lorentzson@telia.com.
André Spiegel <spiegel@gnu.org>
parents:
42657
diff
changeset
|
119 return value of the function or macro will be displayed as a string. |
79cf46e34420
Patch by Martin.Lorentzson@telia.com.
André Spiegel <spiegel@gnu.org>
parents:
42657
diff
changeset
|
120 |
79cf46e34420
Patch by Martin.Lorentzson@telia.com.
André Spiegel <spiegel@gnu.org>
parents:
42657
diff
changeset
|
121 Here's an example that will display the formatted date for sticky |
79cf46e34420
Patch by Martin.Lorentzson@telia.com.
André Spiegel <spiegel@gnu.org>
parents:
42657
diff
changeset
|
122 dates and the word \"Sticky\" for sticky tag names and revisions. |
79cf46e34420
Patch by Martin.Lorentzson@telia.com.
André Spiegel <spiegel@gnu.org>
parents:
42657
diff
changeset
|
123 |
79cf46e34420
Patch by Martin.Lorentzson@telia.com.
André Spiegel <spiegel@gnu.org>
parents:
42657
diff
changeset
|
124 (lambda (tag type) |
44436
f9db51bb423b
(vc-cvs-checkin): Pass the required argument to `error'.
Sam Steingold <sds@gnu.org>
parents:
44197
diff
changeset
|
125 (cond ((eq type 'date) (format-time-string |
43447
79cf46e34420
Patch by Martin.Lorentzson@telia.com.
André Spiegel <spiegel@gnu.org>
parents:
42657
diff
changeset
|
126 vc-cvs-sticky-date-format-string tag)) |
79cf46e34420
Patch by Martin.Lorentzson@telia.com.
André Spiegel <spiegel@gnu.org>
parents:
42657
diff
changeset
|
127 ((eq type 'revision-number) \"Sticky\") |
79cf46e34420
Patch by Martin.Lorentzson@telia.com.
André Spiegel <spiegel@gnu.org>
parents:
42657
diff
changeset
|
128 ((eq type 'symbolic-name) \"Sticky\"))) |
79cf46e34420
Patch by Martin.Lorentzson@telia.com.
André Spiegel <spiegel@gnu.org>
parents:
42657
diff
changeset
|
129 |
79cf46e34420
Patch by Martin.Lorentzson@telia.com.
André Spiegel <spiegel@gnu.org>
parents:
42657
diff
changeset
|
130 Here's an example that will abbreviate to the first character only, |
47917
ca7641fe56ba
(vc-cvs-sticky-tag-display): Fix typo.
Juanma Barranquero <lekktu@gmail.com>
parents:
47840
diff
changeset
|
131 any text before the first occurrence of `-' for sticky symbolic tags. |
43447
79cf46e34420
Patch by Martin.Lorentzson@telia.com.
André Spiegel <spiegel@gnu.org>
parents:
42657
diff
changeset
|
132 If the sticky tag is a revision number, the word \"Sticky\" is |
79cf46e34420
Patch by Martin.Lorentzson@telia.com.
André Spiegel <spiegel@gnu.org>
parents:
42657
diff
changeset
|
133 displayed. Date and time is displayed for sticky dates. |
79cf46e34420
Patch by Martin.Lorentzson@telia.com.
André Spiegel <spiegel@gnu.org>
parents:
42657
diff
changeset
|
134 |
79cf46e34420
Patch by Martin.Lorentzson@telia.com.
André Spiegel <spiegel@gnu.org>
parents:
42657
diff
changeset
|
135 (lambda (tag type) |
79cf46e34420
Patch by Martin.Lorentzson@telia.com.
André Spiegel <spiegel@gnu.org>
parents:
42657
diff
changeset
|
136 (cond ((eq type 'date) (format-time-string \"%Y%m%d %H:%M\" tag)) |
79cf46e34420
Patch by Martin.Lorentzson@telia.com.
André Spiegel <spiegel@gnu.org>
parents:
42657
diff
changeset
|
137 ((eq type 'revision-number) \"Sticky\") |
44436
f9db51bb423b
(vc-cvs-checkin): Pass the required argument to `error'.
Sam Steingold <sds@gnu.org>
parents:
44197
diff
changeset
|
138 ((eq type 'symbolic-name) |
43447
79cf46e34420
Patch by Martin.Lorentzson@telia.com.
André Spiegel <spiegel@gnu.org>
parents:
42657
diff
changeset
|
139 (condition-case nil |
79cf46e34420
Patch by Martin.Lorentzson@telia.com.
André Spiegel <spiegel@gnu.org>
parents:
42657
diff
changeset
|
140 (progn |
79cf46e34420
Patch by Martin.Lorentzson@telia.com.
André Spiegel <spiegel@gnu.org>
parents:
42657
diff
changeset
|
141 (string-match \"\\\\([^-]*\\\\)\\\\(.*\\\\)\" tag) |
44436
f9db51bb423b
(vc-cvs-checkin): Pass the required argument to `error'.
Sam Steingold <sds@gnu.org>
parents:
44197
diff
changeset
|
142 (concat (substring (match-string 1 tag) 0 1) \":\" |
43447
79cf46e34420
Patch by Martin.Lorentzson@telia.com.
André Spiegel <spiegel@gnu.org>
parents:
42657
diff
changeset
|
143 (substring (match-string 2 tag) 1 nil))) |
79cf46e34420
Patch by Martin.Lorentzson@telia.com.
André Spiegel <spiegel@gnu.org>
parents:
42657
diff
changeset
|
144 (error tag))))) ; Fall-back to given tag name. |
79cf46e34420
Patch by Martin.Lorentzson@telia.com.
André Spiegel <spiegel@gnu.org>
parents:
42657
diff
changeset
|
145 |
79cf46e34420
Patch by Martin.Lorentzson@telia.com.
André Spiegel <spiegel@gnu.org>
parents:
42657
diff
changeset
|
146 See also variable `vc-cvs-sticky-date-format-string'." |
79cf46e34420
Patch by Martin.Lorentzson@telia.com.
André Spiegel <spiegel@gnu.org>
parents:
42657
diff
changeset
|
147 :type '(choice boolean function) |
45255
20c79f08a7da
Change all post-21.1 :version attributes to 21.4.
Eli Zaretskii <eliz@gnu.org>
parents:
44462
diff
changeset
|
148 :version "21.4" |
43447
79cf46e34420
Patch by Martin.Lorentzson@telia.com.
André Spiegel <spiegel@gnu.org>
parents:
42657
diff
changeset
|
149 :group 'vc) |
35569 | 150 |
33560 | 151 ;;; |
152 ;;; Internal variables | |
153 ;;; | |
154 | |
35569 | 155 |
33560 | 156 ;;; |
35569 | 157 ;;; State-querying functions |
33560 | 158 ;;; |
159 | |
31384
f6cb7dfe5e7c
(vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
160 ;;;###autoload (defun vc-cvs-registered (f) |
f6cb7dfe5e7c
(vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
161 ;;;###autoload (when (file-readable-p (expand-file-name |
f6cb7dfe5e7c
(vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
162 ;;;###autoload "CVS/Entries" (file-name-directory f))) |
47811
8b1c72f30fea
(vc-cvs-registered): In the autoload version use load instead of
Markus Rost <rost@math.uni-bielefeld.de>
parents:
47807
diff
changeset
|
163 ;;;###autoload (load "vc-cvs") |
31384
f6cb7dfe5e7c
(vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
164 ;;;###autoload (vc-cvs-registered f))) |
f6cb7dfe5e7c
(vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
165 |
f6cb7dfe5e7c
(vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
166 (defun vc-cvs-registered (file) |
f6cb7dfe5e7c
(vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
167 "Check if FILE is CVS registered." |
f6cb7dfe5e7c
(vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
168 (let ((dirname (or (file-name-directory file) "")) |
f6cb7dfe5e7c
(vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
169 (basename (file-name-nondirectory file)) |
f6cb7dfe5e7c
(vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
170 ;; 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
|
171 (case-fold-search nil)) |
f6cb7dfe5e7c
(vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
172 (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
|
173 (with-temp-buffer |
50453
e499daf7fb22
(vc-cvs-get-entries): New function that uses the right coding system for
André Spiegel <spiegel@gnu.org>
parents:
50321
diff
changeset
|
174 (vc-cvs-get-entries dirname) |
31384
f6cb7dfe5e7c
(vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
175 (goto-char (point-min)) |
31475 | 176 (cond |
177 ((re-search-forward | |
44104
985526b08270
(vc-cvs-registered, vc-cvs-dir-state-heuristic):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44005
diff
changeset
|
178 ;; CVS-removed files are not taken under VC control. |
985526b08270
(vc-cvs-registered, vc-cvs-dir-state-heuristic):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44005
diff
changeset
|
179 (concat "^/" (regexp-quote basename) "/[^/-]") nil t) |
31384
f6cb7dfe5e7c
(vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
180 (beginning-of-line) |
f6cb7dfe5e7c
(vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
181 (vc-cvs-parse-entry file) |
f6cb7dfe5e7c
(vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
182 t) |
f6cb7dfe5e7c
(vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
183 (t nil))) |
f6cb7dfe5e7c
(vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
184 nil))) |
f6cb7dfe5e7c
(vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
185 |
f6cb7dfe5e7c
(vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
186 (defun vc-cvs-state (file) |
f6cb7dfe5e7c
(vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
187 "CVS-specific version of `vc-state'." |
51733
2b72fd42f02e
(vc-cvs-repository-hostname): New operation.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
51164
diff
changeset
|
188 (if (vc-stay-local-p file) |
31384
f6cb7dfe5e7c
(vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
189 (let ((state (vc-file-getprop file 'vc-state))) |
f6cb7dfe5e7c
(vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
190 ;; 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
|
191 ;; we don't have a more precise state already available. |
58640
0241e1689d7f
(vc-cvs-state): Handle the case where vc-state is still nil.
André Spiegel <spiegel@gnu.org>
parents:
57916
diff
changeset
|
192 (if (memq state '(up-to-date edited nil)) |
31384
f6cb7dfe5e7c
(vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
193 (vc-cvs-state-heuristic file) |
f6cb7dfe5e7c
(vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
194 state)) |
f6cb7dfe5e7c
(vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
195 (with-temp-buffer |
f6cb7dfe5e7c
(vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
196 (cd (file-name-directory file)) |
44197
e255f8fa4f62
(vc-cvs-global-switches): New user option.
André Spiegel <spiegel@gnu.org>
parents:
44104
diff
changeset
|
197 (vc-cvs-command t 0 file "status") |
31384
f6cb7dfe5e7c
(vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
198 (vc-cvs-parse-status t)))) |
f6cb7dfe5e7c
(vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
199 |
f6cb7dfe5e7c
(vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
200 (defun vc-cvs-state-heuristic (file) |
f6cb7dfe5e7c
(vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
201 "CVS-specific state heuristic." |
f6cb7dfe5e7c
(vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
202 ;; 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
|
203 ;; Otherwise consider it `edited'. |
f6cb7dfe5e7c
(vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
204 (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
|
205 (lastmod (nth 5 (file-attributes file)))) |
f6cb7dfe5e7c
(vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
206 (if (equal checkout-time lastmod) |
f6cb7dfe5e7c
(vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
207 'up-to-date |
f6cb7dfe5e7c
(vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
208 'edited))) |
f6cb7dfe5e7c
(vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
209 |
33560 | 210 (defun vc-cvs-dir-state (dir) |
211 "Find the CVS state of all files in DIR." | |
50645
4b6925d144de
(vc-cvs-dir-state): Use vc-cvs-command.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50453
diff
changeset
|
212 ;; if DIR is not under CVS control, don't do anything. |
4b6925d144de
(vc-cvs-dir-state): Use vc-cvs-command.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50453
diff
changeset
|
213 (when (file-readable-p (expand-file-name "CVS/Entries" dir)) |
51733
2b72fd42f02e
(vc-cvs-repository-hostname): New operation.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
51164
diff
changeset
|
214 (if (vc-stay-local-p dir) |
50645
4b6925d144de
(vc-cvs-dir-state): Use vc-cvs-command.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50453
diff
changeset
|
215 (vc-cvs-dir-state-heuristic dir) |
4b6925d144de
(vc-cvs-dir-state): Use vc-cvs-command.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50453
diff
changeset
|
216 (let ((default-directory dir)) |
4b6925d144de
(vc-cvs-dir-state): Use vc-cvs-command.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50453
diff
changeset
|
217 ;; Don't specify DIR in this command, the default-directory is |
4b6925d144de
(vc-cvs-dir-state): Use vc-cvs-command.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50453
diff
changeset
|
218 ;; enough. Otherwise it might fail with remote repositories. |
4b6925d144de
(vc-cvs-dir-state): Use vc-cvs-command.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50453
diff
changeset
|
219 (with-temp-buffer |
4b6925d144de
(vc-cvs-dir-state): Use vc-cvs-command.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50453
diff
changeset
|
220 (vc-cvs-command t 0 nil "status" "-l") |
4b6925d144de
(vc-cvs-dir-state): Use vc-cvs-command.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50453
diff
changeset
|
221 (goto-char (point-min)) |
4b6925d144de
(vc-cvs-dir-state): Use vc-cvs-command.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50453
diff
changeset
|
222 (while (re-search-forward "^=+\n\\([^=\n].*\n\\|\n\\)+" nil t) |
4b6925d144de
(vc-cvs-dir-state): Use vc-cvs-command.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50453
diff
changeset
|
223 (narrow-to-region (match-beginning 0) (match-end 0)) |
4b6925d144de
(vc-cvs-dir-state): Use vc-cvs-command.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50453
diff
changeset
|
224 (vc-cvs-parse-status) |
4b6925d144de
(vc-cvs-dir-state): Use vc-cvs-command.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50453
diff
changeset
|
225 (goto-char (point-max)) |
4b6925d144de
(vc-cvs-dir-state): Use vc-cvs-command.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50453
diff
changeset
|
226 (widen))))))) |
33560 | 227 |
228 (defun vc-cvs-workfile-version (file) | |
229 "CVS-specific version of `vc-workfile-version'." | |
230 ;; There is no need to consult RCS headers under CVS, because we | |
231 ;; get the workfile version for free when we recognize that a file | |
232 ;; is registered in CVS. | |
233 (vc-cvs-registered file) | |
234 (vc-file-getprop file 'vc-workfile-version)) | |
235 | |
236 (defun vc-cvs-checkout-model (file) | |
237 "CVS-specific version of `vc-checkout-model'." | |
238 (if (or (getenv "CVSREAD") | |
239 ;; If the file is not writable (despite CVSREAD being | |
240 ;; undefined), this is probably because the file is being | |
241 ;; "watched" by other developers. | |
242 ;; (If vc-mistrust-permissions was t, we actually shouldn't | |
243 ;; trust this, but there is no other way to learn this from CVS | |
244 ;; at the moment (version 1.9).) | |
245 (string-match "r-..-..-." (nth 8 (file-attributes file)))) | |
246 'announce | |
247 'implicit)) | |
248 | |
31404
f2ab9420390f
2000-09-05 Stefan Monnier <monnier@cs.yale.edu>
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
31384
diff
changeset
|
249 (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
|
250 "Return string for placement into the modeline for FILE. |
43447
79cf46e34420
Patch by Martin.Lorentzson@telia.com.
André Spiegel <spiegel@gnu.org>
parents:
42657
diff
changeset
|
251 Compared to the default implementation, this function does two things: |
79cf46e34420
Patch by Martin.Lorentzson@telia.com.
André Spiegel <spiegel@gnu.org>
parents:
42657
diff
changeset
|
252 Handle the special case of a CVS file that is added but not yet |
79cf46e34420
Patch by Martin.Lorentzson@telia.com.
André Spiegel <spiegel@gnu.org>
parents:
42657
diff
changeset
|
253 committed and support display of sticky tags." |
50923
3eab629b1239
(vc-cvs-mode-line-string): Use vc-default-mode-line-string.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50910
diff
changeset
|
254 (let ((sticky-tag (vc-file-getprop file 'vc-cvs-sticky-tag)) |
3eab629b1239
(vc-cvs-mode-line-string): Use vc-default-mode-line-string.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50910
diff
changeset
|
255 (string (if (string= (vc-workfile-version file) "0") |
3eab629b1239
(vc-cvs-mode-line-string): Use vc-default-mode-line-string.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50910
diff
changeset
|
256 ;; A file that is added but not yet committed. |
3eab629b1239
(vc-cvs-mode-line-string): Use vc-default-mode-line-string.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50910
diff
changeset
|
257 "CVS @@" |
3eab629b1239
(vc-cvs-mode-line-string): Use vc-default-mode-line-string.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50910
diff
changeset
|
258 (vc-default-mode-line-string 'CVS file)))) |
3eab629b1239
(vc-cvs-mode-line-string): Use vc-default-mode-line-string.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50910
diff
changeset
|
259 (if (zerop (length sticky-tag)) |
3eab629b1239
(vc-cvs-mode-line-string): Use vc-default-mode-line-string.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50910
diff
changeset
|
260 string |
3eab629b1239
(vc-cvs-mode-line-string): Use vc-default-mode-line-string.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50910
diff
changeset
|
261 (concat string "[" sticky-tag "]")))) |
31404
f2ab9420390f
2000-09-05 Stefan Monnier <monnier@cs.yale.edu>
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
31384
diff
changeset
|
262 |
33560 | 263 (defun vc-cvs-dired-state-info (file) |
264 "CVS-specific version of `vc-dired-state-info'." | |
50898
8806616471e2
(vc-cvs-dired-state-info): Use `added' for added files and
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50671
diff
changeset
|
265 (let ((cvs-state (vc-state file))) |
8806616471e2
(vc-cvs-dired-state-info): Use `added' for added files and
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50671
diff
changeset
|
266 (cond ((eq cvs-state 'edited) |
50909
e76d42ef20bd
(vc-cvs-dired-state-info): Typo.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50898
diff
changeset
|
267 (if (equal (vc-workfile-version file) "0") |
50898
8806616471e2
(vc-cvs-dired-state-info): Use `added' for added files and
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50671
diff
changeset
|
268 "(added)" "(modified)")) |
8806616471e2
(vc-cvs-dired-state-info): Use `added' for added files and
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50671
diff
changeset
|
269 ((eq cvs-state 'needs-patch) "(patch)") |
8806616471e2
(vc-cvs-dired-state-info): Use `added' for added files and
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50671
diff
changeset
|
270 ((eq cvs-state 'needs-merge) "(merge)")))) |
31384
f6cb7dfe5e7c
(vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
271 |
35569 | 272 |
33560 | 273 ;;; |
274 ;;; State-changing functions | |
275 ;;; | |
31384
f6cb7dfe5e7c
(vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
276 |
33560 | 277 (defun vc-cvs-register (file &optional rev comment) |
278 "Register FILE into the CVS version-control system. | |
279 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
|
280 |
33560 | 281 `vc-register-switches' and `vc-cvs-register-switches' are passed to |
282 the CVS command (in that order)." | |
51733
2b72fd42f02e
(vc-cvs-repository-hostname): New operation.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
51164
diff
changeset
|
283 (when (and (not (vc-cvs-responsible-p file)) |
2b72fd42f02e
(vc-cvs-repository-hostname): New operation.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
51164
diff
changeset
|
284 (vc-cvs-could-register file)) |
2b72fd42f02e
(vc-cvs-repository-hostname): New operation.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
51164
diff
changeset
|
285 ;; Register the directory if needed. |
2b72fd42f02e
(vc-cvs-repository-hostname): New operation.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
51164
diff
changeset
|
286 (vc-cvs-register (directory-file-name (file-name-directory file)))) |
50910
8c4130079acf
(vc-cvs-register, vc-cvs-checkin, vc-cvs-find-version, vc-cvs-diff)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50909
diff
changeset
|
287 (apply 'vc-cvs-command nil 0 file |
8c4130079acf
(vc-cvs-register, vc-cvs-checkin, vc-cvs-find-version, vc-cvs-diff)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50909
diff
changeset
|
288 "add" |
8c4130079acf
(vc-cvs-register, vc-cvs-checkin, vc-cvs-find-version, vc-cvs-diff)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50909
diff
changeset
|
289 (and comment (string-match "[^\t\n ]" comment) |
8c4130079acf
(vc-cvs-register, vc-cvs-checkin, vc-cvs-find-version, vc-cvs-diff)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50909
diff
changeset
|
290 (concat "-m" comment)) |
8c4130079acf
(vc-cvs-register, vc-cvs-checkin, vc-cvs-find-version, vc-cvs-diff)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50909
diff
changeset
|
291 (vc-switches 'CVS 'register))) |
31384
f6cb7dfe5e7c
(vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
292 |
33560 | 293 (defun vc-cvs-responsible-p (file) |
294 "Return non-nil if CVS thinks it is responsible for FILE." | |
295 (file-directory-p (expand-file-name "CVS" | |
296 (if (file-directory-p file) | |
297 file | |
298 (file-name-directory file))))) | |
31384
f6cb7dfe5e7c
(vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
299 |
51733
2b72fd42f02e
(vc-cvs-repository-hostname): New operation.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
51164
diff
changeset
|
300 (defun vc-cvs-could-register (file) |
33560 | 301 "Return non-nil if FILE could be registered in CVS. |
51733
2b72fd42f02e
(vc-cvs-repository-hostname): New operation.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
51164
diff
changeset
|
302 This is only possible if CVS is managing FILE's directory or one of |
2b72fd42f02e
(vc-cvs-repository-hostname): New operation.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
51164
diff
changeset
|
303 its parents." |
2b72fd42f02e
(vc-cvs-repository-hostname): New operation.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
51164
diff
changeset
|
304 (let ((dir file)) |
2b72fd42f02e
(vc-cvs-repository-hostname): New operation.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
51164
diff
changeset
|
305 (while (and (stringp dir) |
2b72fd42f02e
(vc-cvs-repository-hostname): New operation.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
51164
diff
changeset
|
306 (not (equal dir (setq dir (file-name-directory dir)))) |
2b72fd42f02e
(vc-cvs-repository-hostname): New operation.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
51164
diff
changeset
|
307 dir) |
2b72fd42f02e
(vc-cvs-repository-hostname): New operation.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
51164
diff
changeset
|
308 (setq dir (if (file-directory-p |
2b72fd42f02e
(vc-cvs-repository-hostname): New operation.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
51164
diff
changeset
|
309 (expand-file-name "CVS/Entries" dir)) |
2b72fd42f02e
(vc-cvs-repository-hostname): New operation.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
51164
diff
changeset
|
310 t (directory-file-name dir)))) |
2b72fd42f02e
(vc-cvs-repository-hostname): New operation.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
51164
diff
changeset
|
311 (eq dir t))) |
31384
f6cb7dfe5e7c
(vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
312 |
f6cb7dfe5e7c
(vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
313 (defun vc-cvs-checkin (file rev comment) |
f6cb7dfe5e7c
(vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
314 "CVS-specific version of `vc-backend-checkin'." |
50910
8c4130079acf
(vc-cvs-register, vc-cvs-checkin, vc-cvs-find-version, vc-cvs-diff)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50909
diff
changeset
|
315 (unless (or (not rev) (vc-cvs-valid-version-number-p rev)) |
8c4130079acf
(vc-cvs-register, vc-cvs-checkin, vc-cvs-find-version, vc-cvs-diff)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50909
diff
changeset
|
316 (if (not (vc-cvs-valid-symbolic-tag-name-p rev)) |
8c4130079acf
(vc-cvs-register, vc-cvs-checkin, vc-cvs-find-version, vc-cvs-diff)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50909
diff
changeset
|
317 (error "%s is not a valid symbolic tag name" rev) |
8c4130079acf
(vc-cvs-register, vc-cvs-checkin, vc-cvs-find-version, vc-cvs-diff)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50909
diff
changeset
|
318 ;; If the input revison is a valid symbolic tag name, we create it |
8c4130079acf
(vc-cvs-register, vc-cvs-checkin, vc-cvs-find-version, vc-cvs-diff)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50909
diff
changeset
|
319 ;; as a branch, commit and switch to it. |
8c4130079acf
(vc-cvs-register, vc-cvs-checkin, vc-cvs-find-version, vc-cvs-diff)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50909
diff
changeset
|
320 (apply 'vc-cvs-command nil 0 file "tag" "-b" (list rev)) |
8c4130079acf
(vc-cvs-register, vc-cvs-checkin, vc-cvs-find-version, vc-cvs-diff)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50909
diff
changeset
|
321 (apply 'vc-cvs-command nil 0 file "update" "-r" (list rev)) |
8c4130079acf
(vc-cvs-register, vc-cvs-checkin, vc-cvs-find-version, vc-cvs-diff)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50909
diff
changeset
|
322 (vc-file-setprop file 'vc-cvs-sticky-tag rev))) |
8c4130079acf
(vc-cvs-register, vc-cvs-checkin, vc-cvs-find-version, vc-cvs-diff)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50909
diff
changeset
|
323 (let ((status (apply 'vc-cvs-command nil 1 file |
8c4130079acf
(vc-cvs-register, vc-cvs-checkin, vc-cvs-find-version, vc-cvs-diff)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50909
diff
changeset
|
324 "ci" (if rev (concat "-r" rev)) |
8c4130079acf
(vc-cvs-register, vc-cvs-checkin, vc-cvs-find-version, vc-cvs-diff)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50909
diff
changeset
|
325 (concat "-m" comment) |
8c4130079acf
(vc-cvs-register, vc-cvs-checkin, vc-cvs-find-version, vc-cvs-diff)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50909
diff
changeset
|
326 (vc-switches 'CVS 'checkin)))) |
31384
f6cb7dfe5e7c
(vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
327 (set-buffer "*vc*") |
f6cb7dfe5e7c
(vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
328 (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
|
329 (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
|
330 ;; Check checkin problem. |
3c95af2888f6
(vc-cvs-checkin): Check both status and error message after command.
André Spiegel <spiegel@gnu.org>
parents:
32747
diff
changeset
|
331 (cond |
3c95af2888f6
(vc-cvs-checkin): Check both status and error message after command.
André Spiegel <spiegel@gnu.org>
parents:
32747
diff
changeset
|
332 ((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
|
333 (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
|
334 (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
|
335 (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
|
336 "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
|
337 (t |
3c95af2888f6
(vc-cvs-checkin): Check both status and error message after command.
André Spiegel <spiegel@gnu.org>
parents:
32747
diff
changeset
|
338 (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
|
339 (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
|
340 (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
|
341 (error "Check-in failed")))) |
31384
f6cb7dfe5e7c
(vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
342 ;; Update file properties |
f6cb7dfe5e7c
(vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
343 (vc-file-setprop |
f6cb7dfe5e7c
(vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
344 file 'vc-workfile-version |
f6cb7dfe5e7c
(vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
345 (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
|
346 ;; 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
|
347 ;; 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
|
348 ;; 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
|
349 ;; vc-cvs-checkout-model). |
f6cb7dfe5e7c
(vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
350 (vc-file-setprop file 'vc-checkout-model nil) |
43447
79cf46e34420
Patch by Martin.Lorentzson@telia.com.
André Spiegel <spiegel@gnu.org>
parents:
42657
diff
changeset
|
351 |
79cf46e34420
Patch by Martin.Lorentzson@telia.com.
André Spiegel <spiegel@gnu.org>
parents:
42657
diff
changeset
|
352 ;; if this was an explicit check-in (does not include creation of |
79cf46e34420
Patch by Martin.Lorentzson@telia.com.
André Spiegel <spiegel@gnu.org>
parents:
42657
diff
changeset
|
353 ;; a branch), remove the sticky tag. |
79cf46e34420
Patch by Martin.Lorentzson@telia.com.
André Spiegel <spiegel@gnu.org>
parents:
42657
diff
changeset
|
354 (if (and rev (not (vc-cvs-valid-symbolic-tag-name-p rev))) |
44197
e255f8fa4f62
(vc-cvs-global-switches): New user option.
André Spiegel <spiegel@gnu.org>
parents:
44104
diff
changeset
|
355 (vc-cvs-command nil 0 file "update" "-A")))) |
31384
f6cb7dfe5e7c
(vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
356 |
47799
0d2f83a91144
(vc-cvs-find-version): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
47758
diff
changeset
|
357 (defun vc-cvs-find-version (file rev buffer) |
0d2f83a91144
(vc-cvs-find-version): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
47758
diff
changeset
|
358 (apply 'vc-cvs-command |
0d2f83a91144
(vc-cvs-find-version): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
47758
diff
changeset
|
359 buffer 0 file |
0d2f83a91144
(vc-cvs-find-version): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
47758
diff
changeset
|
360 "-Q" ; suppress diagnostic output |
0d2f83a91144
(vc-cvs-find-version): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
47758
diff
changeset
|
361 "update" |
0d2f83a91144
(vc-cvs-find-version): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
47758
diff
changeset
|
362 (and rev (not (string= rev "")) |
0d2f83a91144
(vc-cvs-find-version): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
47758
diff
changeset
|
363 (concat "-r" rev)) |
0d2f83a91144
(vc-cvs-find-version): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
47758
diff
changeset
|
364 "-p" |
50910
8c4130079acf
(vc-cvs-register, vc-cvs-checkin, vc-cvs-find-version, vc-cvs-diff)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50909
diff
changeset
|
365 (vc-switches 'CVS 'checkout))) |
47799
0d2f83a91144
(vc-cvs-find-version): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
47758
diff
changeset
|
366 |
35132
78bce41f17c5
(vc-cvs-latest-on-branch-p): Removed.
André Spiegel <spiegel@gnu.org>
parents:
33637
diff
changeset
|
367 (defun vc-cvs-checkout (file &optional editable rev workfile) |
31384
f6cb7dfe5e7c
(vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
368 "Retrieve a revision of FILE into a WORKFILE. |
35132
78bce41f17c5
(vc-cvs-latest-on-branch-p): Removed.
André Spiegel <spiegel@gnu.org>
parents:
33637
diff
changeset
|
369 EDITABLE non-nil means that the file should be writable. |
31384
f6cb7dfe5e7c
(vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
370 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
|
371 (let ((filename (or workfile file)) |
f6cb7dfe5e7c
(vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
372 (file-buffer (get-file-buffer file)) |
f6cb7dfe5e7c
(vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
373 switches) |
f6cb7dfe5e7c
(vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
374 (message "Checking out %s..." filename) |
f6cb7dfe5e7c
(vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
375 (save-excursion |
f6cb7dfe5e7c
(vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
376 ;; 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
|
377 (if file-buffer (set-buffer file-buffer)) |
50910
8c4130079acf
(vc-cvs-register, vc-cvs-checkin, vc-cvs-find-version, vc-cvs-diff)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50909
diff
changeset
|
378 (setq switches (vc-switches 'CVS 'checkout)) |
31384
f6cb7dfe5e7c
(vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
379 ;; Save this buffer's default-directory |
f6cb7dfe5e7c
(vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
380 ;; 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
|
381 ;; in the same buffer it was saved in. |
f6cb7dfe5e7c
(vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
382 (let ((default-directory default-directory)) |
f6cb7dfe5e7c
(vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
383 (save-excursion |
f6cb7dfe5e7c
(vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
384 ;; 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
|
385 ;; the file in the right place. |
f6cb7dfe5e7c
(vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
386 (setq default-directory (file-name-directory filename)) |
f6cb7dfe5e7c
(vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
387 (if workfile |
35569 | 388 (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
|
389 (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
|
390 (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
|
391 (when backup-name |
35569 | 392 (copy-file filename backup-name |
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
|
393 '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
|
394 (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
|
395 (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
|
396 (logior (file-modes filename) 128)))) |
31384
f6cb7dfe5e7c
(vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
397 (unwind-protect |
f6cb7dfe5e7c
(vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
398 (progn |
f6cb7dfe5e7c
(vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
399 (let ((coding-system-for-read 'no-conversion) |
f6cb7dfe5e7c
(vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
400 (coding-system-for-write 'no-conversion)) |
f6cb7dfe5e7c
(vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
401 (with-temp-file filename |
44197
e255f8fa4f62
(vc-cvs-global-switches): New user option.
André Spiegel <spiegel@gnu.org>
parents:
44104
diff
changeset
|
402 (apply 'vc-cvs-command |
e255f8fa4f62
(vc-cvs-global-switches): New user option.
André Spiegel <spiegel@gnu.org>
parents:
44104
diff
changeset
|
403 (current-buffer) 0 file |
31384
f6cb7dfe5e7c
(vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
404 "-Q" ; suppress diagnostic output |
43727
1163adb21e5d
(vc-cvs-diff-tree): Fix typo in parameter names.
André Spiegel <spiegel@gnu.org>
parents:
43533
diff
changeset
|
405 "update" |
48965
322a31d667aa
(vc-cvs-checkout): Handle t argument for REV.
André Spiegel <spiegel@gnu.org>
parents:
47917
diff
changeset
|
406 (and (stringp rev) |
322a31d667aa
(vc-cvs-checkout): Handle t argument for REV.
André Spiegel <spiegel@gnu.org>
parents:
47917
diff
changeset
|
407 (not (string= rev "")) |
31384
f6cb7dfe5e7c
(vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
408 (concat "-r" rev)) |
f6cb7dfe5e7c
(vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
409 "-p" |
f6cb7dfe5e7c
(vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
410 switches))) |
f6cb7dfe5e7c
(vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
411 (setq failed nil)) |
35569 | 412 (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
|
413 (if backup-name |
35569 | 414 (rename-file backup-name filename |
33637
6cab2125de9c
(vc-cvs-checkout): Fix bug that broke C-x v ~-style checkouts.
André Spiegel <spiegel@gnu.org>
parents:
33560
diff
changeset
|
415 '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
|
416 (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
|
417 (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
|
418 (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
|
419 (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
|
420 (delete-file backup-name))))) |
31384
f6cb7dfe5e7c
(vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
421 (if (and (file-exists-p file) (not rev)) |
f6cb7dfe5e7c
(vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
422 ;; 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
|
423 ;; if necessary (using `cvs-edit' if requested). |
50910
8c4130079acf
(vc-cvs-register, vc-cvs-checkin, vc-cvs-find-version, vc-cvs-diff)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50909
diff
changeset
|
424 (and editable (not (eq (vc-cvs-checkout-model file) 'implicit)) |
48965
322a31d667aa
(vc-cvs-checkout): Handle t argument for REV.
André Spiegel <spiegel@gnu.org>
parents:
47917
diff
changeset
|
425 (if vc-cvs-use-edit |
322a31d667aa
(vc-cvs-checkout): Handle t argument for REV.
André Spiegel <spiegel@gnu.org>
parents:
47917
diff
changeset
|
426 (vc-cvs-command nil 0 file "edit") |
322a31d667aa
(vc-cvs-checkout): Handle t argument for REV.
André Spiegel <spiegel@gnu.org>
parents:
47917
diff
changeset
|
427 (set-file-modes file (logior (file-modes file) 128)) |
322a31d667aa
(vc-cvs-checkout): Handle t argument for REV.
André Spiegel <spiegel@gnu.org>
parents:
47917
diff
changeset
|
428 (if file-buffer (toggle-read-only -1)))) |
322a31d667aa
(vc-cvs-checkout): Handle t argument for REV.
André Spiegel <spiegel@gnu.org>
parents:
47917
diff
changeset
|
429 ;; Check out a particular version (or recreate the file). |
322a31d667aa
(vc-cvs-checkout): Handle t argument for REV.
André Spiegel <spiegel@gnu.org>
parents:
47917
diff
changeset
|
430 (vc-file-setprop file 'vc-workfile-version nil) |
322a31d667aa
(vc-cvs-checkout): Handle t argument for REV.
André Spiegel <spiegel@gnu.org>
parents:
47917
diff
changeset
|
431 (apply 'vc-cvs-command nil 0 file |
322a31d667aa
(vc-cvs-checkout): Handle t argument for REV.
André Spiegel <spiegel@gnu.org>
parents:
47917
diff
changeset
|
432 (and editable |
322a31d667aa
(vc-cvs-checkout): Handle t argument for REV.
André Spiegel <spiegel@gnu.org>
parents:
47917
diff
changeset
|
433 (or (not (file-exists-p file)) |
322a31d667aa
(vc-cvs-checkout): Handle t argument for REV.
André Spiegel <spiegel@gnu.org>
parents:
47917
diff
changeset
|
434 (not (eq (vc-cvs-checkout-model file) |
322a31d667aa
(vc-cvs-checkout): Handle t argument for REV.
André Spiegel <spiegel@gnu.org>
parents:
47917
diff
changeset
|
435 'implicit))) |
322a31d667aa
(vc-cvs-checkout): Handle t argument for REV.
André Spiegel <spiegel@gnu.org>
parents:
47917
diff
changeset
|
436 "-w") |
322a31d667aa
(vc-cvs-checkout): Handle t argument for REV.
André Spiegel <spiegel@gnu.org>
parents:
47917
diff
changeset
|
437 "update" |
51164
0b871f4efb59
(vc-cvs-checkout): Don't leave the branch when REV is t.
André Spiegel <spiegel@gnu.org>
parents:
50923
diff
changeset
|
438 (when rev |
0b871f4efb59
(vc-cvs-checkout): Don't leave the branch when REV is t.
André Spiegel <spiegel@gnu.org>
parents:
50923
diff
changeset
|
439 (unless (eq rev t) |
0b871f4efb59
(vc-cvs-checkout): Don't leave the branch when REV is t.
André Spiegel <spiegel@gnu.org>
parents:
50923
diff
changeset
|
440 ;; default for verbose checkout: clear the |
0b871f4efb59
(vc-cvs-checkout): Don't leave the branch when REV is t.
André Spiegel <spiegel@gnu.org>
parents:
50923
diff
changeset
|
441 ;; sticky tag so that the actual update will |
0b871f4efb59
(vc-cvs-checkout): Don't leave the branch when REV is t.
André Spiegel <spiegel@gnu.org>
parents:
50923
diff
changeset
|
442 ;; get the head of the trunk |
0b871f4efb59
(vc-cvs-checkout): Don't leave the branch when REV is t.
André Spiegel <spiegel@gnu.org>
parents:
50923
diff
changeset
|
443 (if (string= rev "") |
0b871f4efb59
(vc-cvs-checkout): Don't leave the branch when REV is t.
André Spiegel <spiegel@gnu.org>
parents:
50923
diff
changeset
|
444 "-A" |
0b871f4efb59
(vc-cvs-checkout): Don't leave the branch when REV is t.
André Spiegel <spiegel@gnu.org>
parents:
50923
diff
changeset
|
445 (concat "-r" rev)))) |
48965
322a31d667aa
(vc-cvs-checkout): Handle t argument for REV.
André Spiegel <spiegel@gnu.org>
parents:
47917
diff
changeset
|
446 switches)))) |
31384
f6cb7dfe5e7c
(vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
447 (vc-mode-line file) |
f6cb7dfe5e7c
(vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
448 (message "Checking out %s...done" filename))))) |
f6cb7dfe5e7c
(vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
449 |
50923
3eab629b1239
(vc-cvs-mode-line-string): Use vc-default-mode-line-string.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50910
diff
changeset
|
450 (defun vc-cvs-delete-file (file) |
3eab629b1239
(vc-cvs-mode-line-string): Use vc-default-mode-line-string.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50910
diff
changeset
|
451 (vc-cvs-command nil 0 file "remove" "-f")) |
3eab629b1239
(vc-cvs-mode-line-string): Use vc-default-mode-line-string.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50910
diff
changeset
|
452 |
39001
d13c2139752b
(vc-*-revert-file): Handle new optional arg CONTENTS-DONE.
André Spiegel <spiegel@gnu.org>
parents:
38288
diff
changeset
|
453 (defun vc-cvs-revert (file &optional contents-done) |
33560 | 454 "Revert FILE to the version it was based on." |
39001
d13c2139752b
(vc-*-revert-file): Handle new optional arg CONTENTS-DONE.
André Spiegel <spiegel@gnu.org>
parents:
38288
diff
changeset
|
455 (unless contents-done |
d13c2139752b
(vc-*-revert-file): Handle new optional arg CONTENTS-DONE.
André Spiegel <spiegel@gnu.org>
parents:
38288
diff
changeset
|
456 ;; Check out via standard output (caused by the final argument |
d13c2139752b
(vc-*-revert-file): Handle new optional arg CONTENTS-DONE.
André Spiegel <spiegel@gnu.org>
parents:
38288
diff
changeset
|
457 ;; FILE below), so that no sticky tag is set. |
50910
8c4130079acf
(vc-cvs-register, vc-cvs-checkin, vc-cvs-find-version, vc-cvs-diff)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50909
diff
changeset
|
458 (vc-cvs-checkout file nil (vc-workfile-version file) file)) |
39001
d13c2139752b
(vc-*-revert-file): Handle new optional arg CONTENTS-DONE.
André Spiegel <spiegel@gnu.org>
parents:
38288
diff
changeset
|
459 (unless (eq (vc-checkout-model file) 'implicit) |
d13c2139752b
(vc-*-revert-file): Handle new optional arg CONTENTS-DONE.
André Spiegel <spiegel@gnu.org>
parents:
38288
diff
changeset
|
460 (if vc-cvs-use-edit |
44197
e255f8fa4f62
(vc-cvs-global-switches): New user option.
André Spiegel <spiegel@gnu.org>
parents:
44104
diff
changeset
|
461 (vc-cvs-command nil 0 file "unedit") |
39001
d13c2139752b
(vc-*-revert-file): Handle new optional arg CONTENTS-DONE.
André Spiegel <spiegel@gnu.org>
parents:
38288
diff
changeset
|
462 ;; Make the file read-only by switching off all w-bits |
d13c2139752b
(vc-*-revert-file): Handle new optional arg CONTENTS-DONE.
André Spiegel <spiegel@gnu.org>
parents:
38288
diff
changeset
|
463 (set-file-modes file (logand (file-modes file) 3950))))) |
33560 | 464 |
465 (defun vc-cvs-merge (file first-version &optional second-version) | |
466 "Merge changes into current working copy of FILE. | |
467 The changes are between FIRST-VERSION and SECOND-VERSION." | |
44197
e255f8fa4f62
(vc-cvs-global-switches): New user option.
André Spiegel <spiegel@gnu.org>
parents:
44104
diff
changeset
|
468 (vc-cvs-command nil 0 file |
33560 | 469 "update" "-kk" |
470 (concat "-j" first-version) | |
471 (concat "-j" second-version)) | |
472 (vc-file-setprop file 'vc-state 'edited) | |
50645
4b6925d144de
(vc-cvs-dir-state): Use vc-cvs-command.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50453
diff
changeset
|
473 (with-current-buffer (get-buffer "*vc*") |
33560 | 474 (goto-char (point-min)) |
475 (if (re-search-forward "conflicts during merge" nil t) | |
476 1 ; signal error | |
477 0))) ; signal success | |
478 | |
479 (defun vc-cvs-merge-news (file) | |
480 "Merge in any new changes made to FILE." | |
481 (message "Merging changes into %s..." file) | |
50645
4b6925d144de
(vc-cvs-dir-state): Use vc-cvs-command.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50453
diff
changeset
|
482 ;; (vc-file-setprop file 'vc-workfile-version nil) |
4b6925d144de
(vc-cvs-dir-state): Use vc-cvs-command.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50453
diff
changeset
|
483 (vc-file-setprop file 'vc-checkout-time 0) |
4b6925d144de
(vc-cvs-dir-state): Use vc-cvs-command.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50453
diff
changeset
|
484 (vc-cvs-command nil 0 file "update") |
4b6925d144de
(vc-cvs-dir-state): Use vc-cvs-command.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50453
diff
changeset
|
485 ;; Analyze the merge result reported by CVS, and set |
4b6925d144de
(vc-cvs-dir-state): Use vc-cvs-command.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50453
diff
changeset
|
486 ;; file properties accordingly. |
4b6925d144de
(vc-cvs-dir-state): Use vc-cvs-command.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50453
diff
changeset
|
487 (with-current-buffer (get-buffer "*vc*") |
33560 | 488 (goto-char (point-min)) |
489 ;; get new workfile version | |
50645
4b6925d144de
(vc-cvs-dir-state): Use vc-cvs-command.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50453
diff
changeset
|
490 (if (re-search-forward |
4b6925d144de
(vc-cvs-dir-state): Use vc-cvs-command.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50453
diff
changeset
|
491 "^Merging differences between [0-9.]* and \\([0-9.]*\\) into" nil t) |
33560 | 492 (vc-file-setprop file 'vc-workfile-version (match-string 1)) |
493 (vc-file-setprop file 'vc-workfile-version nil)) | |
494 ;; get file status | |
495 (prog1 | |
496 (if (eq (buffer-size) 0) | |
497 0 ;; there were no news; indicate success | |
498 (if (re-search-forward | |
499 (concat "^\\([CMUP] \\)?" | |
500 (regexp-quote (file-name-nondirectory file)) | |
501 "\\( already contains the differences between \\)?") | |
502 nil t) | |
503 (cond | |
504 ;; Merge successful, we are in sync with repository now | |
505 ((or (match-string 2) | |
506 (string= (match-string 1) "U ") | |
507 (string= (match-string 1) "P ")) | |
508 (vc-file-setprop file 'vc-state 'up-to-date) | |
509 (vc-file-setprop file 'vc-checkout-time | |
510 (nth 5 (file-attributes file))) | |
511 0);; indicate success to the caller | |
512 ;; Merge successful, but our own changes are still in the file | |
513 ((string= (match-string 1) "M ") | |
514 (vc-file-setprop file 'vc-state 'edited) | |
515 0);; indicate success to the caller | |
516 ;; Conflicts detected! | |
517 (t | |
518 (vc-file-setprop file 'vc-state 'edited) | |
519 1);; signal the error to the caller | |
520 ) | |
521 (pop-to-buffer "*vc*") | |
522 (error "Couldn't analyze cvs update result"))) | |
523 (message "Merging changes into %s...done" file)))) | |
524 | |
35569 | 525 |
33560 | 526 ;;; |
527 ;;; History functions | |
528 ;;; | |
529 | |
54465
2e4ddb8bfffd
(vc-cvs-print-log, vc-cvs-diff): Add optional BUFFER argument.
André Spiegel <spiegel@gnu.org>
parents:
53631
diff
changeset
|
530 (defun vc-cvs-print-log (file &optional buffer) |
33560 | 531 "Get change log associated with FILE." |
44197
e255f8fa4f62
(vc-cvs-global-switches): New user option.
André Spiegel <spiegel@gnu.org>
parents:
44104
diff
changeset
|
532 (vc-cvs-command |
54465
2e4ddb8bfffd
(vc-cvs-print-log, vc-cvs-diff): Add optional BUFFER argument.
André Spiegel <spiegel@gnu.org>
parents:
53631
diff
changeset
|
533 buffer |
51733
2b72fd42f02e
(vc-cvs-repository-hostname): New operation.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
51164
diff
changeset
|
534 (if (and (vc-stay-local-p file) (fboundp 'start-process)) 'async 0) |
44197
e255f8fa4f62
(vc-cvs-global-switches): New user option.
André Spiegel <spiegel@gnu.org>
parents:
44104
diff
changeset
|
535 file "log")) |
33560 | 536 |
54465
2e4ddb8bfffd
(vc-cvs-print-log, vc-cvs-diff): Add optional BUFFER argument.
André Spiegel <spiegel@gnu.org>
parents:
53631
diff
changeset
|
537 (defun vc-cvs-diff (file &optional oldvers newvers buffer) |
33560 | 538 "Get a difference report using CVS between two versions of FILE." |
50910
8c4130079acf
(vc-cvs-register, vc-cvs-checkin, vc-cvs-find-version, vc-cvs-diff)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50909
diff
changeset
|
539 (if (string= (vc-workfile-version file) "0") |
8c4130079acf
(vc-cvs-register, vc-cvs-checkin, vc-cvs-find-version, vc-cvs-diff)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50909
diff
changeset
|
540 ;; This file is added but not yet committed; there is no master file. |
8c4130079acf
(vc-cvs-register, vc-cvs-checkin, vc-cvs-find-version, vc-cvs-diff)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50909
diff
changeset
|
541 (if (or oldvers newvers) |
8c4130079acf
(vc-cvs-register, vc-cvs-checkin, vc-cvs-find-version, vc-cvs-diff)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50909
diff
changeset
|
542 (error "No revisions of %s exist" file) |
8c4130079acf
(vc-cvs-register, vc-cvs-checkin, vc-cvs-find-version, vc-cvs-diff)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50909
diff
changeset
|
543 ;; We regard this as "changed". |
8c4130079acf
(vc-cvs-register, vc-cvs-checkin, vc-cvs-find-version, vc-cvs-diff)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50909
diff
changeset
|
544 ;; Diff it against /dev/null. |
8c4130079acf
(vc-cvs-register, vc-cvs-checkin, vc-cvs-find-version, vc-cvs-diff)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50909
diff
changeset
|
545 ;; Note: this is NOT a "cvs diff". |
54465
2e4ddb8bfffd
(vc-cvs-print-log, vc-cvs-diff): Add optional BUFFER argument.
André Spiegel <spiegel@gnu.org>
parents:
53631
diff
changeset
|
546 (apply 'vc-do-command (or buffer "*vc-diff*") |
50910
8c4130079acf
(vc-cvs-register, vc-cvs-checkin, vc-cvs-find-version, vc-cvs-diff)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50909
diff
changeset
|
547 1 "diff" file |
8c4130079acf
(vc-cvs-register, vc-cvs-checkin, vc-cvs-find-version, vc-cvs-diff)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50909
diff
changeset
|
548 (append (vc-switches nil 'diff) '("/dev/null"))) |
8c4130079acf
(vc-cvs-register, vc-cvs-checkin, vc-cvs-find-version, vc-cvs-diff)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50909
diff
changeset
|
549 ;; Even if it's empty, it's locally modified. |
8c4130079acf
(vc-cvs-register, vc-cvs-checkin, vc-cvs-find-version, vc-cvs-diff)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50909
diff
changeset
|
550 1) |
59443
fd6e4e55ca84
(vc-cvs-diff): Don't diff asynchronously if vc-disable-async-diff is
André Spiegel <spiegel@gnu.org>
parents:
58640
diff
changeset
|
551 (let* ((async (and (not vc-disable-async-diff) |
fd6e4e55ca84
(vc-cvs-diff): Don't diff asynchronously if vc-disable-async-diff is
André Spiegel <spiegel@gnu.org>
parents:
58640
diff
changeset
|
552 (vc-stay-local-p file) |
fd6e4e55ca84
(vc-cvs-diff): Don't diff asynchronously if vc-disable-async-diff is
André Spiegel <spiegel@gnu.org>
parents:
58640
diff
changeset
|
553 (fboundp 'start-process))) |
54465
2e4ddb8bfffd
(vc-cvs-print-log, vc-cvs-diff): Add optional BUFFER argument.
André Spiegel <spiegel@gnu.org>
parents:
53631
diff
changeset
|
554 (status (apply 'vc-cvs-command (or buffer "*vc-diff*") |
50910
8c4130079acf
(vc-cvs-register, vc-cvs-checkin, vc-cvs-find-version, vc-cvs-diff)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50909
diff
changeset
|
555 (if async 'async 1) |
8c4130079acf
(vc-cvs-register, vc-cvs-checkin, vc-cvs-find-version, vc-cvs-diff)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50909
diff
changeset
|
556 file "diff" |
8c4130079acf
(vc-cvs-register, vc-cvs-checkin, vc-cvs-find-version, vc-cvs-diff)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50909
diff
changeset
|
557 (and oldvers (concat "-r" oldvers)) |
8c4130079acf
(vc-cvs-register, vc-cvs-checkin, vc-cvs-find-version, vc-cvs-diff)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50909
diff
changeset
|
558 (and newvers (concat "-r" newvers)) |
8c4130079acf
(vc-cvs-register, vc-cvs-checkin, vc-cvs-find-version, vc-cvs-diff)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50909
diff
changeset
|
559 (vc-switches 'CVS 'diff)))) |
8c4130079acf
(vc-cvs-register, vc-cvs-checkin, vc-cvs-find-version, vc-cvs-diff)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50909
diff
changeset
|
560 (if async 1 status)))) ; async diff, pessimistic assumption |
33560 | 561 |
40125
b2e4b1a5315a
(vc-cvs-diff-tree): New function.
André Spiegel <spiegel@gnu.org>
parents:
39001
diff
changeset
|
562 (defun vc-cvs-diff-tree (dir &optional rev1 rev2) |
b2e4b1a5315a
(vc-cvs-diff-tree): New function.
André Spiegel <spiegel@gnu.org>
parents:
39001
diff
changeset
|
563 "Diff all files at and below DIR." |
b2e4b1a5315a
(vc-cvs-diff-tree): New function.
André Spiegel <spiegel@gnu.org>
parents:
39001
diff
changeset
|
564 (with-current-buffer "*vc-diff*" |
b2e4b1a5315a
(vc-cvs-diff-tree): New function.
André Spiegel <spiegel@gnu.org>
parents:
39001
diff
changeset
|
565 (setq default-directory dir) |
51733
2b72fd42f02e
(vc-cvs-repository-hostname): New operation.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
51164
diff
changeset
|
566 (if (vc-stay-local-p dir) |
40125
b2e4b1a5315a
(vc-cvs-diff-tree): New function.
André Spiegel <spiegel@gnu.org>
parents:
39001
diff
changeset
|
567 ;; local diff: do it filewise, and only for files that are modified |
b2e4b1a5315a
(vc-cvs-diff-tree): New function.
André Spiegel <spiegel@gnu.org>
parents:
39001
diff
changeset
|
568 (vc-file-tree-walk |
b2e4b1a5315a
(vc-cvs-diff-tree): New function.
André Spiegel <spiegel@gnu.org>
parents:
39001
diff
changeset
|
569 dir |
b2e4b1a5315a
(vc-cvs-diff-tree): New function.
André Spiegel <spiegel@gnu.org>
parents:
39001
diff
changeset
|
570 (lambda (f) |
b2e4b1a5315a
(vc-cvs-diff-tree): New function.
André Spiegel <spiegel@gnu.org>
parents:
39001
diff
changeset
|
571 (vc-exec-after |
b2e4b1a5315a
(vc-cvs-diff-tree): New function.
André Spiegel <spiegel@gnu.org>
parents:
39001
diff
changeset
|
572 `(let ((coding-system-for-read (vc-coding-system-for-diff ',f))) |
b2e4b1a5315a
(vc-cvs-diff-tree): New function.
André Spiegel <spiegel@gnu.org>
parents:
39001
diff
changeset
|
573 ;; possible optimization: fetch the state of all files |
b2e4b1a5315a
(vc-cvs-diff-tree): New function.
André Spiegel <spiegel@gnu.org>
parents:
39001
diff
changeset
|
574 ;; in the tree via vc-cvs-dir-state-heuristic |
b2e4b1a5315a
(vc-cvs-diff-tree): New function.
André Spiegel <spiegel@gnu.org>
parents:
39001
diff
changeset
|
575 (unless (vc-up-to-date-p ',f) |
b2e4b1a5315a
(vc-cvs-diff-tree): New function.
André Spiegel <spiegel@gnu.org>
parents:
39001
diff
changeset
|
576 (message "Looking at %s" ',f) |
43727
1163adb21e5d
(vc-cvs-diff-tree): Fix typo in parameter names.
André Spiegel <spiegel@gnu.org>
parents:
43533
diff
changeset
|
577 (vc-diff-internal ',f ',rev1 ',rev2)))))) |
40125
b2e4b1a5315a
(vc-cvs-diff-tree): New function.
André Spiegel <spiegel@gnu.org>
parents:
39001
diff
changeset
|
578 ;; cvs diff: use a single call for the entire tree |
b2e4b1a5315a
(vc-cvs-diff-tree): New function.
André Spiegel <spiegel@gnu.org>
parents:
39001
diff
changeset
|
579 (let ((coding-system-for-read |
b2e4b1a5315a
(vc-cvs-diff-tree): New function.
André Spiegel <spiegel@gnu.org>
parents:
39001
diff
changeset
|
580 (or coding-system-for-read 'undecided))) |
44197
e255f8fa4f62
(vc-cvs-global-switches): New user option.
André Spiegel <spiegel@gnu.org>
parents:
44104
diff
changeset
|
581 (apply 'vc-cvs-command "*vc-diff*" 1 nil "diff" |
43727
1163adb21e5d
(vc-cvs-diff-tree): Fix typo in parameter names.
André Spiegel <spiegel@gnu.org>
parents:
43533
diff
changeset
|
582 (and rev1 (concat "-r" rev1)) |
1163adb21e5d
(vc-cvs-diff-tree): Fix typo in parameter names.
André Spiegel <spiegel@gnu.org>
parents:
43533
diff
changeset
|
583 (and rev2 (concat "-r" rev2)) |
50910
8c4130079acf
(vc-cvs-register, vc-cvs-checkin, vc-cvs-find-version, vc-cvs-diff)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50909
diff
changeset
|
584 (vc-switches 'CVS 'diff)))))) |
40125
b2e4b1a5315a
(vc-cvs-diff-tree): New function.
André Spiegel <spiegel@gnu.org>
parents:
39001
diff
changeset
|
585 |
33545
5411250e7971
(vc-cvs-annotate-command): New optional arg VERSION. Use
André Spiegel <spiegel@gnu.org>
parents:
32959
diff
changeset
|
586 (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
|
587 "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
|
588 Optional arg VERSION is a version to annotate from." |
57913
f5d7d9bbc021
(vc-cvs-annotate-command): Delete extraneous lines from beginning of buffer.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
54465
diff
changeset
|
589 (vc-cvs-command buffer 0 file "annotate" (if version (concat "-r" version))) |
f5d7d9bbc021
(vc-cvs-annotate-command): Delete extraneous lines from beginning of buffer.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
54465
diff
changeset
|
590 (with-current-buffer buffer |
f5d7d9bbc021
(vc-cvs-annotate-command): Delete extraneous lines from beginning of buffer.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
54465
diff
changeset
|
591 (goto-char (point-min)) |
f5d7d9bbc021
(vc-cvs-annotate-command): Delete extraneous lines from beginning of buffer.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
54465
diff
changeset
|
592 (re-search-forward "^[0-9]") |
f5d7d9bbc021
(vc-cvs-annotate-command): Delete extraneous lines from beginning of buffer.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
54465
diff
changeset
|
593 (delete-region (point-min) (1- (point))))) |
31384
f6cb7dfe5e7c
(vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
594 |
40171
91eda91380cb
New scaling algorithm for vc-annotate.
André Spiegel <spiegel@gnu.org>
parents:
40125
diff
changeset
|
595 (defun vc-cvs-annotate-current-time () |
91eda91380cb
New scaling algorithm for vc-annotate.
André Spiegel <spiegel@gnu.org>
parents:
40125
diff
changeset
|
596 "Return the current time, based at midnight of the current day, and |
91eda91380cb
New scaling algorithm for vc-annotate.
André Spiegel <spiegel@gnu.org>
parents:
40125
diff
changeset
|
597 encoded as fractional days." |
91eda91380cb
New scaling algorithm for vc-annotate.
André Spiegel <spiegel@gnu.org>
parents:
40125
diff
changeset
|
598 (vc-annotate-convert-time |
91eda91380cb
New scaling algorithm for vc-annotate.
André Spiegel <spiegel@gnu.org>
parents:
40125
diff
changeset
|
599 (apply 'encode-time 0 0 0 (nthcdr 3 (decode-time (current-time)))))) |
91eda91380cb
New scaling algorithm for vc-annotate.
André Spiegel <spiegel@gnu.org>
parents:
40125
diff
changeset
|
600 |
91eda91380cb
New scaling algorithm for vc-annotate.
André Spiegel <spiegel@gnu.org>
parents:
40125
diff
changeset
|
601 (defun vc-cvs-annotate-time () |
91eda91380cb
New scaling algorithm for vc-annotate.
André Spiegel <spiegel@gnu.org>
parents:
40125
diff
changeset
|
602 "Return the time of the next annotation (as fraction of days) |
42206 | 603 systime, or nil if there is none." |
57916
990dbd4941c8
(vc-cvs-local-month-numbers): Delete var.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
57913
diff
changeset
|
604 (let* ((bol (point)) |
990dbd4941c8
(vc-cvs-local-month-numbers): Delete var.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
57913
diff
changeset
|
605 (cache (get-text-property bol 'vc-cvs-annotate-time)) |
990dbd4941c8
(vc-cvs-local-month-numbers): Delete var.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
57913
diff
changeset
|
606 buffer-read-only) |
990dbd4941c8
(vc-cvs-local-month-numbers): Delete var.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
57913
diff
changeset
|
607 (cond |
990dbd4941c8
(vc-cvs-local-month-numbers): Delete var.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
57913
diff
changeset
|
608 (cache) |
990dbd4941c8
(vc-cvs-local-month-numbers): Delete var.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
57913
diff
changeset
|
609 ((looking-at |
990dbd4941c8
(vc-cvs-local-month-numbers): Delete var.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
57913
diff
changeset
|
610 "^\\S-+\\s-+\\S-+\\s-+\\([0-9]+\\)-\\(\\sw+\\)-\\([0-9]+\\)): ") |
990dbd4941c8
(vc-cvs-local-month-numbers): Delete var.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
57913
diff
changeset
|
611 (let ((day (string-to-number (match-string 1))) |
990dbd4941c8
(vc-cvs-local-month-numbers): Delete var.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
57913
diff
changeset
|
612 (month (cdr (assq (intern (match-string 2)) |
990dbd4941c8
(vc-cvs-local-month-numbers): Delete var.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
57913
diff
changeset
|
613 '((Jan . 1) (Feb . 2) (Mar . 3) |
990dbd4941c8
(vc-cvs-local-month-numbers): Delete var.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
57913
diff
changeset
|
614 (Apr . 4) (May . 5) (Jun . 6) |
990dbd4941c8
(vc-cvs-local-month-numbers): Delete var.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
57913
diff
changeset
|
615 (Jul . 7) (Aug . 8) (Sep . 9) |
990dbd4941c8
(vc-cvs-local-month-numbers): Delete var.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
57913
diff
changeset
|
616 (Oct . 10) (Nov . 11) (Dec . 12))))) |
990dbd4941c8
(vc-cvs-local-month-numbers): Delete var.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
57913
diff
changeset
|
617 (year (let ((tmp (string-to-number (match-string 3)))) |
990dbd4941c8
(vc-cvs-local-month-numbers): Delete var.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
57913
diff
changeset
|
618 ;; Years 0..68 are 2000..2068. |
990dbd4941c8
(vc-cvs-local-month-numbers): Delete var.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
57913
diff
changeset
|
619 ;; Years 69..99 are 1969..1999. |
990dbd4941c8
(vc-cvs-local-month-numbers): Delete var.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
57913
diff
changeset
|
620 (+ (cond ((> 69 tmp) 2000) |
990dbd4941c8
(vc-cvs-local-month-numbers): Delete var.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
57913
diff
changeset
|
621 ((> 100 tmp) 1900) |
990dbd4941c8
(vc-cvs-local-month-numbers): Delete var.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
57913
diff
changeset
|
622 (t 0)) |
990dbd4941c8
(vc-cvs-local-month-numbers): Delete var.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
57913
diff
changeset
|
623 tmp)))) |
990dbd4941c8
(vc-cvs-local-month-numbers): Delete var.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
57913
diff
changeset
|
624 (put-text-property |
990dbd4941c8
(vc-cvs-local-month-numbers): Delete var.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
57913
diff
changeset
|
625 bol (1+ bol) 'vc-cvs-annotate-time |
990dbd4941c8
(vc-cvs-local-month-numbers): Delete var.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
57913
diff
changeset
|
626 (setq cache (cons |
990dbd4941c8
(vc-cvs-local-month-numbers): Delete var.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
57913
diff
changeset
|
627 ;; Position at end makes for nicer overlay result. |
990dbd4941c8
(vc-cvs-local-month-numbers): Delete var.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
57913
diff
changeset
|
628 (match-end 0) |
990dbd4941c8
(vc-cvs-local-month-numbers): Delete var.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
57913
diff
changeset
|
629 (vc-annotate-convert-time |
990dbd4941c8
(vc-cvs-local-month-numbers): Delete var.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
57913
diff
changeset
|
630 (encode-time 0 0 0 day month year)))))))) |
990dbd4941c8
(vc-cvs-local-month-numbers): Delete var.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
57913
diff
changeset
|
631 (when cache |
990dbd4941c8
(vc-cvs-local-month-numbers): Delete var.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
57913
diff
changeset
|
632 (goto-char (car cache)) ; fontify from here to eol |
990dbd4941c8
(vc-cvs-local-month-numbers): Delete var.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
57913
diff
changeset
|
633 (cdr cache)))) ; days (float) |
35569 | 634 |
53631
74e44ab76fa5
* vc-cvs.el (vc-cvs-annotate-extract-revision-at-line): New
André Spiegel <spiegel@gnu.org>
parents:
52717
diff
changeset
|
635 (defun vc-cvs-annotate-extract-revision-at-line () |
74e44ab76fa5
* vc-cvs.el (vc-cvs-annotate-extract-revision-at-line): New
André Spiegel <spiegel@gnu.org>
parents:
52717
diff
changeset
|
636 (save-excursion |
74e44ab76fa5
* vc-cvs.el (vc-cvs-annotate-extract-revision-at-line): New
André Spiegel <spiegel@gnu.org>
parents:
52717
diff
changeset
|
637 (beginning-of-line) |
74e44ab76fa5
* vc-cvs.el (vc-cvs-annotate-extract-revision-at-line): New
André Spiegel <spiegel@gnu.org>
parents:
52717
diff
changeset
|
638 (if (re-search-forward "^\\([0-9]+\\.[0-9]+\\(\\.[0-9]+\\)*\\) +(" |
74e44ab76fa5
* vc-cvs.el (vc-cvs-annotate-extract-revision-at-line): New
André Spiegel <spiegel@gnu.org>
parents:
52717
diff
changeset
|
639 (line-end-position) t) |
74e44ab76fa5
* vc-cvs.el (vc-cvs-annotate-extract-revision-at-line): New
André Spiegel <spiegel@gnu.org>
parents:
52717
diff
changeset
|
640 (match-string-no-properties 1) |
74e44ab76fa5
* vc-cvs.el (vc-cvs-annotate-extract-revision-at-line): New
André Spiegel <spiegel@gnu.org>
parents:
52717
diff
changeset
|
641 nil))) |
74e44ab76fa5
* vc-cvs.el (vc-cvs-annotate-extract-revision-at-line): New
André Spiegel <spiegel@gnu.org>
parents:
52717
diff
changeset
|
642 |
33560 | 643 ;;; |
644 ;;; Snapshot system | |
645 ;;; | |
646 | |
647 (defun vc-cvs-create-snapshot (dir name branchp) | |
648 "Assign to DIR's current version a given NAME. | |
649 If BRANCHP is non-nil, the name is created as a branch (and the current | |
650 workspace is immediately moved to that new branch)." | |
44197
e255f8fa4f62
(vc-cvs-global-switches): New user option.
André Spiegel <spiegel@gnu.org>
parents:
44104
diff
changeset
|
651 (vc-cvs-command nil 0 dir "tag" "-c" (if branchp "-b") name) |
e255f8fa4f62
(vc-cvs-global-switches): New user option.
André Spiegel <spiegel@gnu.org>
parents:
44104
diff
changeset
|
652 (when branchp (vc-cvs-command nil 0 dir "update" "-r" name))) |
33560 | 653 |
654 (defun vc-cvs-retrieve-snapshot (dir name update) | |
655 "Retrieve a snapshot at and below DIR. | |
656 NAME is the name of the snapshot; if it is empty, do a `cvs update'. | |
657 If UPDATE is non-nil, then update (resynch) any affected buffers." | |
658 (with-current-buffer (get-buffer-create "*vc*") | |
43447
79cf46e34420
Patch by Martin.Lorentzson@telia.com.
André Spiegel <spiegel@gnu.org>
parents:
42657
diff
changeset
|
659 (let ((default-directory dir) |
79cf46e34420
Patch by Martin.Lorentzson@telia.com.
André Spiegel <spiegel@gnu.org>
parents:
42657
diff
changeset
|
660 (sticky-tag)) |
33560 | 661 (erase-buffer) |
662 (if (or (not name) (string= name "")) | |
44197
e255f8fa4f62
(vc-cvs-global-switches): New user option.
André Spiegel <spiegel@gnu.org>
parents:
44104
diff
changeset
|
663 (vc-cvs-command t 0 nil "update") |
e255f8fa4f62
(vc-cvs-global-switches): New user option.
André Spiegel <spiegel@gnu.org>
parents:
44104
diff
changeset
|
664 (vc-cvs-command t 0 nil "update" "-r" name) |
43447
79cf46e34420
Patch by Martin.Lorentzson@telia.com.
André Spiegel <spiegel@gnu.org>
parents:
42657
diff
changeset
|
665 (setq sticky-tag name)) |
33560 | 666 (when update |
667 (goto-char (point-min)) | |
668 (while (not (eobp)) | |
669 (if (looking-at "\\([CMUP]\\) \\(.*\\)") | |
670 (let* ((file (expand-file-name (match-string 2) dir)) | |
671 (state (match-string 1)) | |
672 (buffer (find-buffer-visiting file))) | |
673 (when buffer | |
674 (cond | |
675 ((or (string= state "U") | |
676 (string= state "P")) | |
677 (vc-file-setprop file 'vc-state 'up-to-date) | |
678 (vc-file-setprop file 'vc-workfile-version nil) | |
679 (vc-file-setprop file 'vc-checkout-time | |
680 (nth 5 (file-attributes file)))) | |
681 ((or (string= state "M") | |
682 (string= state "C")) | |
683 (vc-file-setprop file 'vc-state 'edited) | |
684 (vc-file-setprop file 'vc-workfile-version nil) | |
685 (vc-file-setprop file 'vc-checkout-time 0))) | |
43447
79cf46e34420
Patch by Martin.Lorentzson@telia.com.
André Spiegel <spiegel@gnu.org>
parents:
42657
diff
changeset
|
686 (vc-file-setprop file 'vc-cvs-sticky-tag sticky-tag) |
33560 | 687 (vc-resynch-buffer file t t)))) |
688 (forward-line 1)))))) | |
689 | |
35569 | 690 |
33560 | 691 ;;; |
692 ;;; Miscellaneous | |
693 ;;; | |
694 | |
51733
2b72fd42f02e
(vc-cvs-repository-hostname): New operation.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
51164
diff
changeset
|
695 (defalias 'vc-cvs-make-version-backups-p 'vc-stay-local-p |
50645
4b6925d144de
(vc-cvs-dir-state): Use vc-cvs-command.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50453
diff
changeset
|
696 "Return non-nil if version backups should be made for FILE.") |
33560 | 697 |
698 (defun vc-cvs-check-headers () | |
699 "Check if the current file has any headers in it." | |
700 (save-excursion | |
701 (goto-char (point-min)) | |
702 (re-search-forward "\\$[A-Za-z\300-\326\330-\366\370-\377]+\ | |
703 \\(: [\t -#%-\176\240-\377]*\\)?\\$" nil t))) | |
704 | |
35569 | 705 |
33560 | 706 ;;; |
707 ;;; Internal functions | |
708 ;;; | |
709 | |
44197
e255f8fa4f62
(vc-cvs-global-switches): New user option.
André Spiegel <spiegel@gnu.org>
parents:
44104
diff
changeset
|
710 (defun vc-cvs-command (buffer okstatus file &rest flags) |
e255f8fa4f62
(vc-cvs-global-switches): New user option.
André Spiegel <spiegel@gnu.org>
parents:
44104
diff
changeset
|
711 "A wrapper around `vc-do-command' for use in vc-cvs.el. |
e255f8fa4f62
(vc-cvs-global-switches): New user option.
André Spiegel <spiegel@gnu.org>
parents:
44104
diff
changeset
|
712 The difference to vc-do-command is that this function always invokes `cvs', |
e255f8fa4f62
(vc-cvs-global-switches): New user option.
André Spiegel <spiegel@gnu.org>
parents:
44104
diff
changeset
|
713 and that it passes `vc-cvs-global-switches' to it before FLAGS." |
e255f8fa4f62
(vc-cvs-global-switches): New user option.
André Spiegel <spiegel@gnu.org>
parents:
44104
diff
changeset
|
714 (apply 'vc-do-command buffer okstatus "cvs" file |
44436
f9db51bb423b
(vc-cvs-checkin): Pass the required argument to `error'.
Sam Steingold <sds@gnu.org>
parents:
44197
diff
changeset
|
715 (if (stringp vc-cvs-global-switches) |
44197
e255f8fa4f62
(vc-cvs-global-switches): New user option.
André Spiegel <spiegel@gnu.org>
parents:
44104
diff
changeset
|
716 (cons vc-cvs-global-switches flags) |
e255f8fa4f62
(vc-cvs-global-switches): New user option.
André Spiegel <spiegel@gnu.org>
parents:
44104
diff
changeset
|
717 (append vc-cvs-global-switches |
e255f8fa4f62
(vc-cvs-global-switches): New user option.
André Spiegel <spiegel@gnu.org>
parents:
44104
diff
changeset
|
718 flags)))) |
e255f8fa4f62
(vc-cvs-global-switches): New user option.
André Spiegel <spiegel@gnu.org>
parents:
44104
diff
changeset
|
719 |
51733
2b72fd42f02e
(vc-cvs-repository-hostname): New operation.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
51164
diff
changeset
|
720 (defalias 'vc-cvs-stay-local-p 'vc-stay-local-p) ;Back-compatibility. |
2b72fd42f02e
(vc-cvs-repository-hostname): New operation.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
51164
diff
changeset
|
721 |
2b72fd42f02e
(vc-cvs-repository-hostname): New operation.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
51164
diff
changeset
|
722 (defun vc-cvs-repository-hostname (dirname) |
2b72fd42f02e
(vc-cvs-repository-hostname): New operation.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
51164
diff
changeset
|
723 "Hostname of the CVS server associated to workarea DIRNAME." |
2b72fd42f02e
(vc-cvs-repository-hostname): New operation.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
51164
diff
changeset
|
724 (let ((rootname (expand-file-name "CVS/Root" dirname))) |
2b72fd42f02e
(vc-cvs-repository-hostname): New operation.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
51164
diff
changeset
|
725 (when (file-readable-p rootname) |
2b72fd42f02e
(vc-cvs-repository-hostname): New operation.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
51164
diff
changeset
|
726 (with-temp-buffer |
2b72fd42f02e
(vc-cvs-repository-hostname): New operation.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
51164
diff
changeset
|
727 (let ((coding-system-for-read |
2b72fd42f02e
(vc-cvs-repository-hostname): New operation.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
51164
diff
changeset
|
728 (or file-name-coding-system |
2b72fd42f02e
(vc-cvs-repository-hostname): New operation.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
51164
diff
changeset
|
729 default-file-name-coding-system))) |
2b72fd42f02e
(vc-cvs-repository-hostname): New operation.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
51164
diff
changeset
|
730 (vc-insert-file rootname)) |
2b72fd42f02e
(vc-cvs-repository-hostname): New operation.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
51164
diff
changeset
|
731 (goto-char (point-min)) |
2b72fd42f02e
(vc-cvs-repository-hostname): New operation.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
51164
diff
changeset
|
732 (nth 2 (vc-cvs-parse-root |
2b72fd42f02e
(vc-cvs-repository-hostname): New operation.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
51164
diff
changeset
|
733 (buffer-substring (point) |
2b72fd42f02e
(vc-cvs-repository-hostname): New operation.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
51164
diff
changeset
|
734 (line-end-position)))))))) |
50668
01d84e9d30e0
Patch by Wolfgang Scherer <Wolfgang.Scherer@gmx.de>
André Spiegel <spiegel@gnu.org>
parents:
50645
diff
changeset
|
735 |
50898
8806616471e2
(vc-cvs-dired-state-info): Use `added' for added files and
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50671
diff
changeset
|
736 (defun vc-cvs-parse-root (root) |
50668
01d84e9d30e0
Patch by Wolfgang Scherer <Wolfgang.Scherer@gmx.de>
André Spiegel <spiegel@gnu.org>
parents:
50645
diff
changeset
|
737 "Split CVS ROOT specification string into a list of fields. |
01d84e9d30e0
Patch by Wolfgang Scherer <Wolfgang.Scherer@gmx.de>
André Spiegel <spiegel@gnu.org>
parents:
50645
diff
changeset
|
738 A CVS root specification of the form |
01d84e9d30e0
Patch by Wolfgang Scherer <Wolfgang.Scherer@gmx.de>
André Spiegel <spiegel@gnu.org>
parents:
50645
diff
changeset
|
739 [:METHOD:][[USER@]HOSTNAME:]/path/to/repository |
01d84e9d30e0
Patch by Wolfgang Scherer <Wolfgang.Scherer@gmx.de>
André Spiegel <spiegel@gnu.org>
parents:
50645
diff
changeset
|
740 is converted to a normalized record with the following structure: |
01d84e9d30e0
Patch by Wolfgang Scherer <Wolfgang.Scherer@gmx.de>
André Spiegel <spiegel@gnu.org>
parents:
50645
diff
changeset
|
741 \(METHOD USER HOSTNAME CVS-ROOT). |
01d84e9d30e0
Patch by Wolfgang Scherer <Wolfgang.Scherer@gmx.de>
André Spiegel <spiegel@gnu.org>
parents:
50645
diff
changeset
|
742 The default METHOD for a CVS root of the form |
01d84e9d30e0
Patch by Wolfgang Scherer <Wolfgang.Scherer@gmx.de>
André Spiegel <spiegel@gnu.org>
parents:
50645
diff
changeset
|
743 /path/to/repository |
01d84e9d30e0
Patch by Wolfgang Scherer <Wolfgang.Scherer@gmx.de>
André Spiegel <spiegel@gnu.org>
parents:
50645
diff
changeset
|
744 is `local'. |
01d84e9d30e0
Patch by Wolfgang Scherer <Wolfgang.Scherer@gmx.de>
André Spiegel <spiegel@gnu.org>
parents:
50645
diff
changeset
|
745 The default METHOD for a CVS root of the form |
01d84e9d30e0
Patch by Wolfgang Scherer <Wolfgang.Scherer@gmx.de>
André Spiegel <spiegel@gnu.org>
parents:
50645
diff
changeset
|
746 [USER@]HOSTNAME:/path/to/repository |
01d84e9d30e0
Patch by Wolfgang Scherer <Wolfgang.Scherer@gmx.de>
André Spiegel <spiegel@gnu.org>
parents:
50645
diff
changeset
|
747 is `ext'. |
01d84e9d30e0
Patch by Wolfgang Scherer <Wolfgang.Scherer@gmx.de>
André Spiegel <spiegel@gnu.org>
parents:
50645
diff
changeset
|
748 For an empty string, nil is returned (illegal CVS root)." |
01d84e9d30e0
Patch by Wolfgang Scherer <Wolfgang.Scherer@gmx.de>
André Spiegel <spiegel@gnu.org>
parents:
50645
diff
changeset
|
749 ;; Split CVS root into colon separated fields (0-4). |
01d84e9d30e0
Patch by Wolfgang Scherer <Wolfgang.Scherer@gmx.de>
André Spiegel <spiegel@gnu.org>
parents:
50645
diff
changeset
|
750 ;; The `x:' makes sure, that leading colons are not lost; |
01d84e9d30e0
Patch by Wolfgang Scherer <Wolfgang.Scherer@gmx.de>
André Spiegel <spiegel@gnu.org>
parents:
50645
diff
changeset
|
751 ;; `HOST:/PATH' is then different from `:METHOD:/PATH'. |
01d84e9d30e0
Patch by Wolfgang Scherer <Wolfgang.Scherer@gmx.de>
André Spiegel <spiegel@gnu.org>
parents:
50645
diff
changeset
|
752 (let* ((root-list (cdr (split-string (concat "x:" root) ":"))) |
01d84e9d30e0
Patch by Wolfgang Scherer <Wolfgang.Scherer@gmx.de>
André Spiegel <spiegel@gnu.org>
parents:
50645
diff
changeset
|
753 (len (length root-list)) |
01d84e9d30e0
Patch by Wolfgang Scherer <Wolfgang.Scherer@gmx.de>
André Spiegel <spiegel@gnu.org>
parents:
50645
diff
changeset
|
754 ;; All syntactic varieties will get a proper METHOD. |
01d84e9d30e0
Patch by Wolfgang Scherer <Wolfgang.Scherer@gmx.de>
André Spiegel <spiegel@gnu.org>
parents:
50645
diff
changeset
|
755 (root-list |
01d84e9d30e0
Patch by Wolfgang Scherer <Wolfgang.Scherer@gmx.de>
André Spiegel <spiegel@gnu.org>
parents:
50645
diff
changeset
|
756 (cond |
01d84e9d30e0
Patch by Wolfgang Scherer <Wolfgang.Scherer@gmx.de>
André Spiegel <spiegel@gnu.org>
parents:
50645
diff
changeset
|
757 ((= len 0) |
01d84e9d30e0
Patch by Wolfgang Scherer <Wolfgang.Scherer@gmx.de>
André Spiegel <spiegel@gnu.org>
parents:
50645
diff
changeset
|
758 ;; Invalid CVS root |
01d84e9d30e0
Patch by Wolfgang Scherer <Wolfgang.Scherer@gmx.de>
André Spiegel <spiegel@gnu.org>
parents:
50645
diff
changeset
|
759 nil) |
01d84e9d30e0
Patch by Wolfgang Scherer <Wolfgang.Scherer@gmx.de>
André Spiegel <spiegel@gnu.org>
parents:
50645
diff
changeset
|
760 ((= len 1) |
01d84e9d30e0
Patch by Wolfgang Scherer <Wolfgang.Scherer@gmx.de>
André Spiegel <spiegel@gnu.org>
parents:
50645
diff
changeset
|
761 ;; Simple PATH => method `local' |
01d84e9d30e0
Patch by Wolfgang Scherer <Wolfgang.Scherer@gmx.de>
André Spiegel <spiegel@gnu.org>
parents:
50645
diff
changeset
|
762 (cons "local" |
01d84e9d30e0
Patch by Wolfgang Scherer <Wolfgang.Scherer@gmx.de>
André Spiegel <spiegel@gnu.org>
parents:
50645
diff
changeset
|
763 (cons nil root-list))) |
01d84e9d30e0
Patch by Wolfgang Scherer <Wolfgang.Scherer@gmx.de>
André Spiegel <spiegel@gnu.org>
parents:
50645
diff
changeset
|
764 ((= len 2) |
01d84e9d30e0
Patch by Wolfgang Scherer <Wolfgang.Scherer@gmx.de>
André Spiegel <spiegel@gnu.org>
parents:
50645
diff
changeset
|
765 ;; [USER@]HOST:PATH => method `ext' |
01d84e9d30e0
Patch by Wolfgang Scherer <Wolfgang.Scherer@gmx.de>
André Spiegel <spiegel@gnu.org>
parents:
50645
diff
changeset
|
766 (and (not (equal (car root-list) "")) |
01d84e9d30e0
Patch by Wolfgang Scherer <Wolfgang.Scherer@gmx.de>
André Spiegel <spiegel@gnu.org>
parents:
50645
diff
changeset
|
767 (cons "ext" root-list))) |
01d84e9d30e0
Patch by Wolfgang Scherer <Wolfgang.Scherer@gmx.de>
André Spiegel <spiegel@gnu.org>
parents:
50645
diff
changeset
|
768 ((= len 3) |
01d84e9d30e0
Patch by Wolfgang Scherer <Wolfgang.Scherer@gmx.de>
André Spiegel <spiegel@gnu.org>
parents:
50645
diff
changeset
|
769 ;; :METHOD:PATH |
01d84e9d30e0
Patch by Wolfgang Scherer <Wolfgang.Scherer@gmx.de>
André Spiegel <spiegel@gnu.org>
parents:
50645
diff
changeset
|
770 (cons (cadr root-list) |
01d84e9d30e0
Patch by Wolfgang Scherer <Wolfgang.Scherer@gmx.de>
André Spiegel <spiegel@gnu.org>
parents:
50645
diff
changeset
|
771 (cons nil (cddr root-list)))) |
01d84e9d30e0
Patch by Wolfgang Scherer <Wolfgang.Scherer@gmx.de>
André Spiegel <spiegel@gnu.org>
parents:
50645
diff
changeset
|
772 (t |
01d84e9d30e0
Patch by Wolfgang Scherer <Wolfgang.Scherer@gmx.de>
André Spiegel <spiegel@gnu.org>
parents:
50645
diff
changeset
|
773 ;; :METHOD:[USER@]HOST:PATH |
01d84e9d30e0
Patch by Wolfgang Scherer <Wolfgang.Scherer@gmx.de>
André Spiegel <spiegel@gnu.org>
parents:
50645
diff
changeset
|
774 (cdr root-list))))) |
01d84e9d30e0
Patch by Wolfgang Scherer <Wolfgang.Scherer@gmx.de>
André Spiegel <spiegel@gnu.org>
parents:
50645
diff
changeset
|
775 (if root-list |
01d84e9d30e0
Patch by Wolfgang Scherer <Wolfgang.Scherer@gmx.de>
André Spiegel <spiegel@gnu.org>
parents:
50645
diff
changeset
|
776 (let ((method (car root-list)) |
01d84e9d30e0
Patch by Wolfgang Scherer <Wolfgang.Scherer@gmx.de>
André Spiegel <spiegel@gnu.org>
parents:
50645
diff
changeset
|
777 (uhost (or (cadr root-list) "")) |
01d84e9d30e0
Patch by Wolfgang Scherer <Wolfgang.Scherer@gmx.de>
André Spiegel <spiegel@gnu.org>
parents:
50645
diff
changeset
|
778 (root (nth 2 root-list)) |
01d84e9d30e0
Patch by Wolfgang Scherer <Wolfgang.Scherer@gmx.de>
André Spiegel <spiegel@gnu.org>
parents:
50645
diff
changeset
|
779 user host) |
01d84e9d30e0
Patch by Wolfgang Scherer <Wolfgang.Scherer@gmx.de>
André Spiegel <spiegel@gnu.org>
parents:
50645
diff
changeset
|
780 ;; Split USER@HOST |
01d84e9d30e0
Patch by Wolfgang Scherer <Wolfgang.Scherer@gmx.de>
André Spiegel <spiegel@gnu.org>
parents:
50645
diff
changeset
|
781 (if (string-match "\\(.*\\)@\\(.*\\)" uhost) |
01d84e9d30e0
Patch by Wolfgang Scherer <Wolfgang.Scherer@gmx.de>
André Spiegel <spiegel@gnu.org>
parents:
50645
diff
changeset
|
782 (setq user (match-string 1 uhost) |
01d84e9d30e0
Patch by Wolfgang Scherer <Wolfgang.Scherer@gmx.de>
André Spiegel <spiegel@gnu.org>
parents:
50645
diff
changeset
|
783 host (match-string 2 uhost)) |
01d84e9d30e0
Patch by Wolfgang Scherer <Wolfgang.Scherer@gmx.de>
André Spiegel <spiegel@gnu.org>
parents:
50645
diff
changeset
|
784 (setq host uhost)) |
01d84e9d30e0
Patch by Wolfgang Scherer <Wolfgang.Scherer@gmx.de>
André Spiegel <spiegel@gnu.org>
parents:
50645
diff
changeset
|
785 ;; Remove empty HOST |
01d84e9d30e0
Patch by Wolfgang Scherer <Wolfgang.Scherer@gmx.de>
André Spiegel <spiegel@gnu.org>
parents:
50645
diff
changeset
|
786 (and (equal host "") |
01d84e9d30e0
Patch by Wolfgang Scherer <Wolfgang.Scherer@gmx.de>
André Spiegel <spiegel@gnu.org>
parents:
50645
diff
changeset
|
787 (setq host)) |
01d84e9d30e0
Patch by Wolfgang Scherer <Wolfgang.Scherer@gmx.de>
André Spiegel <spiegel@gnu.org>
parents:
50645
diff
changeset
|
788 ;; Fix windows style CVS root `:local:C:\\project\\cvs\\some\\dir' |
01d84e9d30e0
Patch by Wolfgang Scherer <Wolfgang.Scherer@gmx.de>
André Spiegel <spiegel@gnu.org>
parents:
50645
diff
changeset
|
789 (and host |
01d84e9d30e0
Patch by Wolfgang Scherer <Wolfgang.Scherer@gmx.de>
André Spiegel <spiegel@gnu.org>
parents:
50645
diff
changeset
|
790 (equal method "local") |
01d84e9d30e0
Patch by Wolfgang Scherer <Wolfgang.Scherer@gmx.de>
André Spiegel <spiegel@gnu.org>
parents:
50645
diff
changeset
|
791 (setq root (concat host ":" root) host)) |
01d84e9d30e0
Patch by Wolfgang Scherer <Wolfgang.Scherer@gmx.de>
André Spiegel <spiegel@gnu.org>
parents:
50645
diff
changeset
|
792 ;; Normalize CVS root record |
01d84e9d30e0
Patch by Wolfgang Scherer <Wolfgang.Scherer@gmx.de>
André Spiegel <spiegel@gnu.org>
parents:
50645
diff
changeset
|
793 (list method user host root))))) |
33560 | 794 |
795 (defun vc-cvs-parse-status (&optional full) | |
796 "Parse output of \"cvs status\" command in the current buffer. | |
797 Set file properties accordingly. Unless FULL is t, parse only | |
798 essential information." | |
799 (let (file status) | |
800 (goto-char (point-min)) | |
801 (if (re-search-forward "^File: " nil t) | |
802 (cond | |
803 ((looking-at "no file") nil) | |
804 ((re-search-forward "\\=\\([^ \t]+\\)" nil t) | |
805 (setq file (expand-file-name (match-string 1))) | |
806 (vc-file-setprop file 'vc-backend 'CVS) | |
807 (if (not (re-search-forward "\\=[ \t]+Status: \\(.*\\)" nil t)) | |
808 (setq status "Unknown") | |
809 (setq status (match-string 1))) | |
810 (if (and full | |
811 (re-search-forward | |
41707
94df6eb103b3
(vc-cvs-parse-status): Store file state in property, don't just return
André Spiegel <spiegel@gnu.org>
parents:
41520
diff
changeset
|
812 "\\(RCS Version\\|RCS Revision\\|Repository revision\\):\ |
33560 | 813 \[\t ]+\\([0-9.]+\\)" |
814 nil t)) | |
815 (vc-file-setprop file 'vc-latest-version (match-string 2))) | |
44436
f9db51bb423b
(vc-cvs-checkin): Pass the required argument to `error'.
Sam Steingold <sds@gnu.org>
parents:
44197
diff
changeset
|
816 (vc-file-setprop |
41707
94df6eb103b3
(vc-cvs-parse-status): Store file state in property, don't just return
André Spiegel <spiegel@gnu.org>
parents:
41520
diff
changeset
|
817 file 'vc-state |
94df6eb103b3
(vc-cvs-parse-status): Store file state in property, don't just return
André Spiegel <spiegel@gnu.org>
parents:
41520
diff
changeset
|
818 (cond |
94df6eb103b3
(vc-cvs-parse-status): Store file state in property, don't just return
André Spiegel <spiegel@gnu.org>
parents:
41520
diff
changeset
|
819 ((string-match "Up-to-date" status) |
94df6eb103b3
(vc-cvs-parse-status): Store file state in property, don't just return
André Spiegel <spiegel@gnu.org>
parents:
41520
diff
changeset
|
820 (vc-file-setprop file 'vc-checkout-time |
94df6eb103b3
(vc-cvs-parse-status): Store file state in property, don't just return
André Spiegel <spiegel@gnu.org>
parents:
41520
diff
changeset
|
821 (nth 5 (file-attributes file))) |
94df6eb103b3
(vc-cvs-parse-status): Store file state in property, don't just return
André Spiegel <spiegel@gnu.org>
parents:
41520
diff
changeset
|
822 'up-to-date) |
94df6eb103b3
(vc-cvs-parse-status): Store file state in property, don't just return
André Spiegel <spiegel@gnu.org>
parents:
41520
diff
changeset
|
823 ((string-match "Locally Modified" status) 'edited) |
94df6eb103b3
(vc-cvs-parse-status): Store file state in property, don't just return
André Spiegel <spiegel@gnu.org>
parents:
41520
diff
changeset
|
824 ((string-match "Needs Merge" status) 'needs-merge) |
94df6eb103b3
(vc-cvs-parse-status): Store file state in property, don't just return
André Spiegel <spiegel@gnu.org>
parents:
41520
diff
changeset
|
825 ((string-match "Needs \\(Checkout\\|Patch\\)" status) 'needs-patch) |
94df6eb103b3
(vc-cvs-parse-status): Store file state in property, don't just return
André Spiegel <spiegel@gnu.org>
parents:
41520
diff
changeset
|
826 (t 'edited)))))))) |
33560 | 827 |
828 (defun vc-cvs-dir-state-heuristic (dir) | |
829 "Find the CVS state of all files in DIR, using only local information." | |
830 (with-temp-buffer | |
50453
e499daf7fb22
(vc-cvs-get-entries): New function that uses the right coding system for
André Spiegel <spiegel@gnu.org>
parents:
50321
diff
changeset
|
831 (vc-cvs-get-entries dir) |
33560 | 832 (goto-char (point-min)) |
833 (while (not (eobp)) | |
44104
985526b08270
(vc-cvs-registered, vc-cvs-dir-state-heuristic):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44005
diff
changeset
|
834 ;; CVS-removed files are not taken under VC control. |
985526b08270
(vc-cvs-registered, vc-cvs-dir-state-heuristic):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44005
diff
changeset
|
835 (when (looking-at "/\\([^/]*\\)/[^/-]") |
33560 | 836 (let ((file (expand-file-name (match-string 1) dir))) |
837 (unless (vc-file-getprop file 'vc-state) | |
838 (vc-cvs-parse-entry file t)))) | |
839 (forward-line 1)))) | |
840 | |
50453
e499daf7fb22
(vc-cvs-get-entries): New function that uses the right coding system for
André Spiegel <spiegel@gnu.org>
parents:
50321
diff
changeset
|
841 (defun vc-cvs-get-entries (dir) |
e499daf7fb22
(vc-cvs-get-entries): New function that uses the right coding system for
André Spiegel <spiegel@gnu.org>
parents:
50321
diff
changeset
|
842 "Insert the CVS/Entries file from below DIR into the current buffer. |
e499daf7fb22
(vc-cvs-get-entries): New function that uses the right coding system for
André Spiegel <spiegel@gnu.org>
parents:
50321
diff
changeset
|
843 This function ensures that the correct coding system is used for that, |
e499daf7fb22
(vc-cvs-get-entries): New function that uses the right coding system for
André Spiegel <spiegel@gnu.org>
parents:
50321
diff
changeset
|
844 which may not be the one that is used for the files' contents. |
e499daf7fb22
(vc-cvs-get-entries): New function that uses the right coding system for
André Spiegel <spiegel@gnu.org>
parents:
50321
diff
changeset
|
845 CVS/Entries should only be accessed through this function." |
e499daf7fb22
(vc-cvs-get-entries): New function that uses the right coding system for
André Spiegel <spiegel@gnu.org>
parents:
50321
diff
changeset
|
846 (let ((coding-system-for-read (or file-name-coding-system |
e499daf7fb22
(vc-cvs-get-entries): New function that uses the right coding system for
André Spiegel <spiegel@gnu.org>
parents:
50321
diff
changeset
|
847 default-file-name-coding-system))) |
e499daf7fb22
(vc-cvs-get-entries): New function that uses the right coding system for
André Spiegel <spiegel@gnu.org>
parents:
50321
diff
changeset
|
848 (vc-insert-file (expand-file-name "CVS/Entries" dir)))) |
57913
f5d7d9bbc021
(vc-cvs-annotate-command): Delete extraneous lines from beginning of buffer.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
54465
diff
changeset
|
849 |
43447
79cf46e34420
Patch by Martin.Lorentzson@telia.com.
André Spiegel <spiegel@gnu.org>
parents:
42657
diff
changeset
|
850 (defun vc-cvs-valid-symbolic-tag-name-p (tag) |
79cf46e34420
Patch by Martin.Lorentzson@telia.com.
André Spiegel <spiegel@gnu.org>
parents:
42657
diff
changeset
|
851 "Return non-nil if TAG is a valid symbolic tag name." |
79cf46e34420
Patch by Martin.Lorentzson@telia.com.
André Spiegel <spiegel@gnu.org>
parents:
42657
diff
changeset
|
852 ;; According to the CVS manual, a valid symbolic tag must start with |
79cf46e34420
Patch by Martin.Lorentzson@telia.com.
André Spiegel <spiegel@gnu.org>
parents:
42657
diff
changeset
|
853 ;; an uppercase or lowercase letter and can contain uppercase and |
79cf46e34420
Patch by Martin.Lorentzson@telia.com.
André Spiegel <spiegel@gnu.org>
parents:
42657
diff
changeset
|
854 ;; lowercase letters, digits, `-', and `_'. |
79cf46e34420
Patch by Martin.Lorentzson@telia.com.
André Spiegel <spiegel@gnu.org>
parents:
42657
diff
changeset
|
855 (and (string-match "^[a-zA-Z]" tag) |
79cf46e34420
Patch by Martin.Lorentzson@telia.com.
André Spiegel <spiegel@gnu.org>
parents:
42657
diff
changeset
|
856 (not (string-match "[^a-z0-9A-Z-_]" tag)))) |
44436
f9db51bb423b
(vc-cvs-checkin): Pass the required argument to `error'.
Sam Steingold <sds@gnu.org>
parents:
44197
diff
changeset
|
857 |
44462
6eb10924e77f
(vc-cvs-valid-version-number-p): New function.
Sam Steingold <sds@gnu.org>
parents:
44436
diff
changeset
|
858 (defun vc-cvs-valid-version-number-p (tag) |
6eb10924e77f
(vc-cvs-valid-version-number-p): New function.
Sam Steingold <sds@gnu.org>
parents:
44436
diff
changeset
|
859 "Return non-nil if TAG is a valid version number." |
6eb10924e77f
(vc-cvs-valid-version-number-p): New function.
Sam Steingold <sds@gnu.org>
parents:
44436
diff
changeset
|
860 (and (string-match "^[0-9]" tag) |
6eb10924e77f
(vc-cvs-valid-version-number-p): New function.
Sam Steingold <sds@gnu.org>
parents:
44436
diff
changeset
|
861 (not (string-match "[^0-9.]" tag)))) |
43447
79cf46e34420
Patch by Martin.Lorentzson@telia.com.
André Spiegel <spiegel@gnu.org>
parents:
42657
diff
changeset
|
862 |
79cf46e34420
Patch by Martin.Lorentzson@telia.com.
André Spiegel <spiegel@gnu.org>
parents:
42657
diff
changeset
|
863 (defun vc-cvs-parse-sticky-tag (match-type match-tag) |
44436
f9db51bb423b
(vc-cvs-checkin): Pass the required argument to `error'.
Sam Steingold <sds@gnu.org>
parents:
44197
diff
changeset
|
864 "Parse and return the sticky tag as a string. |
43447
79cf46e34420
Patch by Martin.Lorentzson@telia.com.
André Spiegel <spiegel@gnu.org>
parents:
42657
diff
changeset
|
865 `match-data' is protected." |
79cf46e34420
Patch by Martin.Lorentzson@telia.com.
André Spiegel <spiegel@gnu.org>
parents:
42657
diff
changeset
|
866 (let ((data (match-data)) |
79cf46e34420
Patch by Martin.Lorentzson@telia.com.
André Spiegel <spiegel@gnu.org>
parents:
42657
diff
changeset
|
867 (tag) |
79cf46e34420
Patch by Martin.Lorentzson@telia.com.
André Spiegel <spiegel@gnu.org>
parents:
42657
diff
changeset
|
868 (type (cond ((string= match-type "D") 'date) |
79cf46e34420
Patch by Martin.Lorentzson@telia.com.
André Spiegel <spiegel@gnu.org>
parents:
42657
diff
changeset
|
869 ((string= match-type "T") |
79cf46e34420
Patch by Martin.Lorentzson@telia.com.
André Spiegel <spiegel@gnu.org>
parents:
42657
diff
changeset
|
870 (if (vc-cvs-valid-symbolic-tag-name-p match-tag) |
79cf46e34420
Patch by Martin.Lorentzson@telia.com.
André Spiegel <spiegel@gnu.org>
parents:
42657
diff
changeset
|
871 'symbolic-name |
79cf46e34420
Patch by Martin.Lorentzson@telia.com.
André Spiegel <spiegel@gnu.org>
parents:
42657
diff
changeset
|
872 'revision-number)) |
79cf46e34420
Patch by Martin.Lorentzson@telia.com.
André Spiegel <spiegel@gnu.org>
parents:
42657
diff
changeset
|
873 (t nil)))) |
79cf46e34420
Patch by Martin.Lorentzson@telia.com.
André Spiegel <spiegel@gnu.org>
parents:
42657
diff
changeset
|
874 (unwind-protect |
79cf46e34420
Patch by Martin.Lorentzson@telia.com.
André Spiegel <spiegel@gnu.org>
parents:
42657
diff
changeset
|
875 (progn |
44436
f9db51bb423b
(vc-cvs-checkin): Pass the required argument to `error'.
Sam Steingold <sds@gnu.org>
parents:
44197
diff
changeset
|
876 (cond |
46163 | 877 ;; Sticky Date tag. Convert to a proper date value (`encode-time') |
43447
79cf46e34420
Patch by Martin.Lorentzson@telia.com.
André Spiegel <spiegel@gnu.org>
parents:
42657
diff
changeset
|
878 ((eq type 'date) |
44436
f9db51bb423b
(vc-cvs-checkin): Pass the required argument to `error'.
Sam Steingold <sds@gnu.org>
parents:
44197
diff
changeset
|
879 (string-match |
f9db51bb423b
(vc-cvs-checkin): Pass the required argument to `error'.
Sam Steingold <sds@gnu.org>
parents:
44197
diff
changeset
|
880 "\\([0-9]+\\)\\.\\([0-9]+\\)\\.\\([0-9]+\\)\\.\\([0-9]+\\)\\.\\([0-9]+\\)\\.\\([0-9]+\\)" |
43447
79cf46e34420
Patch by Martin.Lorentzson@telia.com.
André Spiegel <spiegel@gnu.org>
parents:
42657
diff
changeset
|
881 match-tag) |
79cf46e34420
Patch by Martin.Lorentzson@telia.com.
André Spiegel <spiegel@gnu.org>
parents:
42657
diff
changeset
|
882 (let* ((year-tmp (string-to-number (match-string 1 match-tag))) |
79cf46e34420
Patch by Martin.Lorentzson@telia.com.
André Spiegel <spiegel@gnu.org>
parents:
42657
diff
changeset
|
883 (month (string-to-number (match-string 2 match-tag))) |
79cf46e34420
Patch by Martin.Lorentzson@telia.com.
André Spiegel <spiegel@gnu.org>
parents:
42657
diff
changeset
|
884 (day (string-to-number (match-string 3 match-tag))) |
79cf46e34420
Patch by Martin.Lorentzson@telia.com.
André Spiegel <spiegel@gnu.org>
parents:
42657
diff
changeset
|
885 (hour (string-to-number (match-string 4 match-tag))) |
79cf46e34420
Patch by Martin.Lorentzson@telia.com.
André Spiegel <spiegel@gnu.org>
parents:
42657
diff
changeset
|
886 (min (string-to-number (match-string 5 match-tag))) |
79cf46e34420
Patch by Martin.Lorentzson@telia.com.
André Spiegel <spiegel@gnu.org>
parents:
42657
diff
changeset
|
887 (sec (string-to-number (match-string 6 match-tag))) |
79cf46e34420
Patch by Martin.Lorentzson@telia.com.
André Spiegel <spiegel@gnu.org>
parents:
42657
diff
changeset
|
888 ;; Years 0..68 are 2000..2068. |
79cf46e34420
Patch by Martin.Lorentzson@telia.com.
André Spiegel <spiegel@gnu.org>
parents:
42657
diff
changeset
|
889 ;; Years 69..99 are 1969..1999. |
79cf46e34420
Patch by Martin.Lorentzson@telia.com.
André Spiegel <spiegel@gnu.org>
parents:
42657
diff
changeset
|
890 (year (+ (cond ((> 69 year-tmp) 2000) |
79cf46e34420
Patch by Martin.Lorentzson@telia.com.
André Spiegel <spiegel@gnu.org>
parents:
42657
diff
changeset
|
891 ((> 100 year-tmp) 1900) |
79cf46e34420
Patch by Martin.Lorentzson@telia.com.
André Spiegel <spiegel@gnu.org>
parents:
42657
diff
changeset
|
892 (t 0)) |
79cf46e34420
Patch by Martin.Lorentzson@telia.com.
André Spiegel <spiegel@gnu.org>
parents:
42657
diff
changeset
|
893 year-tmp))) |
79cf46e34420
Patch by Martin.Lorentzson@telia.com.
André Spiegel <spiegel@gnu.org>
parents:
42657
diff
changeset
|
894 (setq tag (encode-time sec min hour day month year)))) |
79cf46e34420
Patch by Martin.Lorentzson@telia.com.
André Spiegel <spiegel@gnu.org>
parents:
42657
diff
changeset
|
895 ;; Sticky Tag name or revision number |
79cf46e34420
Patch by Martin.Lorentzson@telia.com.
André Spiegel <spiegel@gnu.org>
parents:
42657
diff
changeset
|
896 ((eq type 'symbolic-name) (setq tag match-tag)) |
79cf46e34420
Patch by Martin.Lorentzson@telia.com.
André Spiegel <spiegel@gnu.org>
parents:
42657
diff
changeset
|
897 ((eq type 'revision-number) (setq tag match-tag)) |
79cf46e34420
Patch by Martin.Lorentzson@telia.com.
André Spiegel <spiegel@gnu.org>
parents:
42657
diff
changeset
|
898 ;; Default is no sticky tag at all |
79cf46e34420
Patch by Martin.Lorentzson@telia.com.
André Spiegel <spiegel@gnu.org>
parents:
42657
diff
changeset
|
899 (t nil)) |
79cf46e34420
Patch by Martin.Lorentzson@telia.com.
André Spiegel <spiegel@gnu.org>
parents:
42657
diff
changeset
|
900 (cond ((eq vc-cvs-sticky-tag-display nil) nil) |
79cf46e34420
Patch by Martin.Lorentzson@telia.com.
André Spiegel <spiegel@gnu.org>
parents:
42657
diff
changeset
|
901 ((eq vc-cvs-sticky-tag-display t) |
44436
f9db51bb423b
(vc-cvs-checkin): Pass the required argument to `error'.
Sam Steingold <sds@gnu.org>
parents:
44197
diff
changeset
|
902 (cond ((eq type 'date) (format-time-string |
43447
79cf46e34420
Patch by Martin.Lorentzson@telia.com.
André Spiegel <spiegel@gnu.org>
parents:
42657
diff
changeset
|
903 vc-cvs-sticky-date-format-string |
79cf46e34420
Patch by Martin.Lorentzson@telia.com.
André Spiegel <spiegel@gnu.org>
parents:
42657
diff
changeset
|
904 tag)) |
79cf46e34420
Patch by Martin.Lorentzson@telia.com.
André Spiegel <spiegel@gnu.org>
parents:
42657
diff
changeset
|
905 ((eq type 'symbolic-name) tag) |
79cf46e34420
Patch by Martin.Lorentzson@telia.com.
André Spiegel <spiegel@gnu.org>
parents:
42657
diff
changeset
|
906 ((eq type 'revision-number) tag) |
79cf46e34420
Patch by Martin.Lorentzson@telia.com.
André Spiegel <spiegel@gnu.org>
parents:
42657
diff
changeset
|
907 (t nil))) |
44436
f9db51bb423b
(vc-cvs-checkin): Pass the required argument to `error'.
Sam Steingold <sds@gnu.org>
parents:
44197
diff
changeset
|
908 ((functionp vc-cvs-sticky-tag-display) |
43447
79cf46e34420
Patch by Martin.Lorentzson@telia.com.
André Spiegel <spiegel@gnu.org>
parents:
42657
diff
changeset
|
909 (funcall vc-cvs-sticky-tag-display tag type)) |
79cf46e34420
Patch by Martin.Lorentzson@telia.com.
André Spiegel <spiegel@gnu.org>
parents:
42657
diff
changeset
|
910 (t nil))) |
79cf46e34420
Patch by Martin.Lorentzson@telia.com.
André Spiegel <spiegel@gnu.org>
parents:
42657
diff
changeset
|
911 |
79cf46e34420
Patch by Martin.Lorentzson@telia.com.
André Spiegel <spiegel@gnu.org>
parents:
42657
diff
changeset
|
912 (set-match-data data)))) |
79cf46e34420
Patch by Martin.Lorentzson@telia.com.
André Spiegel <spiegel@gnu.org>
parents:
42657
diff
changeset
|
913 |
33560 | 914 (defun vc-cvs-parse-entry (file &optional set-state) |
915 "Parse a line from CVS/Entries. | |
916 Compare modification time to that of the FILE, set file properties | |
917 accordingly. However, `vc-state' is set only if optional arg SET-STATE | |
918 is non-nil." | |
919 (cond | |
920 ;; entry for a "locally added" file (not yet committed) | |
921 ((looking-at "/[^/]+/0/") | |
922 (vc-file-setprop file 'vc-checkout-time 0) | |
923 (vc-file-setprop file 'vc-workfile-version "0") | |
924 (if set-state (vc-file-setprop file 'vc-state 'edited))) | |
925 ;; normal entry | |
926 ((looking-at | |
927 (concat "/[^/]+" | |
928 ;; revision | |
929 "/\\([^/]*\\)" | |
50321
17ff9d10125f
(vc-cvs-parse-entry): Make sure a file with conflicts
Andreas Schwab <schwab@suse.de>
parents:
49822
diff
changeset
|
930 ;; timestamp and optional conflict field |
17ff9d10125f
(vc-cvs-parse-entry): Make sure a file with conflicts
Andreas Schwab <schwab@suse.de>
parents:
49822
diff
changeset
|
931 "/\\([^/]*\\)/" |
43447
79cf46e34420
Patch by Martin.Lorentzson@telia.com.
André Spiegel <spiegel@gnu.org>
parents:
42657
diff
changeset
|
932 ;; options |
79cf46e34420
Patch by Martin.Lorentzson@telia.com.
André Spiegel <spiegel@gnu.org>
parents:
42657
diff
changeset
|
933 "\\([^/]*\\)/" |
79cf46e34420
Patch by Martin.Lorentzson@telia.com.
André Spiegel <spiegel@gnu.org>
parents:
42657
diff
changeset
|
934 ;; sticky tag |
79cf46e34420
Patch by Martin.Lorentzson@telia.com.
André Spiegel <spiegel@gnu.org>
parents:
42657
diff
changeset
|
935 "\\(.\\|\\)" ;Sticky tag type (date or tag name, could be empty) |
79cf46e34420
Patch by Martin.Lorentzson@telia.com.
André Spiegel <spiegel@gnu.org>
parents:
42657
diff
changeset
|
936 "\\(.*\\)")) ;Sticky tag |
33560 | 937 (vc-file-setprop file 'vc-workfile-version (match-string 1)) |
44104
985526b08270
(vc-cvs-registered, vc-cvs-dir-state-heuristic):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44005
diff
changeset
|
938 (vc-file-setprop file 'vc-cvs-sticky-tag |
57913
f5d7d9bbc021
(vc-cvs-annotate-command): Delete extraneous lines from beginning of buffer.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
54465
diff
changeset
|
939 (vc-cvs-parse-sticky-tag (match-string 4) |
52624
2b71ed49b8c6
(vc-cvs-parse-entry): Don't require parse-time, because it's
André Spiegel <spiegel@gnu.org>
parents:
52602
diff
changeset
|
940 (match-string 5))) |
52602
04c9b596cce6
(vc-cvs-parse-entry): Restore the code to compare time stamps
André Spiegel <spiegel@gnu.org>
parents:
52401
diff
changeset
|
941 ;; Compare checkout time and modification time. |
04c9b596cce6
(vc-cvs-parse-entry): Restore the code to compare time stamps
André Spiegel <spiegel@gnu.org>
parents:
52401
diff
changeset
|
942 ;; This is intentionally different from the algorithm that CVS uses |
52624
2b71ed49b8c6
(vc-cvs-parse-entry): Don't require parse-time, because it's
André Spiegel <spiegel@gnu.org>
parents:
52602
diff
changeset
|
943 ;; (which is based on textual comparison), because there can be problems |
52602
04c9b596cce6
(vc-cvs-parse-entry): Restore the code to compare time stamps
André Spiegel <spiegel@gnu.org>
parents:
52401
diff
changeset
|
944 ;; generating a time string that looks exactly like the one from CVS. |
52717
9197177c5f99
(vc-cvs-parse-entry): Revert last change to allow
Dave Love <fx@gnu.org>
parents:
52624
diff
changeset
|
945 (let ((mtime (nth 5 (file-attributes file)))) |
9197177c5f99
(vc-cvs-parse-entry): Revert last change to allow
Dave Love <fx@gnu.org>
parents:
52624
diff
changeset
|
946 (require 'parse-time) |
9197177c5f99
(vc-cvs-parse-entry): Revert last change to allow
Dave Love <fx@gnu.org>
parents:
52624
diff
changeset
|
947 (let ((parsed-time |
9197177c5f99
(vc-cvs-parse-entry): Revert last change to allow
Dave Love <fx@gnu.org>
parents:
52624
diff
changeset
|
948 (parse-time-string (concat (match-string 2) " +0000")))) |
9197177c5f99
(vc-cvs-parse-entry): Revert last change to allow
Dave Love <fx@gnu.org>
parents:
52624
diff
changeset
|
949 (cond ((and (not (string-match "\\+" (match-string 2))) |
9197177c5f99
(vc-cvs-parse-entry): Revert last change to allow
Dave Love <fx@gnu.org>
parents:
52624
diff
changeset
|
950 (car parsed-time) |
9197177c5f99
(vc-cvs-parse-entry): Revert last change to allow
Dave Love <fx@gnu.org>
parents:
52624
diff
changeset
|
951 (equal mtime (apply 'encode-time parsed-time))) |
9197177c5f99
(vc-cvs-parse-entry): Revert last change to allow
Dave Love <fx@gnu.org>
parents:
52624
diff
changeset
|
952 (vc-file-setprop file 'vc-checkout-time mtime) |
9197177c5f99
(vc-cvs-parse-entry): Revert last change to allow
Dave Love <fx@gnu.org>
parents:
52624
diff
changeset
|
953 (if set-state (vc-file-setprop file 'vc-state 'up-to-date))) |
9197177c5f99
(vc-cvs-parse-entry): Revert last change to allow
Dave Love <fx@gnu.org>
parents:
52624
diff
changeset
|
954 (t |
9197177c5f99
(vc-cvs-parse-entry): Revert last change to allow
Dave Love <fx@gnu.org>
parents:
52624
diff
changeset
|
955 (vc-file-setprop file 'vc-checkout-time 0) |
9197177c5f99
(vc-cvs-parse-entry): Revert last change to allow
Dave Love <fx@gnu.org>
parents:
52624
diff
changeset
|
956 (if set-state (vc-file-setprop file 'vc-state 'edited))))))))) |
44436
f9db51bb423b
(vc-cvs-checkin): Pass the required argument to `error'.
Sam Steingold <sds@gnu.org>
parents:
44197
diff
changeset
|
957 |
31384
f6cb7dfe5e7c
(vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
958 (provide 'vc-cvs) |
f6cb7dfe5e7c
(vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
959 |
52401 | 960 ;;; arch-tag: 60e1402a-aa53-4607-927a-cf74f144b432 |
31384
f6cb7dfe5e7c
(vc-cvs-show-log-entry): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
961 ;;; vc-cvs.el ends here |