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