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