Mercurial > emacs
annotate lisp/vc-sccs.el @ 104494:e480034314ce
Add Semantic unit tests.
author | Chong Yidong <cyd@stupidchicken.com> |
---|---|
date | Sun, 20 Sep 2009 04:00:13 +0000 |
parents | b0f266cccf0b |
children | f4a041a8c69d |
rev | line source |
---|---|
31385
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1 ;;; vc-sccs.el --- support for SCCS version-control |
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
2 |
64762
41bb365f41c4
Update years in copyright notice; nfc.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
64091
diff
changeset
|
3 ;; Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, |
100908 | 4 ;; 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 |
92167 | 5 ;; Free Software Foundation, Inc. |
31385
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
6 |
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
7 ;; Author: FSF (see vc.el for full credits) |
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
8 ;; Maintainer: Andre Spiegel <spiegel@gnu.org> |
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
9 |
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
10 ;; This file is part of GNU Emacs. |
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
11 |
94678
ee5932bf781d
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
94572
diff
changeset
|
12 ;; GNU Emacs is free software: you can redistribute it and/or modify |
31385
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
13 ;; it under the terms of the GNU General Public License as published by |
94678
ee5932bf781d
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
94572
diff
changeset
|
14 ;; the Free Software Foundation, either version 3 of the License, or |
ee5932bf781d
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
94572
diff
changeset
|
15 ;; (at your option) any later version. |
31385
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
16 |
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
17 ;; GNU Emacs is distributed in the hope that it will be useful, |
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
18 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of |
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
19 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
20 ;; GNU General Public License for more details. |
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
21 |
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
22 ;; You should have received a copy of the GNU General Public License |
94678
ee5932bf781d
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
94572
diff
changeset
|
23 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. |
31385
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
24 |
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
25 ;;; Commentary: |
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
26 |
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
27 ;;; Code: |
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
28 |
49597
e88404e8f2cf
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
48967
diff
changeset
|
29 (eval-when-compile |
35823
9396894025fa
(vc-sccs-diff-switches): New customization option.
André Spiegel <spiegel@gnu.org>
parents:
35179
diff
changeset
|
30 (require 'vc)) |
9396894025fa
(vc-sccs-diff-switches): New customization option.
André Spiegel <spiegel@gnu.org>
parents:
35179
diff
changeset
|
31 |
49597
e88404e8f2cf
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
48967
diff
changeset
|
32 ;;; |
33560 | 33 ;;; Customization options |
34 ;;; | |
35 | |
94190
fad57210c7d2
* lisp/vc-sccs.el (vc-sccs-do-command): New fun. Use the "sccs" command.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94003
diff
changeset
|
36 ;; ;; Maybe a better solution is to not use "get" but "sccs get". |
fad57210c7d2
* lisp/vc-sccs.el (vc-sccs-do-command): New fun. Use the "sccs" command.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94003
diff
changeset
|
37 ;; (defcustom vc-sccs-path |
fad57210c7d2
* lisp/vc-sccs.el (vc-sccs-do-command): New fun. Use the "sccs" command.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94003
diff
changeset
|
38 ;; (let ((path ())) |
fad57210c7d2
* lisp/vc-sccs.el (vc-sccs-do-command): New fun. Use the "sccs" command.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94003
diff
changeset
|
39 ;; (dolist (dir '("/usr/sccs" "/usr/lib/sccs" "/usr/libexec/sccs")) |
fad57210c7d2
* lisp/vc-sccs.el (vc-sccs-do-command): New fun. Use the "sccs" command.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94003
diff
changeset
|
40 ;; (if (file-directory-p dir) |
fad57210c7d2
* lisp/vc-sccs.el (vc-sccs-do-command): New fun. Use the "sccs" command.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94003
diff
changeset
|
41 ;; (push dir path))) |
fad57210c7d2
* lisp/vc-sccs.el (vc-sccs-do-command): New fun. Use the "sccs" command.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94003
diff
changeset
|
42 ;; path) |
fad57210c7d2
* lisp/vc-sccs.el (vc-sccs-do-command): New fun. Use the "sccs" command.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94003
diff
changeset
|
43 ;; "List of extra directories to search for SCCS commands." |
fad57210c7d2
* lisp/vc-sccs.el (vc-sccs-do-command): New fun. Use the "sccs" command.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94003
diff
changeset
|
44 ;; :type '(repeat directory) |
fad57210c7d2
* lisp/vc-sccs.el (vc-sccs-do-command): New fun. Use the "sccs" command.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94003
diff
changeset
|
45 ;; :group 'vc) |
fad57210c7d2
* lisp/vc-sccs.el (vc-sccs-do-command): New fun. Use the "sccs" command.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94003
diff
changeset
|
46 |
31385
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
47 (defcustom vc-sccs-register-switches nil |
100205
569bd4097407
(vc-sccs-register-switches): Doc fix. Add t as option.
Glenn Morris <rgm@gnu.org>
parents:
100184
diff
changeset
|
48 "Switches for registering a file in SCCS. |
31477 | 49 A string or list of strings passed to the checkin program by |
100205
569bd4097407
(vc-sccs-register-switches): Doc fix. Add t as option.
Glenn Morris <rgm@gnu.org>
parents:
100184
diff
changeset
|
50 \\[vc-register]. If nil, use the value of `vc-register-switches'. |
569bd4097407
(vc-sccs-register-switches): Doc fix. Add t as option.
Glenn Morris <rgm@gnu.org>
parents:
100184
diff
changeset
|
51 If t, use no switches." |
569bd4097407
(vc-sccs-register-switches): Doc fix. Add t as option.
Glenn Morris <rgm@gnu.org>
parents:
100184
diff
changeset
|
52 :type '(choice (const :tag "Unspecified" nil) |
569bd4097407
(vc-sccs-register-switches): Doc fix. Add t as option.
Glenn Morris <rgm@gnu.org>
parents:
100184
diff
changeset
|
53 (const :tag "None" t) |
31385
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
54 (string :tag "Argument String") |
100205
569bd4097407
(vc-sccs-register-switches): Doc fix. Add t as option.
Glenn Morris <rgm@gnu.org>
parents:
100184
diff
changeset
|
55 (repeat :tag "Argument List" :value ("") string)) |
31477 | 56 :version "21.1" |
31385
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
57 :group 'vc) |
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
58 |
35823
9396894025fa
(vc-sccs-diff-switches): New customization option.
André Spiegel <spiegel@gnu.org>
parents:
35179
diff
changeset
|
59 (defcustom vc-sccs-diff-switches nil |
100184
c3cf5c74dfe1
(vc-sccs-diff-switches): Doc fix. Add t as option.
Glenn Morris <rgm@gnu.org>
parents:
100171
diff
changeset
|
60 "String or list of strings specifying switches for SCCS diff under VC. |
c3cf5c74dfe1
(vc-sccs-diff-switches): Doc fix. Add t as option.
Glenn Morris <rgm@gnu.org>
parents:
100171
diff
changeset
|
61 If nil, use the value of `vc-diff-switches'. If t, use no switches." |
c3cf5c74dfe1
(vc-sccs-diff-switches): Doc fix. Add t as option.
Glenn Morris <rgm@gnu.org>
parents:
100171
diff
changeset
|
62 :type '(choice (const :tag "Unspecified" nil) |
c3cf5c74dfe1
(vc-sccs-diff-switches): Doc fix. Add t as option.
Glenn Morris <rgm@gnu.org>
parents:
100171
diff
changeset
|
63 (const :tag "None" t) |
35823
9396894025fa
(vc-sccs-diff-switches): New customization option.
André Spiegel <spiegel@gnu.org>
parents:
35179
diff
changeset
|
64 (string :tag "Argument String") |
100184
c3cf5c74dfe1
(vc-sccs-diff-switches): Doc fix. Add t as option.
Glenn Morris <rgm@gnu.org>
parents:
100171
diff
changeset
|
65 (repeat :tag "Argument List" :value ("") string)) |
35823
9396894025fa
(vc-sccs-diff-switches): New customization option.
André Spiegel <spiegel@gnu.org>
parents:
35179
diff
changeset
|
66 :version "21.1" |
9396894025fa
(vc-sccs-diff-switches): New customization option.
André Spiegel <spiegel@gnu.org>
parents:
35179
diff
changeset
|
67 :group 'vc) |
9396894025fa
(vc-sccs-diff-switches): New customization option.
André Spiegel <spiegel@gnu.org>
parents:
35179
diff
changeset
|
68 |
31385
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
69 (defcustom vc-sccs-header (or (cdr (assoc 'SCCS vc-header-alist)) '("%W%")) |
100171 | 70 "Header keywords to be inserted by `vc-insert-headers'." |
35179 | 71 :type '(repeat string) |
31385
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
72 :group 'vc) |
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
73 |
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
74 ;;;###autoload |
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
75 (defcustom vc-sccs-master-templates |
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
76 '("%sSCCS/s.%s" "%ss.%s" vc-sccs-search-project-dir) |
100171 | 77 "Where to look for SCCS master files. |
31385
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
78 For a description of possible values, see `vc-check-master-templates'." |
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
79 :type '(choice (const :tag "Use standard SCCS file names" |
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
80 ("%sSCCS/s.%s" "%ss.%s" vc-sccs-search-project-dir)) |
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
81 (repeat :tag "User-specified" |
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
82 (choice string |
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
83 function))) |
31477 | 84 :version "21.1" |
31385
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
85 :group 'vc) |
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
86 |
33560 | 87 |
88 ;;; | |
89 ;;; Internal variables | |
90 ;;; | |
91 | |
31404
f2ab9420390f
2000-09-05 Stefan Monnier <monnier@cs.yale.edu>
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
31385
diff
changeset
|
92 (defconst vc-sccs-name-assoc-file "VC-names") |
f2ab9420390f
2000-09-05 Stefan Monnier <monnier@cs.yale.edu>
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
31385
diff
changeset
|
93 |
33560 | 94 |
81967
6bf2af5a341e
Put the lower half (the back-end) of NewVC in place. This commit
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
75347
diff
changeset
|
95 ;;; Properties of the backend |
6bf2af5a341e
Put the lower half (the back-end) of NewVC in place. This commit
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
75347
diff
changeset
|
96 |
94190
fad57210c7d2
* lisp/vc-sccs.el (vc-sccs-do-command): New fun. Use the "sccs" command.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94003
diff
changeset
|
97 (defun vc-sccs-revision-granularity () 'file) |
94563
a0bb8ca25a33
Clean up vc*-revision-granularity and vc*-checkout-model.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
94522
diff
changeset
|
98 (defun vc-sccs-checkout-model (files) 'locking) |
81967
6bf2af5a341e
Put the lower half (the back-end) of NewVC in place. This commit
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
75347
diff
changeset
|
99 |
33560 | 100 ;;; |
101 ;;; State-querying functions | |
102 ;;; | |
103 | |
94190
fad57210c7d2
* lisp/vc-sccs.el (vc-sccs-do-command): New fun. Use the "sccs" command.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94003
diff
changeset
|
104 ;; The autoload cookie below places vc-sccs-registered directly into |
fad57210c7d2
* lisp/vc-sccs.el (vc-sccs-do-command): New fun. Use the "sccs" command.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94003
diff
changeset
|
105 ;; loaddefs.el, so that vc-sccs.el does not need to be loaded for |
fad57210c7d2
* lisp/vc-sccs.el (vc-sccs-do-command): New fun. Use the "sccs" command.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94003
diff
changeset
|
106 ;; every file that is visited. The definition is repeated below |
fad57210c7d2
* lisp/vc-sccs.el (vc-sccs-do-command): New fun. Use the "sccs" command.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94003
diff
changeset
|
107 ;; so that Help and etags can find it. |
48281
b8e04fa0ebdf
(vc-sccs-registered): Improve comment.
André Spiegel <spiegel@gnu.org>
parents:
48264
diff
changeset
|
108 |
b8e04fa0ebdf
(vc-sccs-registered): Improve comment.
André Spiegel <spiegel@gnu.org>
parents:
48264
diff
changeset
|
109 ;;;###autoload (defun vc-sccs-registered(f) (vc-default-registered 'SCCS f)) |
48264
63fc09a69c40
(vc-sccs-registered): Handle the autoload cookie so that the
Markus Rost <rost@math.uni-bielefeld.de>
parents:
47806
diff
changeset
|
110 (defun vc-sccs-registered (f) (vc-default-registered 'SCCS f)) |
31385
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
111 |
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
112 (defun vc-sccs-state (file) |
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
113 "SCCS-specific function to compute the version control state." |
94521
2a61c5f918a5
Change 'needs-patch to 'needs-update.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
94190
diff
changeset
|
114 (if (not (vc-sccs-registered file)) |
2a61c5f918a5
Change 'needs-patch to 'needs-update.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
94190
diff
changeset
|
115 'unregistered |
2a61c5f918a5
Change 'needs-patch to 'needs-update.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
94190
diff
changeset
|
116 (with-temp-buffer |
2a61c5f918a5
Change 'needs-patch to 'needs-update.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
94190
diff
changeset
|
117 (if (vc-insert-file (vc-sccs-lock-file file)) |
2a61c5f918a5
Change 'needs-patch to 'needs-update.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
94190
diff
changeset
|
118 (let* ((locks (vc-sccs-parse-locks)) |
2a61c5f918a5
Change 'needs-patch to 'needs-update.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
94190
diff
changeset
|
119 (working-revision (vc-working-revision file)) |
2a61c5f918a5
Change 'needs-patch to 'needs-update.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
94190
diff
changeset
|
120 (locking-user (cdr (assoc working-revision locks)))) |
2a61c5f918a5
Change 'needs-patch to 'needs-update.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
94190
diff
changeset
|
121 (if (not locking-user) |
2a61c5f918a5
Change 'needs-patch to 'needs-update.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
94190
diff
changeset
|
122 (if (vc-workfile-unchanged-p file) |
2a61c5f918a5
Change 'needs-patch to 'needs-update.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
94190
diff
changeset
|
123 'up-to-date |
2a61c5f918a5
Change 'needs-patch to 'needs-update.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
94190
diff
changeset
|
124 'unlocked-changes) |
2a61c5f918a5
Change 'needs-patch to 'needs-update.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
94190
diff
changeset
|
125 (if (string= locking-user (vc-user-login-name file)) |
2a61c5f918a5
Change 'needs-patch to 'needs-update.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
94190
diff
changeset
|
126 'edited |
2a61c5f918a5
Change 'needs-patch to 'needs-update.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
94190
diff
changeset
|
127 locking-user))) |
2a61c5f918a5
Change 'needs-patch to 'needs-update.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
94190
diff
changeset
|
128 'up-to-date)))) |
31385
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
129 |
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
130 (defun vc-sccs-state-heuristic (file) |
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
131 "SCCS-specific state heuristic." |
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
132 (if (not (vc-mistrust-permissions file)) |
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
133 ;; This implementation assumes that any file which is under version |
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
134 ;; control and has -rw-r--r-- is locked by its owner. This is true |
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
135 ;; for both RCS and SCCS, which keep unlocked files at -r--r--r--. |
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
136 ;; We have to be careful not to exclude files with execute bits on; |
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
137 ;; scripts can be under version control too. Also, we must ignore the |
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
138 ;; group-read and other-read bits, since paranoid users turn them off. |
68333
ccad9ac08a6d
(vc-sccs-state-heuristic): Use file-attributes with ID-FORMAT
André Spiegel <spiegel@gnu.org>
parents:
66608
diff
changeset
|
139 (let* ((attributes (file-attributes file 'string)) |
ccad9ac08a6d
(vc-sccs-state-heuristic): Use file-attributes with ID-FORMAT
André Spiegel <spiegel@gnu.org>
parents:
66608
diff
changeset
|
140 (owner-name (nth 2 attributes)) |
31385
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
141 (permissions (nth 8 attributes))) |
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
142 (if (string-match ".r-..-..-." permissions) |
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
143 'up-to-date |
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
144 (if (string-match ".rw..-..-." permissions) |
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
145 (if (file-ownership-preserved-p file) |
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
146 'edited |
68333
ccad9ac08a6d
(vc-sccs-state-heuristic): Use file-attributes with ID-FORMAT
André Spiegel <spiegel@gnu.org>
parents:
66608
diff
changeset
|
147 owner-name) |
52179
73faa15ff855
(vc-sccs-state-heuristic): Fix parentheses.
André Spiegel <spiegel@gnu.org>
parents:
50902
diff
changeset
|
148 ;; Strange permissions. |
73faa15ff855
(vc-sccs-state-heuristic): Fix parentheses.
André Spiegel <spiegel@gnu.org>
parents:
50902
diff
changeset
|
149 ;; Fall through to real state computation. |
73faa15ff855
(vc-sccs-state-heuristic): Fix parentheses.
André Spiegel <spiegel@gnu.org>
parents:
50902
diff
changeset
|
150 (vc-sccs-state file)))) |
73faa15ff855
(vc-sccs-state-heuristic): Fix parentheses.
André Spiegel <spiegel@gnu.org>
parents:
50902
diff
changeset
|
151 (vc-sccs-state file))) |
31385
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
152 |
94003
2ecb2ea8d5b5
Change `dir-status' to not take (and pass) status-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
93677
diff
changeset
|
153 (defun vc-sccs-dir-status (dir update-function) |
94835
0f7a18ff94d6
* vc-sccs.el (vc-sccs-dir-status):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
94806
diff
changeset
|
154 ;; FIXME: this function should be rewritten, using `vc-expand-dirs' |
0f7a18ff94d6
* vc-sccs.el (vc-sccs-dir-status):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
94806
diff
changeset
|
155 ;; is not TRTD because it returns files from multiple backends. |
0f7a18ff94d6
* vc-sccs.el (vc-sccs-dir-status):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
94806
diff
changeset
|
156 ;; It should also return 'unregistered files. |
0f7a18ff94d6
* vc-sccs.el (vc-sccs-dir-status):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
94806
diff
changeset
|
157 |
0f7a18ff94d6
* vc-sccs.el (vc-sccs-dir-status):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
94806
diff
changeset
|
158 ;; Doing lots of individual VC-state calls is painful, but |
94522
a69dcc2c42ae
Remove some XXX comments no longer needed.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
94521
diff
changeset
|
159 ;; there is no better option in SCCS-land. |
93677
112903000f93
* vc-rcs.el (vc-rcs-dir-status):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
92195
diff
changeset
|
160 (let ((flist (vc-expand-dirs (list dir))) |
112903000f93
* vc-rcs.el (vc-rcs-dir-status):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
92195
diff
changeset
|
161 (result nil)) |
112903000f93
* vc-rcs.el (vc-rcs-dir-status):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
92195
diff
changeset
|
162 (dolist (file flist) |
112903000f93
* vc-rcs.el (vc-rcs-dir-status):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
92195
diff
changeset
|
163 (let ((state (vc-state file)) |
112903000f93
* vc-rcs.el (vc-rcs-dir-status):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
92195
diff
changeset
|
164 (frel (file-relative-name file))) |
94835
0f7a18ff94d6
* vc-sccs.el (vc-sccs-dir-status):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
94806
diff
changeset
|
165 (when (and (eq (vc-backend file) 'SCCS) |
0f7a18ff94d6
* vc-sccs.el (vc-sccs-dir-status):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
94806
diff
changeset
|
166 (not (eq state 'up-to-date))) |
0f7a18ff94d6
* vc-sccs.el (vc-sccs-dir-status):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
94806
diff
changeset
|
167 (push (list frel state) result)))) |
94003
2ecb2ea8d5b5
Change `dir-status' to not take (and pass) status-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
93677
diff
changeset
|
168 (funcall update-function result))) |
93677
112903000f93
* vc-rcs.el (vc-rcs-dir-status):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
92195
diff
changeset
|
169 |
85139
8ba0e30716a5
Terminology cleanup.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
82140
diff
changeset
|
170 (defun vc-sccs-working-revision (file) |
8ba0e30716a5
Terminology cleanup.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
82140
diff
changeset
|
171 "SCCS-specific version of `vc-working-revision'." |
31385
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
172 (with-temp-buffer |
85141
b16f7408cd3f
Carry through today's big terminology change to a few places where I
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
85139
diff
changeset
|
173 ;; The working revision is always the latest revision number. |
52179
73faa15ff855
(vc-sccs-state-heuristic): Fix parentheses.
André Spiegel <spiegel@gnu.org>
parents:
50902
diff
changeset
|
174 ;; To find this number, search the entire delta table, |
73faa15ff855
(vc-sccs-state-heuristic): Fix parentheses.
André Spiegel <spiegel@gnu.org>
parents:
50902
diff
changeset
|
175 ;; rather than just the first entry, because the |
85141
b16f7408cd3f
Carry through today's big terminology change to a few places where I
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
85139
diff
changeset
|
176 ;; first entry might be a deleted ("R") revision. |
52179
73faa15ff855
(vc-sccs-state-heuristic): Fix parentheses.
André Spiegel <spiegel@gnu.org>
parents:
50902
diff
changeset
|
177 (vc-insert-file (vc-name file) "^\001e\n\001[^s]") |
31385
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
178 (vc-parse-buffer "^\001d D \\([^ ]+\\)" 1))) |
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
179 |
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
180 (defun vc-sccs-workfile-unchanged-p (file) |
56953 | 181 "SCCS-specific implementation of `vc-workfile-unchanged-p'." |
94847
5e64dca662f0
Remove assumption about what nil means as a first arument to vc-do-command.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
94835
diff
changeset
|
182 (zerop (apply 'vc-do-command "*vc*" 1 "vcdiff" (vc-name file) |
35823
9396894025fa
(vc-sccs-diff-switches): New customization option.
André Spiegel <spiegel@gnu.org>
parents:
35179
diff
changeset
|
183 (list "--brief" "-q" |
85139
8ba0e30716a5
Terminology cleanup.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
82140
diff
changeset
|
184 (concat "-r" (vc-working-revision file)))))) |
31385
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
185 |
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
186 |
33560 | 187 ;;; |
188 ;;; State-changing functions | |
189 ;;; | |
31385
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
190 |
94190
fad57210c7d2
* lisp/vc-sccs.el (vc-sccs-do-command): New fun. Use the "sccs" command.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94003
diff
changeset
|
191 (defun vc-sccs-do-command (buffer okstatus command file-or-list &rest flags) |
fad57210c7d2
* lisp/vc-sccs.el (vc-sccs-do-command): New fun. Use the "sccs" command.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94003
diff
changeset
|
192 ;; (let ((load-path (append vc-sccs-path load-path))) |
fad57210c7d2
* lisp/vc-sccs.el (vc-sccs-do-command): New fun. Use the "sccs" command.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94003
diff
changeset
|
193 ;; (apply 'vc-do-command buffer okstatus command file-or-list flags)) |
94847
5e64dca662f0
Remove assumption about what nil means as a first arument to vc-do-command.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
94835
diff
changeset
|
194 (apply 'vc-do-command (or buffer "*vc*") okstatus "sccs" file-or-list command flags)) |
94190
fad57210c7d2
* lisp/vc-sccs.el (vc-sccs-do-command): New fun. Use the "sccs" command.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94003
diff
changeset
|
195 |
81967
6bf2af5a341e
Put the lower half (the back-end) of NewVC in place. This commit
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
75347
diff
changeset
|
196 (defun vc-sccs-create-repo () |
6bf2af5a341e
Put the lower half (the back-end) of NewVC in place. This commit
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
75347
diff
changeset
|
197 "Create a new SCCS repository." |
6bf2af5a341e
Put the lower half (the back-end) of NewVC in place. This commit
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
75347
diff
changeset
|
198 ;; SCCS is totally file-oriented, so all we have to do is make the directory |
6bf2af5a341e
Put the lower half (the back-end) of NewVC in place. This commit
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
75347
diff
changeset
|
199 (make-directory "SCCS")) |
6bf2af5a341e
Put the lower half (the back-end) of NewVC in place. This commit
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
75347
diff
changeset
|
200 |
6bf2af5a341e
Put the lower half (the back-end) of NewVC in place. This commit
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
75347
diff
changeset
|
201 (defun vc-sccs-register (files &optional rev comment) |
6bf2af5a341e
Put the lower half (the back-end) of NewVC in place. This commit
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
75347
diff
changeset
|
202 "Register FILES into the SCCS version-control system. |
31385
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
203 REV is the optional revision number for the file. COMMENT can be used |
81967
6bf2af5a341e
Put the lower half (the back-end) of NewVC in place. This commit
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
75347
diff
changeset
|
204 to provide an initial description of FILES. |
100205
569bd4097407
(vc-sccs-register-switches): Doc fix. Add t as option.
Glenn Morris <rgm@gnu.org>
parents:
100184
diff
changeset
|
205 Passes either `vc-sccs-register-switches' or `vc-register-switches' |
569bd4097407
(vc-sccs-register-switches): Doc fix. Add t as option.
Glenn Morris <rgm@gnu.org>
parents:
100184
diff
changeset
|
206 to the SCCS command. |
31385
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
207 |
81967
6bf2af5a341e
Put the lower half (the back-end) of NewVC in place. This commit
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
75347
diff
changeset
|
208 Automatically retrieve a read-only version of the files with keywords |
31385
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
209 expanded if `vc-keep-workfiles' is non-nil, otherwise, delete the workfile." |
81967
6bf2af5a341e
Put the lower half (the back-end) of NewVC in place. This commit
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
75347
diff
changeset
|
210 (dolist (file files) |
50902
b12a550504a4
(vc-sccs-register, vc-sccs-checkin)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49597
diff
changeset
|
211 (let* ((dirname (or (file-name-directory file) "")) |
31385
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
212 (basename (file-name-nondirectory file)) |
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
213 (project-file (vc-sccs-search-project-dir dirname basename))) |
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
214 (let ((vc-name |
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
215 (or project-file |
50902
b12a550504a4
(vc-sccs-register, vc-sccs-checkin)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49597
diff
changeset
|
216 (format (car vc-sccs-master-templates) dirname basename)))) |
94190
fad57210c7d2
* lisp/vc-sccs.el (vc-sccs-do-command): New fun. Use the "sccs" command.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94003
diff
changeset
|
217 (apply 'vc-sccs-do-command nil 0 "admin" vc-name |
81967
6bf2af5a341e
Put the lower half (the back-end) of NewVC in place. This commit
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
75347
diff
changeset
|
218 (and rev (not (string= rev "")) (concat "-r" rev)) |
31385
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
219 "-fb" |
37051
92a0a59a48ee
(vc-sccs-register): Use relative file names.
André Spiegel <spiegel@gnu.org>
parents:
36713
diff
changeset
|
220 (concat "-i" (file-relative-name file)) |
31385
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
221 (and comment (concat "-y" comment)) |
50902
b12a550504a4
(vc-sccs-register, vc-sccs-checkin)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49597
diff
changeset
|
222 (vc-switches 'SCCS 'register))) |
31385
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
223 (delete-file file) |
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
224 (if vc-keep-workfiles |
94190
fad57210c7d2
* lisp/vc-sccs.el (vc-sccs-do-command): New fun. Use the "sccs" command.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94003
diff
changeset
|
225 (vc-sccs-do-command nil 0 "get" (vc-name file)))))) |
31385
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
226 |
33560 | 227 (defun vc-sccs-responsible-p (file) |
228 "Return non-nil if SCCS thinks it would be responsible for registering FILE." | |
229 ;; TODO: check for all the patterns in vc-sccs-master-templates | |
230 (or (file-directory-p (expand-file-name "SCCS" (file-name-directory file))) | |
231 (stringp (vc-sccs-search-project-dir (or (file-name-directory file) "") | |
232 (file-name-nondirectory file))))) | |
233 | |
81967
6bf2af5a341e
Put the lower half (the back-end) of NewVC in place. This commit
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
75347
diff
changeset
|
234 (defun vc-sccs-checkin (files rev comment) |
33560 | 235 "SCCS-specific version of `vc-backend-checkin'." |
94804
33d1e8fb0ae5
Make SCCS backend directory-aware.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
94678
diff
changeset
|
236 (dolist (file (vc-expand-dirs files)) |
94190
fad57210c7d2
* lisp/vc-sccs.el (vc-sccs-do-command): New fun. Use the "sccs" command.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94003
diff
changeset
|
237 (apply 'vc-sccs-do-command nil 0 "delta" (vc-name file) |
81967
6bf2af5a341e
Put the lower half (the back-end) of NewVC in place. This commit
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
75347
diff
changeset
|
238 (if rev (concat "-r" rev)) |
6bf2af5a341e
Put the lower half (the back-end) of NewVC in place. This commit
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
75347
diff
changeset
|
239 (concat "-y" comment) |
6bf2af5a341e
Put the lower half (the back-end) of NewVC in place. This commit
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
75347
diff
changeset
|
240 (vc-switches 'SCCS 'checkin)) |
6bf2af5a341e
Put the lower half (the back-end) of NewVC in place. This commit
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
75347
diff
changeset
|
241 (if vc-keep-workfiles |
94190
fad57210c7d2
* lisp/vc-sccs.el (vc-sccs-do-command): New fun. Use the "sccs" command.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94003
diff
changeset
|
242 (vc-sccs-do-command nil 0 "get" (vc-name file))))) |
33560 | 243 |
85139
8ba0e30716a5
Terminology cleanup.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
82140
diff
changeset
|
244 (defun vc-sccs-find-revision (file rev buffer) |
94190
fad57210c7d2
* lisp/vc-sccs.el (vc-sccs-do-command): New fun. Use the "sccs" command.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94003
diff
changeset
|
245 (apply 'vc-sccs-do-command |
47798
20dfef584009
(vc-sccs-find-version): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44006
diff
changeset
|
246 buffer 0 "get" (vc-name file) |
20dfef584009
(vc-sccs-find-version): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44006
diff
changeset
|
247 "-s" ;; suppress diagnostic output |
20dfef584009
(vc-sccs-find-version): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44006
diff
changeset
|
248 "-p" |
20dfef584009
(vc-sccs-find-version): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44006
diff
changeset
|
249 (and rev |
20dfef584009
(vc-sccs-find-version): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44006
diff
changeset
|
250 (concat "-r" |
20dfef584009
(vc-sccs-find-version): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44006
diff
changeset
|
251 (vc-sccs-lookup-triple file rev))) |
50902
b12a550504a4
(vc-sccs-register, vc-sccs-checkin)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49597
diff
changeset
|
252 (vc-switches 'SCCS 'checkout))) |
47798
20dfef584009
(vc-sccs-find-version): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44006
diff
changeset
|
253 |
20dfef584009
(vc-sccs-find-version): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44006
diff
changeset
|
254 (defun vc-sccs-checkout (file &optional editable rev) |
85141
b16f7408cd3f
Carry through today's big terminology change to a few places where I
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
85139
diff
changeset
|
255 "Retrieve a copy of a saved revision of SCCS controlled FILE. |
94804
33d1e8fb0ae5
Make SCCS backend directory-aware.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
94678
diff
changeset
|
256 If FILE is a directory, all version-controlled files beneath are checked out. |
35134
f7a5d39c26f0
(vc-sccs-latest-on-branch-p): Removed.
André Spiegel <spiegel@gnu.org>
parents:
33560
diff
changeset
|
257 EDITABLE non-nil means that the file should be writable and |
47798
20dfef584009
(vc-sccs-find-version): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44006
diff
changeset
|
258 locked. REV is the revision to check out." |
95039
939006f4843e
(vc-sccs-create-tag): Fix typo in error message and pass backend arg.
Juanma Barranquero <lekktu@gmail.com>
parents:
95020
diff
changeset
|
259 (if (file-directory-p file) |
94804
33d1e8fb0ae5
Make SCCS backend directory-aware.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
94678
diff
changeset
|
260 (mapc 'vc-sccs-checkout (vc-expand-dirs (list file))) |
33d1e8fb0ae5
Make SCCS backend directory-aware.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
94678
diff
changeset
|
261 (let ((file-buffer (get-file-buffer file)) |
33d1e8fb0ae5
Make SCCS backend directory-aware.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
94678
diff
changeset
|
262 switches) |
33d1e8fb0ae5
Make SCCS backend directory-aware.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
94678
diff
changeset
|
263 (message "Checking out %s..." file) |
33d1e8fb0ae5
Make SCCS backend directory-aware.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
94678
diff
changeset
|
264 (save-excursion |
33d1e8fb0ae5
Make SCCS backend directory-aware.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
94678
diff
changeset
|
265 ;; Change buffers to get local value of vc-checkout-switches. |
33d1e8fb0ae5
Make SCCS backend directory-aware.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
94678
diff
changeset
|
266 (if file-buffer (set-buffer file-buffer)) |
33d1e8fb0ae5
Make SCCS backend directory-aware.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
94678
diff
changeset
|
267 (setq switches (vc-switches 'SCCS 'checkout)) |
33d1e8fb0ae5
Make SCCS backend directory-aware.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
94678
diff
changeset
|
268 ;; Save this buffer's default-directory |
33d1e8fb0ae5
Make SCCS backend directory-aware.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
94678
diff
changeset
|
269 ;; and use save-excursion to make sure it is restored |
33d1e8fb0ae5
Make SCCS backend directory-aware.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
94678
diff
changeset
|
270 ;; in the same buffer it was saved in. |
33d1e8fb0ae5
Make SCCS backend directory-aware.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
94678
diff
changeset
|
271 (let ((default-directory default-directory)) |
33d1e8fb0ae5
Make SCCS backend directory-aware.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
94678
diff
changeset
|
272 (save-excursion |
33d1e8fb0ae5
Make SCCS backend directory-aware.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
94678
diff
changeset
|
273 ;; Adjust the default-directory so that the check-out creates |
33d1e8fb0ae5
Make SCCS backend directory-aware.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
94678
diff
changeset
|
274 ;; the file in the right place. |
33d1e8fb0ae5
Make SCCS backend directory-aware.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
94678
diff
changeset
|
275 (setq default-directory (file-name-directory file)) |
31385
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
276 |
94804
33d1e8fb0ae5
Make SCCS backend directory-aware.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
94678
diff
changeset
|
277 (and rev (or (string= rev "") |
33d1e8fb0ae5
Make SCCS backend directory-aware.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
94678
diff
changeset
|
278 (not (stringp rev))) |
33d1e8fb0ae5
Make SCCS backend directory-aware.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
94678
diff
changeset
|
279 (setq rev nil)) |
33d1e8fb0ae5
Make SCCS backend directory-aware.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
94678
diff
changeset
|
280 (apply 'vc-sccs-do-command nil 0 "get" (vc-name file) |
33d1e8fb0ae5
Make SCCS backend directory-aware.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
94678
diff
changeset
|
281 (if editable "-e") |
33d1e8fb0ae5
Make SCCS backend directory-aware.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
94678
diff
changeset
|
282 (and rev (concat "-r" (vc-sccs-lookup-triple file rev))) |
33d1e8fb0ae5
Make SCCS backend directory-aware.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
94678
diff
changeset
|
283 switches)))) |
33d1e8fb0ae5
Make SCCS backend directory-aware.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
94678
diff
changeset
|
284 (message "Checking out %s...done" file)))) |
31385
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
285 |
85141
b16f7408cd3f
Carry through today's big terminology change to a few places where I
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
85139
diff
changeset
|
286 (defun vc-sccs-rollback (files) |
94804
33d1e8fb0ae5
Make SCCS backend directory-aware.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
94678
diff
changeset
|
287 "Roll back, undoing the most recent checkins of FILES. Directories |
33d1e8fb0ae5
Make SCCS backend directory-aware.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
94678
diff
changeset
|
288 are expanded to all version-controlled subfiles." |
33d1e8fb0ae5
Make SCCS backend directory-aware.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
94678
diff
changeset
|
289 (setq files (vc-expand-dirs files)) |
81967
6bf2af5a341e
Put the lower half (the back-end) of NewVC in place. This commit
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
75347
diff
changeset
|
290 (if (not files) |
6bf2af5a341e
Put the lower half (the back-end) of NewVC in place. This commit
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
75347
diff
changeset
|
291 (error "SCCS backend doesn't support directory-level rollback.")) |
6bf2af5a341e
Put the lower half (the back-end) of NewVC in place. This commit
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
75347
diff
changeset
|
292 (dolist (file files) |
85139
8ba0e30716a5
Terminology cleanup.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
82140
diff
changeset
|
293 (let ((discard (vc-working-revision file))) |
95039
939006f4843e
(vc-sccs-create-tag): Fix typo in error message and pass backend arg.
Juanma Barranquero <lekktu@gmail.com>
parents:
95020
diff
changeset
|
294 (if (null (yes-or-no-p (format "Remove version %s from %s history? " |
81967
6bf2af5a341e
Put the lower half (the back-end) of NewVC in place. This commit
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
75347
diff
changeset
|
295 discard file))) |
6bf2af5a341e
Put the lower half (the back-end) of NewVC in place. This commit
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
75347
diff
changeset
|
296 (error "Aborted")) |
6bf2af5a341e
Put the lower half (the back-end) of NewVC in place. This commit
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
75347
diff
changeset
|
297 (message "Removing revision %s from %s..." discard file) |
94190
fad57210c7d2
* lisp/vc-sccs.el (vc-sccs-do-command): New fun. Use the "sccs" command.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94003
diff
changeset
|
298 (vc-sccs-do-command nil 0 "rmdel" |
fad57210c7d2
* lisp/vc-sccs.el (vc-sccs-do-command): New fun. Use the "sccs" command.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94003
diff
changeset
|
299 (vc-name file) (concat "-r" discard)) |
fad57210c7d2
* lisp/vc-sccs.el (vc-sccs-do-command): New fun. Use the "sccs" command.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94003
diff
changeset
|
300 (vc-sccs-do-command nil 0 "get" (vc-name file) nil)))) |
81967
6bf2af5a341e
Put the lower half (the back-end) of NewVC in place. This commit
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
75347
diff
changeset
|
301 |
39001
d13c2139752b
(vc-*-revert-file): Handle new optional arg CONTENTS-DONE.
André Spiegel <spiegel@gnu.org>
parents:
38436
diff
changeset
|
302 (defun vc-sccs-revert (file &optional contents-done) |
94804
33d1e8fb0ae5
Make SCCS backend directory-aware.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
94678
diff
changeset
|
303 "Revert FILE to the version it was based on. If FILE is a directory, |
33d1e8fb0ae5
Make SCCS backend directory-aware.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
94678
diff
changeset
|
304 revert all subfiles." |
95039
939006f4843e
(vc-sccs-create-tag): Fix typo in error message and pass backend arg.
Juanma Barranquero <lekktu@gmail.com>
parents:
95020
diff
changeset
|
305 (if (file-directory-p file) |
94804
33d1e8fb0ae5
Make SCCS backend directory-aware.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
94678
diff
changeset
|
306 (mapc 'vc-sccs-revert (vc-expand-dirs (list file))) |
33d1e8fb0ae5
Make SCCS backend directory-aware.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
94678
diff
changeset
|
307 (vc-sccs-do-command nil 0 "unget" (vc-name file)) |
33d1e8fb0ae5
Make SCCS backend directory-aware.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
94678
diff
changeset
|
308 (vc-sccs-do-command nil 0 "get" (vc-name file)) |
33d1e8fb0ae5
Make SCCS backend directory-aware.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
94678
diff
changeset
|
309 ;; Checking out explicit revisions is not supported under SCCS, yet. |
33d1e8fb0ae5
Make SCCS backend directory-aware.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
94678
diff
changeset
|
310 ;; We always "revert" to the latest revision; therefore |
33d1e8fb0ae5
Make SCCS backend directory-aware.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
94678
diff
changeset
|
311 ;; vc-working-revision is cleared here so that it gets recomputed. |
33d1e8fb0ae5
Make SCCS backend directory-aware.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
94678
diff
changeset
|
312 (vc-file-setprop file 'vc-working-revision nil))) |
33560 | 313 |
314 (defun vc-sccs-steal-lock (file &optional rev) | |
315 "Steal the lock on the current workfile for FILE and revision REV." | |
95039
939006f4843e
(vc-sccs-create-tag): Fix typo in error message and pass backend arg.
Juanma Barranquero <lekktu@gmail.com>
parents:
95020
diff
changeset
|
316 (if (file-directory-p file) |
94804
33d1e8fb0ae5
Make SCCS backend directory-aware.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
94678
diff
changeset
|
317 (mapc 'vc-sccs-steal-lock (vc-expand-dirs (list file))) |
33d1e8fb0ae5
Make SCCS backend directory-aware.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
94678
diff
changeset
|
318 (vc-sccs-do-command nil 0 "unget" |
33d1e8fb0ae5
Make SCCS backend directory-aware.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
94678
diff
changeset
|
319 (vc-name file) "-n" (if rev (concat "-r" rev))) |
33d1e8fb0ae5
Make SCCS backend directory-aware.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
94678
diff
changeset
|
320 (vc-sccs-do-command nil 0 "get" |
33d1e8fb0ae5
Make SCCS backend directory-aware.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
94678
diff
changeset
|
321 (vc-name file) "-g" (if rev (concat "-r" rev))))) |
33560 | 322 |
87432
315124ffb889
* (vc.el, vc-sccs.el, vc-rcs.el, vc-cs.el, vc-mcvs.el): Put
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
85141
diff
changeset
|
323 (defun vc-sccs-modify-change-comment (files rev comment) |
315124ffb889
* (vc.el, vc-sccs.el, vc-rcs.el, vc-cs.el, vc-mcvs.el): Put
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
85141
diff
changeset
|
324 "Modify (actually, append to) the change comments for FILES on a specified REV." |
94804
33d1e8fb0ae5
Make SCCS backend directory-aware.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
94678
diff
changeset
|
325 (dolist (file (vc-expand-dirs files)) |
95039
939006f4843e
(vc-sccs-create-tag): Fix typo in error message and pass backend arg.
Juanma Barranquero <lekktu@gmail.com>
parents:
95020
diff
changeset
|
326 (vc-sccs-do-command nil 0 "cdc" (vc-name file) |
94190
fad57210c7d2
* lisp/vc-sccs.el (vc-sccs-do-command): New fun. Use the "sccs" command.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94003
diff
changeset
|
327 (concat "-y" comment) (concat "-r" rev)))) |
87432
315124ffb889
* (vc.el, vc-sccs.el, vc-rcs.el, vc-cs.el, vc-mcvs.el): Put
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
85141
diff
changeset
|
328 |
33560 | 329 |
330 ;;; | |
331 ;;; History functions | |
332 ;;; | |
333 | |
81967
6bf2af5a341e
Put the lower half (the back-end) of NewVC in place. This commit
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
75347
diff
changeset
|
334 (defun vc-sccs-print-log (files &optional buffer) |
6bf2af5a341e
Put the lower half (the back-end) of NewVC in place. This commit
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
75347
diff
changeset
|
335 "Get change log associated with FILES." |
94804
33d1e8fb0ae5
Make SCCS backend directory-aware.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
94678
diff
changeset
|
336 (setq files (vc-expand-dirs files)) |
94190
fad57210c7d2
* lisp/vc-sccs.el (vc-sccs-do-command): New fun. Use the "sccs" command.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94003
diff
changeset
|
337 (vc-sccs-do-command buffer 0 "prs" (mapcar 'vc-name files))) |
81967
6bf2af5a341e
Put the lower half (the back-end) of NewVC in place. This commit
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
75347
diff
changeset
|
338 |
6bf2af5a341e
Put the lower half (the back-end) of NewVC in place. This commit
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
75347
diff
changeset
|
339 (defun vc-sccs-diff (files &optional oldvers newvers buffer) |
6bf2af5a341e
Put the lower half (the back-end) of NewVC in place. This commit
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
75347
diff
changeset
|
340 "Get a difference report using SCCS between two filesets." |
94804
33d1e8fb0ae5
Make SCCS backend directory-aware.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
94678
diff
changeset
|
341 (setq files (vc-expand-dirs files)) |
92195
c1eed47c8247
(vc-sccs-diff): Fix setting of oldvers and newvers.
Glenn Morris <rgm@gnu.org>
parents:
92167
diff
changeset
|
342 (setq oldvers (vc-sccs-lookup-triple (car files) oldvers)) |
c1eed47c8247
(vc-sccs-diff): Fix setting of oldvers and newvers.
Glenn Morris <rgm@gnu.org>
parents:
92167
diff
changeset
|
343 (setq newvers (vc-sccs-lookup-triple (car files) newvers)) |
92167 | 344 (apply 'vc-do-command (or buffer "*vc-diff*") |
81967
6bf2af5a341e
Put the lower half (the back-end) of NewVC in place. This commit
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
75347
diff
changeset
|
345 1 "vcdiff" (mapcar 'vc-name (vc-expand-dirs files)) |
35823
9396894025fa
(vc-sccs-diff-switches): New customization option.
André Spiegel <spiegel@gnu.org>
parents:
35179
diff
changeset
|
346 (append (list "-q" |
9396894025fa
(vc-sccs-diff-switches): New customization option.
André Spiegel <spiegel@gnu.org>
parents:
35179
diff
changeset
|
347 (and oldvers (concat "-r" oldvers)) |
9396894025fa
(vc-sccs-diff-switches): New customization option.
André Spiegel <spiegel@gnu.org>
parents:
35179
diff
changeset
|
348 (and newvers (concat "-r" newvers))) |
50902
b12a550504a4
(vc-sccs-register, vc-sccs-checkin)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49597
diff
changeset
|
349 (vc-switches 'SCCS 'diff)))) |
33560 | 350 |
351 | |
352 ;;; | |
95020
4da572dc4992
Snapshot primitives globally renamed to refer to tags, documentation updated.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
94847
diff
changeset
|
353 ;;; Tag system. SCCS doesn't have tags, so we simulate them by maintaining |
4da572dc4992
Snapshot primitives globally renamed to refer to tags, documentation updated.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
94847
diff
changeset
|
354 ;;; our own set of name-to-revision mappings. |
33560 | 355 ;;; |
356 | |
95020
4da572dc4992
Snapshot primitives globally renamed to refer to tags, documentation updated.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
94847
diff
changeset
|
357 (defun vc-sccs-create-tag (backend dir name branchp) |
4da572dc4992
Snapshot primitives globally renamed to refer to tags, documentation updated.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
94847
diff
changeset
|
358 (when branchp |
95039
939006f4843e
(vc-sccs-create-tag): Fix typo in error message and pass backend arg.
Juanma Barranquero <lekktu@gmail.com>
parents:
95020
diff
changeset
|
359 (error "SCCS backend %s does not support module branches" backend)) |
95020
4da572dc4992
Snapshot primitives globally renamed to refer to tags, documentation updated.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
94847
diff
changeset
|
360 (let ((result (vc-tag-precondition dir))) |
4da572dc4992
Snapshot primitives globally renamed to refer to tags, documentation updated.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
94847
diff
changeset
|
361 (if (stringp result) |
4da572dc4992
Snapshot primitives globally renamed to refer to tags, documentation updated.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
94847
diff
changeset
|
362 (error "File %s is not up-to-date" result) |
4da572dc4992
Snapshot primitives globally renamed to refer to tags, documentation updated.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
94847
diff
changeset
|
363 (vc-file-tree-walk |
4da572dc4992
Snapshot primitives globally renamed to refer to tags, documentation updated.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
94847
diff
changeset
|
364 dir |
4da572dc4992
Snapshot primitives globally renamed to refer to tags, documentation updated.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
94847
diff
changeset
|
365 (lambda (f) |
4da572dc4992
Snapshot primitives globally renamed to refer to tags, documentation updated.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
94847
diff
changeset
|
366 (vc-sccs-add-triple name f (vc-working-revision f))))))) |
33560 | 367 |
368 | |
369 ;;; | |
370 ;;; Miscellaneous | |
371 ;;; | |
372 | |
373 (defun vc-sccs-check-headers () | |
374 "Check if the current file has any headers in it." | |
375 (save-excursion | |
376 (goto-char (point-min)) | |
377 (re-search-forward "%[A-Z]%" nil t))) | |
378 | |
379 (defun vc-sccs-rename-file (old new) | |
380 ;; Move the master file (using vc-rcs-master-templates). | |
381 (vc-rename-master (vc-name old) new vc-sccs-master-templates) | |
95020
4da572dc4992
Snapshot primitives globally renamed to refer to tags, documentation updated.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
94847
diff
changeset
|
382 ;; Update the tag file. |
33560 | 383 (with-current-buffer |
384 (find-file-noselect | |
385 (expand-file-name vc-sccs-name-assoc-file | |
386 (file-name-directory (vc-name old)))) | |
387 (goto-char (point-min)) | |
388 ;; (replace-regexp (concat ":" (regexp-quote old) "$") (concat ":" new)) | |
389 (while (re-search-forward (concat ":" (regexp-quote old) "$") nil t) | |
390 (replace-match (concat ":" new) nil nil)) | |
391 (basic-save-buffer) | |
392 (kill-buffer (current-buffer)))) | |
393 | |
103553
af4ee0cb7fb7
* vc-hooks.el (vc-stay-local-p, vc-state, vc-working-revision):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
100908
diff
changeset
|
394 (defun vc-sccs-find-file-hook () |
af4ee0cb7fb7
* vc-hooks.el (vc-stay-local-p, vc-state, vc-working-revision):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
100908
diff
changeset
|
395 ;; If the file is locked by some other user, make |
af4ee0cb7fb7
* vc-hooks.el (vc-stay-local-p, vc-state, vc-working-revision):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
100908
diff
changeset
|
396 ;; the buffer read-only. Like this, even root |
af4ee0cb7fb7
* vc-hooks.el (vc-stay-local-p, vc-state, vc-working-revision):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
100908
diff
changeset
|
397 ;; cannot modify a file that someone else has locked. |
103937
b0f266cccf0b
* vc-rcs.el (vc-rcs-find-file-hook):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
103553
diff
changeset
|
398 (and (stringp (vc-state buffer-file-name 'SCCS)) |
b0f266cccf0b
* vc-rcs.el (vc-rcs-find-file-hook):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
103553
diff
changeset
|
399 (setq buffer-read-only t))) |
103553
af4ee0cb7fb7
* vc-hooks.el (vc-stay-local-p, vc-state, vc-working-revision):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
100908
diff
changeset
|
400 |
33560 | 401 |
402 ;;; | |
403 ;;; Internal functions | |
404 ;;; | |
405 | |
406 ;; This function is wrapped with `progn' so that the autoload cookie | |
407 ;; copies the whole function itself into loaddefs.el rather than just placing | |
408 ;; a (autoload 'vc-sccs-search-project-dir "vc-sccs") which would not | |
409 ;; help us avoid loading vc-sccs. | |
410 ;;;###autoload | |
411 (progn (defun vc-sccs-search-project-dir (dirname basename) | |
412 "Return the name of a master file in the SCCS project directory. | |
413 Does not check whether the file exists but returns nil if it does not | |
414 find any project directory." | |
415 (let ((project-dir (getenv "PROJECTDIR")) dirs dir) | |
416 (when project-dir | |
417 (if (file-name-absolute-p project-dir) | |
418 (setq dirs '("SCCS" "")) | |
419 (setq dirs '("src/SCCS" "src" "source/SCCS" "source")) | |
420 (setq project-dir (expand-file-name (concat "~" project-dir)))) | |
421 (while (and (not dir) dirs) | |
422 (setq dir (expand-file-name (car dirs) project-dir)) | |
423 (unless (file-directory-p dir) | |
424 (setq dir nil) | |
425 (setq dirs (cdr dirs)))) | |
426 (and dir (expand-file-name (concat "s." basename) dir)))))) | |
427 | |
428 (defun vc-sccs-lock-file (file) | |
429 "Generate lock file name corresponding to FILE." | |
430 (let ((master (vc-name file))) | |
431 (and | |
432 master | |
433 (string-match "\\(.*/\\)\\(s\\.\\)\\(.*\\)" master) | |
434 (replace-match "p." t t master 2)))) | |
435 | |
436 (defun vc-sccs-parse-locks () | |
437 "Parse SCCS locks in current buffer. | |
85141
b16f7408cd3f
Carry through today's big terminology change to a few places where I
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
85139
diff
changeset
|
438 The result is a list of the form ((REVISION . USER) (REVISION . USER) ...)." |
33560 | 439 (let (master-locks) |
440 (goto-char (point-min)) | |
441 (while (re-search-forward "^\\([0-9.]+\\) [0-9.]+ \\([^ ]+\\) .*\n?" | |
442 nil t) | |
443 (setq master-locks | |
444 (cons (cons (match-string 1) (match-string 2)) master-locks))) | |
445 ;; FIXME: is it really necessary to reverse ? | |
446 (nreverse master-locks))) | |
447 | |
448 (defun vc-sccs-add-triple (name file rev) | |
449 (with-current-buffer | |
450 (find-file-noselect | |
451 (expand-file-name vc-sccs-name-assoc-file | |
452 (file-name-directory (vc-name file)))) | |
453 (goto-char (point-max)) | |
454 (insert name "\t:\t" file "\t" rev "\n") | |
455 (basic-save-buffer) | |
456 (kill-buffer (current-buffer)))) | |
457 | |
458 (defun vc-sccs-lookup-triple (file name) | |
95020
4da572dc4992
Snapshot primitives globally renamed to refer to tags, documentation updated.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
94847
diff
changeset
|
459 "Return the numeric revision corresponding to a named tag of FILE. |
85141
b16f7408cd3f
Carry through today's big terminology change to a few places where I
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
85139
diff
changeset
|
460 If NAME is nil or a revision number string it's just passed through." |
33560 | 461 (if (or (null name) |
462 (let ((firstchar (aref name 0))) | |
463 (and (>= firstchar ?0) (<= firstchar ?9)))) | |
464 name | |
465 (with-temp-buffer | |
466 (vc-insert-file | |
467 (expand-file-name vc-sccs-name-assoc-file | |
468 (file-name-directory (vc-name file)))) | |
469 (vc-parse-buffer (concat name "\t:\t" file "\t\\(.+\\)") 1)))) | |
31385
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
470 |
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
471 (provide 'vc-sccs) |
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
472 |
56953 | 473 ;; arch-tag: d751dee3-d7b3-47e1-95e3-7ae98c052041 |
31385
b1e1a94dfc0a
(vc-sccs-latest-on-branch-p): Always return t; we
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
474 ;;; vc-sccs.el ends here |