aboutsummaryrefslogtreecommitdiffstats
path: root/man/vc2-xtra.texi
diff options
context:
space:
mode:
Diffstat (limited to 'man/vc2-xtra.texi')
-rw-r--r--man/vc2-xtra.texi729
1 files changed, 729 insertions, 0 deletions
diff --git a/man/vc2-xtra.texi b/man/vc2-xtra.texi
new file mode 100644
index 00000000000..c800d9d912c
--- /dev/null
+++ b/man/vc2-xtra.texi
@@ -0,0 +1,729 @@
1@c This file is included either in vc-xtra.texi (when producing the
2@c printed version) or in the main Emacs manual (for the on-line version).
3@node Remote Repositories
4@subsection Remote Repositories
5@cindex remote repositories (CVS)
6
7 A common way of using CVS is to set up a central CVS repository on
8some Internet host, then have each developer check out a personal
9working copy of the files on his local machine. Committing changes to
10the repository, and picking up changes from other users into one's own
11working area, then works by direct interactions with the CVS server.
12
13 One difficulty is that access to the CVS server is often slow, and
14that developers might need to work off-line as well. VC is designed
15to reduce the amount of network interaction necessary.
16
17@menu
18* Version Backups:: Keeping local copies of repository versions.
19* Local Version Control:: Using another version system for local editing.
20@end menu
21
22@node Version Backups
23@subsubsection Version Backups
24@cindex version backups
25
26@cindex automatic version backups
27 When VC sees that the CVS repository for a file is on a remote
28machine, it automatically makes local backups of unmodified versions
29of the file---@dfn{automatic version backups}. This means that you
30can compare the file to the repository version (@kbd{C-x v =}), or
31revert to that version (@kbd{C-x v u}), without any network
32interactions.
33
34 The local copy of the unmodified file is called a @dfn{version
35backup} to indicate that it corresponds exactly to a version that is
36stored in the repository. Note that version backups are not the same
37as ordinary Emacs backup files (@pxref{Backup,,,emacs, the Emacs
38Manual}). But they follow a similar naming convention.
39
40 For a file that comes from a remote CVS repository, VC makes a
41version backup whenever you save the first changes to the file, and
42removes it after you have committed your modified version to the
43repository. You can disable the making of automatic version backups by
44setting @code{vc-cvs-stay-local} to @code{nil} (@pxref{CVS Options}).
45
46@cindex manual version backups
47 The name of the automatic version backup for version @var{version}
48of file @var{file} is @code{@var{file}.~@var{version}.~}. This is
49almost the same as the name used by @kbd{C-x v ~} (@pxref{Old
50Versions,,,emacs, the Emacs Manual}), the only difference being
51the additional dot (@samp{.}) after the version number. This
52similarity is intentional, because both kinds of files store the same
53kind of information. The file made by @kbd{C-x v ~} acts as a
54@dfn{manual version backup}.
55
56 All the VC commands that operate on old versions of a file can use
57both kinds of version backups. For instance, @kbd{C-x v ~} uses
58either an automatic or a manual version backup, if possible, to get
59the contents of the version you request. Likewise, @kbd{C-x v =} and
60@kbd{C-x v u} use either an automatic or a manual version backup, if
61one of them exists, to get the contents of a version to compare or
62revert to. If you changed a file outside of Emacs, so that no
63automatic version backup was created for the previous text, you can
64create a manual backup of that version using @kbd{C-x v ~}, and thus
65obtain the benefit of the local copy for Emacs commands.
66
67 The only difference in Emacs's handling of manual and automatic
68version backups, once they exist, is that Emacs deletes automatic
69version backups when you commit to the repository. By contrast,
70manual version backups remain until you delete them.
71
72@node Local Version Control
73@subsubsection Local Version Control
74@cindex local version control
75@cindex local back end (version control)
76
77When you make many changes to a file that comes from a remote
78repository, it can be convenient to have version control on your local
79machine as well. You can then record intermediate versions, revert to
80a previous state, etc., before you actually commit your changes to the
81remote server.
82
83VC lets you do this by putting a file under a second, local version
84control system, so that the file is effectively registered in two
85systems at the same time. For the description here, we will assume
86that the remote system is CVS, and you use RCS locally, although the
87mechanism works with any combination of version control systems
88(@dfn{back ends}).
89
90To make it work with other back ends, you must make sure that the
91``more local'' back end comes before the ``more remote'' back end in
92the setting of @code{vc-handled-backends} (@pxref{Customizing VC}). By
93default, this variable is set up so that you can use remote CVS and
94local RCS as described here.
95
96To start using local RCS for a file that comes from a remote CVS
97server, you must @emph{register the file in RCS}, by typing @kbd{C-u
98C-x v v rcs @key{RET}}. (In other words, use @code{vc-next-action} with a
99prefix argument, and specify RCS as the back end.)
100
101You can do this at any time; it does not matter whether you have
102already modified the file with respect to the version in the CVS
103repository. If possible, VC tries to make the RCS master start with
104the unmodified repository version, then checks in any local changes
105as a new version. This works if you have not made any changes yet, or
106if the unmodified repository version exists locally as a version
107backup (@pxref{Version Backups}). If the unmodified version is not
108available locally, the RCS master starts with the modified version;
109the only drawback to this is that you cannot compare your changes
110locally to what is stored in the repository.
111
112The version number of the RCS master is derived from the current CVS
113version, starting a branch from it. For example, if the current CVS
114version is 1.23, the local RCS branch will be 1.23.1. Version 1.23 in
115the RCS master will be identical to version 1.23 under CVS; your first
116changes are checked in as 1.23.1.1. (If the unmodified file is not
117available locally, VC will check in the modified file twice, both as
1181.23 and 1.23.1.1, to make the revision numbers consistent.)
119
120If you do not use locking under CVS (the default), locking is also
121disabled for RCS, so that editing under RCS works exactly as under
122CVS.
123
124When you are done with local editing, you can commit the final version
125back to the CVS repository by typing @kbd{C-u C-x v v cvs @key{RET}}.
126This initializes the log entry buffer (@pxref{Log Buffer,,,emacs, the
127Emacs Manual}) to contain all the log entries you have recorded in the
128RCS master; you can edit them as you wish, and then commit in CVS by
129typing @kbd{C-c C-c}. If the commit is successful, VC removes the RCS
130master, so that the file is once again registered under CVS only.
131(The RCS master is not actually deleted, just renamed by appending
132@samp{~} to the name, so that you can refer to it later if you wish.)
133
134While using local RCS, you can pick up recent changes from the CVS
135repository into your local file, or commit some of your changes back
136to CVS, without terminating local RCS version control. To do this,
137switch to the CVS back end temporarily, with the @kbd{C-x v b} command:
138
139@table @kbd
140@item C-x v b
141Switch to another back end that the current file is registered
142under (@code{vc-switch-backend}).
143
144@item C-u C-x v b @var{backend} @key{RET}
145Switch to @var{backend} for the current file.
146@end table
147
148@kindex C-x v b
149@findex vc-switch-backend
150@kbd{C-x v b} does not change the buffer contents, or any files; it
151only changes VC's perspective on how to handle the file. Any
152subsequent VC commands for that file will operate on the back end that
153is currently selected.
154
155If the current file is registered in more than one back end, typing
156@kbd{C-x v b} ``cycles'' through all of these back ends. With a
157prefix argument, it asks for the back end to use in the minibuffer.
158
159Thus, if you are using local RCS, and you want to pick up some recent
160changes in the file from remote CVS, first visit the file, then type
161@kbd{C-x v b} to switch to CVS, and finally use @kbd{C-x v m
162@key{RET}} to merge the news (@pxref{Merging,,,emacs, the Emacs
163Manual}). You can then switch back to RCS by typing @kbd{C-x v b}
164again, and continue to edit locally.
165
166But if you do this, the revision numbers in the RCS master no longer
167correspond to those of CVS. Technically, this is not a problem, but
168it can become difficult to keep track of what is in the CVS repository
169and what is not. So we suggest that you return from time to time to
170CVS-only operation, by committing your local changes back to the
171repository using @kbd{C-u C-x v v cvs @key{RET}}.
172
173@node Snapshots
174@subsection Snapshots
175@cindex snapshots and version control
176
177 A @dfn{snapshot} is a named set of file versions (one for each
178registered file) that you can treat as a unit. One important kind of
179snapshot is a @dfn{release}, a (theoretically) stable version of the
180system that is ready for distribution to users.
181
182@menu
183* Making Snapshots:: The snapshot facilities.
184* Snapshot Caveats:: Things to be careful of when using snapshots.
185@end menu
186
187@node Making Snapshots
188@subsubsection Making and Using Snapshots
189
190 There are two basic commands for snapshots; one makes a
191snapshot with a given name, the other retrieves a named snapshot.
192
193@table @code
194@kindex C-x v s
195@findex vc-create-snapshot
196@item C-x v s @var{name} @key{RET}
197Define the last saved versions of every registered file in or under the
198current directory as a snapshot named @var{name}
199(@code{vc-create-snapshot}).
200
201@kindex C-x v r
202@findex vc-retrieve-snapshot
203@item C-x v r @var{name} @key{RET}
204For all registered files at or below the current directory level, select
205whatever versions correspond to the snapshot @var{name}
206(@code{vc-retrieve-snapshot}).
207
208This command reports an error if any files are locked at or below the
209current directory, without changing anything; this is to avoid
210overwriting work in progress.
211@end table
212
213 A snapshot uses a very small amount of resources---just enough to record
214the list of file names and which version belongs to the snapshot. Thus,
215you need not hesitate to create snapshots whenever they are useful.
216
217 You can give a snapshot name as an argument to @kbd{C-x v =} or
218@kbd{C-x v ~} (@pxref{Old Versions,,,emacs, the Emacs Manual}).
219Thus, you can use it to compare a snapshot against the current files,
220or two snapshots against each other, or a snapshot against a named
221version.
222
223@node Snapshot Caveats
224@subsubsection Snapshot Caveats
225
226@cindex named configurations (RCS)
227 VC's snapshot facilities are modeled on RCS's named-configuration
228support. They use RCS's native facilities for this, so
229snapshots made using RCS through VC are visible even when you bypass VC.
230
231 With CVS, Meta-CVS, and Subversion, VC also uses the native
232mechanism provided by that back end to make snapshots and retrieve them
233(@dfn{tags} for CVS and Meta-CVS, @dfn{copies} for Subversion).
234
235@c worded verbosely to avoid overfull hbox.
236 For SCCS, VC implements snapshots itself. The files it uses contain
237name/file/version-number triples. These snapshots are visible only
238through VC.
239
240 There is no support for VC snapshots using GNU Arch yet.
241
242 A snapshot is a set of checked-in versions. So make sure that all the
243files are checked in and not locked when you make a snapshot.
244
245 File renaming and deletion can create some difficulties with snapshots.
246This is not a VC-specific problem, but a general design issue in version
247control systems that no one has solved very well yet.
248
249 If you rename a registered file, you need to rename its master along
250with it (the command @code{vc-rename-file} does this automatically). If
251you are using SCCS, you must also update the records of the snapshot, to
252mention the file by its new name (@code{vc-rename-file} does this,
253too). An old snapshot that refers to a master file that no longer
254exists under the recorded name is invalid; VC can no longer retrieve
255it. It would be beyond the scope of this manual to explain enough about
256RCS and SCCS to explain how to update the snapshots by hand.
257
258 Using @code{vc-rename-file} makes the snapshot remain valid for
259retrieval, but it does not solve all problems. For example, some of the
260files in your program probably refer to others by name. At the very
261least, the makefile probably mentions the file that you renamed. If you
262retrieve an old snapshot, the renamed file is retrieved under its new
263name, which is not the name that the makefile expects. So the program
264won't really work as retrieved.
265
266@node Miscellaneous VC
267@subsection Miscellaneous Commands and Features of VC
268
269 This section explains the less-frequently-used features of VC.
270
271@menu
272* Change Logs and VC:: Generating a change log file from log entries.
273* Renaming and VC:: A command to rename both the source and master
274 file correctly.
275* Version Headers:: Inserting version control headers into working files.
276@end menu
277
278@node Change Logs and VC
279@subsubsection Change Logs and VC
280
281 If you use RCS or CVS for a program and also maintain a change log
282file for it (@pxref{Change Log,,,emacs, the Emacs Manual}), you
283can generate change log entries automatically from the version control
284log entries:
285
286@table @kbd
287@item C-x v a
288@kindex C-x v a
289@findex vc-update-change-log
290Visit the current directory's change log file and, for registered files
291in that directory, create new entries for versions checked in since the
292most recent entry in the change log file.
293(@code{vc-update-change-log}).
294
295This command works with RCS or CVS only, not with any of the other
296back ends.
297
298@item C-u C-x v a
299As above, but only find entries for the current buffer's file.
300
301@item M-1 C-x v a
302As above, but find entries for all the currently visited files that are
303maintained with version control. This works only with RCS, and it puts
304all entries in the log for the default directory, which may not be
305appropriate.
306@end table
307
308 For example, suppose the first line of @file{ChangeLog} is dated
3091999-04-10, and that the only check-in since then was by Nathaniel
310Bowditch to @file{rcs2log} on 1999-05-22 with log text @samp{Ignore log
311messages that start with `#'.}. Then @kbd{C-x v a} visits
312@file{ChangeLog} and inserts text like this:
313
314@iftex
315@medbreak
316@end iftex
317@smallexample
318@group
3191999-05-22 Nathaniel Bowditch <nat@@apn.org>
320
321 * rcs2log: Ignore log messages that start with `#'.
322@end group
323@end smallexample
324@iftex
325@medbreak
326@end iftex
327
328@noindent
329You can then edit the new change log entry further as you wish.
330
331 Some of the new change log entries may duplicate what's already in
332ChangeLog. You will have to remove these duplicates by hand.
333
334 Normally, the log entry for file @file{foo} is displayed as @samp{*
335foo: @var{text of log entry}}. The @samp{:} after @file{foo} is omitted
336if the text of the log entry starts with @w{@samp{(@var{functionname}):
337}}. For example, if the log entry for @file{vc.el} is
338@samp{(vc-do-command): Check call-process status.}, then the text in
339@file{ChangeLog} looks like this:
340
341@iftex
342@medbreak
343@end iftex
344@smallexample
345@group
3461999-05-06 Nathaniel Bowditch <nat@@apn.org>
347
348 * vc.el (vc-do-command): Check call-process status.
349@end group
350@end smallexample
351@iftex
352@medbreak
353@end iftex
354
355 When @kbd{C-x v a} adds several change log entries at once, it groups
356related log entries together if they all are checked in by the same
357author at nearly the same time. If the log entries for several such
358files all have the same text, it coalesces them into a single entry.
359For example, suppose the most recent check-ins have the following log
360entries:
361
362@flushleft
363@bullet{} For @file{vc.texinfo}: @samp{Fix expansion typos.}
364@bullet{} For @file{vc.el}: @samp{Don't call expand-file-name.}
365@bullet{} For @file{vc-hooks.el}: @samp{Don't call expand-file-name.}
366@end flushleft
367
368@noindent
369They appear like this in @file{ChangeLog}:
370
371@iftex
372@medbreak
373@end iftex
374@smallexample
375@group
3761999-04-01 Nathaniel Bowditch <nat@@apn.org>
377
378 * vc.texinfo: Fix expansion typos.
379
380 * vc.el, vc-hooks.el: Don't call expand-file-name.
381@end group
382@end smallexample
383@iftex
384@medbreak
385@end iftex
386
387 Normally, @kbd{C-x v a} separates log entries by a blank line, but you
388can mark several related log entries to be clumped together (without an
389intervening blank line) by starting the text of each related log entry
390with a label of the form @w{@samp{@{@var{clumpname}@} }}. The label
391itself is not copied to @file{ChangeLog}. For example, suppose the log
392entries are:
393
394@flushleft
395@bullet{} For @file{vc.texinfo}: @samp{@{expand@} Fix expansion typos.}
396@bullet{} For @file{vc.el}: @samp{@{expand@} Don't call expand-file-name.}
397@bullet{} For @file{vc-hooks.el}: @samp{@{expand@} Don't call expand-file-name.}
398@end flushleft
399
400@noindent
401Then the text in @file{ChangeLog} looks like this:
402
403@iftex
404@medbreak
405@end iftex
406@smallexample
407@group
4081999-04-01 Nathaniel Bowditch <nat@@apn.org>
409
410 * vc.texinfo: Fix expansion typos.
411 * vc.el, vc-hooks.el: Don't call expand-file-name.
412@end group
413@end smallexample
414@iftex
415@medbreak
416@end iftex
417
418 A log entry whose text begins with @samp{#} is not copied to
419@file{ChangeLog}. For example, if you merely fix some misspellings in
420comments, you can log the change with an entry beginning with @samp{#}
421to avoid putting such trivia into @file{ChangeLog}.
422
423@node Renaming and VC
424@subsubsection Renaming VC Work Files and Master Files
425
426@findex vc-rename-file
427 When you rename a registered file, you must also rename its master
428file correspondingly to get proper results. Use @code{vc-rename-file}
429to rename the source file as you specify, and rename its master file
430accordingly. It also updates any snapshots (@pxref{Snapshots}) that
431mention the file, so that they use the new name; despite this, the
432snapshot thus modified may not completely work (@pxref{Snapshot
433Caveats}).
434
435 Some back ends do not provide an explicit rename operation to their
436repositories. After issuing @code{vc-rename-file}, use @kbd{C-x v v}
437on the original and renamed buffers and provide the necessary edit
438log.
439
440 You cannot use @code{vc-rename-file} on a file that is locked by
441someone else.
442
443@node Version Headers
444@subsubsection Inserting Version Control Headers
445
446 Sometimes it is convenient to put version identification strings
447directly into working files. Certain special strings called
448@dfn{version headers} are replaced in each successive version by the
449number of that version, the name of the user who created it, and other
450relevant information. All of the back ends that VC supports have such
451a mechanism, except GNU Arch.
452
453 VC does not normally use the information contained in these headers.
454The exception is RCS---with RCS, version headers are sometimes more
455reliable than the master file to determine which version of the file
456you are editing. Note that in a multi-branch environment, version
457headers are necessary to make VC behave correctly (@pxref{Multi-User
458Branching,,,emacs, the Emacs Manual}).
459
460 Searching for RCS version headers is controlled by the variable
461@code{vc-consult-headers}. If it is non-@code{nil} (the default),
462Emacs searches for headers to determine the version number you are
463editing. Setting it to @code{nil} disables this feature.
464
465 Note that although CVS uses the same kind of version headers as RCS
466does, VC never searches for these headers if you are using CVS,
467regardless of the above setting.
468
469@kindex C-x v h
470@findex vc-insert-headers
471 You can use the @kbd{C-x v h} command (@code{vc-insert-headers}) to
472insert a suitable header string.
473
474@table @kbd
475@item C-x v h
476Insert headers in a file for use with your version-control system.
477@end table
478
479@vindex vc-@var{backend}-header
480 The default header string is @samp{@w{$}Id$} for RCS and
481@samp{@w{%}W%} for SCCS. You can specify other headers to insert by
482setting the variables @code{vc-@var{backend}-header} where
483@var{backend} is @code{rcs} or @code{sccs}.
484
485 Instead of a single string, you can specify a list of strings; then
486each string in the list is inserted as a separate header on a line of
487its own.
488
489 It may be necessary to use apparently-superfluous backslashes when
490writing the strings that you put in this variable. For instance, you
491might write @code{"$Id\$"} rather than @code{"$Id@w{$}"}. The extra
492backslash prevents the string constant from being interpreted as a
493header, if the Emacs Lisp file containing it is maintained with
494version control.
495
496@vindex vc-comment-alist
497 Each header is inserted surrounded by tabs, inside comment delimiters,
498on a new line at point. Normally the ordinary comment
499start and comment end strings of the current mode are used, but for
500certain modes, there are special comment delimiters for this purpose;
501the variable @code{vc-comment-alist} specifies them. Each element of
502this list has the form @code{(@var{mode} @var{starter} @var{ender})}.
503
504@vindex vc-static-header-alist
505 The variable @code{vc-static-header-alist} specifies further strings
506to add based on the name of the buffer. Its value should be a list of
507elements of the form @code{(@var{regexp} . @var{format})}. Whenever
508@var{regexp} matches the buffer name, @var{format} is inserted as part
509of the header. A header line is inserted for each element that matches
510the buffer name, and for each string specified by
511@code{vc-@var{backend}-header}. The header line is made by processing the
512string from @code{vc-@var{backend}-header} with the format taken from the
513element. The default value for @code{vc-static-header-alist} is as follows:
514
515@example
516@group
517(("\\.c$" .
518 "\n#ifndef lint\nstatic char vcid[] = \"\%s\";\n\
519#endif /* lint */\n"))
520@end group
521@end example
522
523@noindent
524It specifies insertion of text of this form:
525
526@example
527@group
528
529#ifndef lint
530static char vcid[] = "@var{string}";
531#endif /* lint */
532@end group
533@end example
534
535@noindent
536Note that the text above starts with a blank line.
537
538 If you use more than one version header in a file, put them close
539together in the file. The mechanism in @code{revert-buffer} that
540preserves markers may not handle markers positioned between two version
541headers.
542
543@node Customizing VC
544@subsection Customizing VC
545
546@vindex vc-handled-backends
547The variable @code{vc-handled-backends} determines which version
548control systems VC should handle. The default value is @code{(RCS CVS
549SVN SCCS Arch MCVS)}, so it contains all six version systems that are
550currently supported. If you want VC to ignore one or more of these
551systems, exclude its name from the list. To disable VC entirely, set
552this variable to @code{nil}.
553
554The order of systems in the list is significant: when you visit a file
555registered in more than one system (@pxref{Local Version Control}), VC
556uses the system that comes first in @code{vc-handled-backends} by
557default. The order is also significant when you register a file for
558the first time, @pxref{Registering,,,emacs, the Emacs Manual} for
559details.
560
561@menu
562* General VC Options:: Options that apply to multiple back ends.
563* RCS and SCCS:: Options for RCS and SCCS.
564* CVS Options:: Options for CVS.
565@end menu
566
567@node General VC Options
568@subsubsection General Options
569
570@vindex vc-make-backup-files
571 Emacs normally does not save backup files for source files that are
572maintained with version control. If you want to make backup files even
573for files that use version control, set the variable
574@code{vc-make-backup-files} to a non-@code{nil} value.
575
576@vindex vc-keep-workfiles
577 Normally the work file exists all the time, whether it is locked or
578not. If you set @code{vc-keep-workfiles} to @code{nil}, then checking
579in a new version with @kbd{C-x v v} deletes the work file; but any
580attempt to visit the file with Emacs creates it again. (With CVS, work
581files are always kept.)
582
583@vindex vc-follow-symlinks
584 Editing a version-controlled file through a symbolic link can be
585dangerous. It bypasses the version control system---you can edit the
586file without locking it, and fail to check your changes in. Also,
587your changes might overwrite those of another user. To protect against
588this, VC checks each symbolic link that you visit, to see if it points
589to a file under version control.
590
591 The variable @code{vc-follow-symlinks} controls what to do when a
592symbolic link points to a version-controlled file. If it is @code{nil},
593VC only displays a warning message. If it is @code{t}, VC automatically
594follows the link, and visits the real file instead, telling you about
595this in the echo area. If the value is @code{ask} (the default), VC
596asks you each time whether to follow the link.
597
598@vindex vc-suppress-confirm
599 If @code{vc-suppress-confirm} is non-@code{nil}, then @kbd{C-x v v}
600and @kbd{C-x v i} can save the current buffer without asking, and
601@kbd{C-x v u} also operates without asking for confirmation. (This
602variable does not affect @kbd{C-x v c}; that operation is so drastic
603that it should always ask for confirmation.)
604
605@vindex vc-command-messages
606 VC mode does much of its work by running the shell commands for RCS,
607CVS and SCCS. If @code{vc-command-messages} is non-@code{nil}, VC
608displays messages to indicate which shell commands it runs, and
609additional messages when the commands finish.
610
611@vindex vc-path
612 You can specify additional directories to search for version control
613programs by setting the variable @code{vc-path}. These directories
614are searched before the usual search path. It is rarely necessary to
615set this variable, because VC normally finds the proper files
616automatically.
617
618@node RCS and SCCS
619@subsubsection Options for RCS and SCCS
620
621@cindex non-strict locking (RCS)
622@cindex locking, non-strict (RCS)
623 By default, RCS uses locking to coordinate the activities of several
624users, but there is a mode called @dfn{non-strict locking} in which
625you can check-in changes without locking the file first. Use
626@samp{rcs -U} to switch to non-strict locking for a particular file,
627see the @code{rcs} manual page for details.
628
629 When deducing the version control state of an RCS file, VC first
630looks for an RCS version header string in the file (@pxref{Version
631Headers}). If there is no header string, VC normally looks at the
632file permissions of the work file; this is fast. But there might be
633situations when the file permissions cannot be trusted. In this case
634the master file has to be consulted, which is rather expensive. Also
635the master file can only tell you @emph{if} there's any lock on the
636file, but not whether your work file really contains that locked
637version.
638
639@vindex vc-consult-headers
640 You can tell VC not to use version headers to determine the file
641status by setting @code{vc-consult-headers} to @code{nil}. VC then
642always uses the file permissions (if it is supposed to trust them), or
643else checks the master file.
644
645@vindex vc-mistrust-permissions
646 You can specify the criterion for whether to trust the file
647permissions by setting the variable @code{vc-mistrust-permissions}.
648Its value can be @code{t} (always mistrust the file permissions and
649check the master file), @code{nil} (always trust the file
650permissions), or a function of one argument which makes the decision.
651The argument is the directory name of the @file{RCS} subdirectory. A
652non-@code{nil} value from the function says to mistrust the file
653permissions. If you find that the file permissions of work files are
654changed erroneously, set @code{vc-mistrust-permissions} to @code{t}.
655Then VC always checks the master file to determine the file's status.
656
657 VC determines the version control state of files under SCCS much as
658with RCS. It does not consider SCCS version headers, though. Thus,
659the variable @code{vc-mistrust-permissions} affects SCCS use, but
660@code{vc-consult-headers} does not.
661
662@node CVS Options
663@subsubsection Options specific for CVS
664
665@cindex locking (CVS)
666 By default, CVS does not use locking to coordinate the activities of
667several users; anyone can change a work file at any time. However,
668there are ways to restrict this, resulting in behavior that resembles
669locking.
670
671@cindex CVSREAD environment variable (CVS)
672 For one thing, you can set the @env{CVSREAD} environment variable
673(the value you use makes no difference). If this variable is defined,
674CVS makes your work files read-only by default. In Emacs, you must
675type @kbd{C-x v v} to make the file writable, so that editing works
676in fact similar as if locking was used. Note however, that no actual
677locking is performed, so several users can make their files writable
678at the same time. When setting @env{CVSREAD} for the first time, make
679sure to check out all your modules anew, so that the file protections
680are set correctly.
681
682@cindex cvs watch feature
683@cindex watching files (CVS)
684 Another way to achieve something similar to locking is to use the
685@dfn{watch} feature of CVS. If a file is being watched, CVS makes it
686read-only by default, and you must also use @kbd{C-x v v} in Emacs to
687make it writable. VC calls @code{cvs edit} to make the file writable,
688and CVS takes care to notify other developers of the fact that you
689intend to change the file. See the CVS documentation for details on
690using the watch feature.
691
692@vindex vc-stay-local
693@vindex vc-cvs-stay-local
694@cindex remote repositories (CVS)
695 When a file's repository is on a remote machine, VC tries to keep
696network interactions to a minimum. This is controlled by the variable
697@code{vc-cvs-stay-local}. There is another variable,
698@code{vc-stay-local}, which enables the feature also for other back
699ends that support it, including CVS. In the following, we will talk
700only about @code{vc-cvs-stay-local}, but everything applies to
701@code{vc-stay-local} as well.
702
703If @code{vc-cvs-stay-local} is @code{t} (the default), then VC uses
704only the entry in the local CVS subdirectory to determine the file's
705state (and possibly information returned by previous CVS commands).
706One consequence of this is that when you have modified a file, and
707somebody else has already checked in other changes to the file, you
708are not notified of it until you actually try to commit. (But you can
709try to pick up any recent changes from the repository first, using
710@kbd{C-x v m @key{RET}}, @pxref{Merging,,,emacs, the Emacs Manual}).
711
712 When @code{vc-cvs-stay-local} is @code{t}, VC also makes local
713version backups, so that simple diff and revert operations are
714completely local (@pxref{Version Backups}).
715
716 On the other hand, if you set @code{vc-cvs-stay-local} to @code{nil},
717then VC queries the remote repository @emph{before} it decides what to
718do in @code{vc-next-action} (@kbd{C-x v v}), just as it does for local
719repositories. It also does not make any version backups.
720
721 You can also set @code{vc-cvs-stay-local} to a regular expression
722that is matched against the repository host name; VC then stays local
723only for repositories from hosts that match the pattern.
724
725@vindex vc-cvs-global-switches
726 You can specify additional command line options to pass to all CVS
727operations in the variable @code{vc-cvs-global-switches}. These
728switches are inserted immediately after the @code{cvs} command, before
729the name of the operation to invoke.