comparison man/files.texi @ 36355:d8c0e3d0f0aa

VC section updated. Added a subsection on remote repositories, reorganized customization part, plus various bits and pieces.
author André Spiegel <spiegel@gnu.org>
date Fri, 23 Feb 2001 16:03:15 +0000
parents f32c31c60f60
children a10bf38295d2
comparison
equal deleted inserted replaced
36354:4a730977cad1 36355:d8c0e3d0f0aa
481 481
482 For files managed by a version control system (@pxref{Version 482 For files managed by a version control system (@pxref{Version
483 Control}), the variable @code{vc-make-backup-files} determines whether 483 Control}), the variable @code{vc-make-backup-files} determines whether
484 to make backup files. By default, it is @code{nil}, since backup files 484 to make backup files. By default, it is @code{nil}, since backup files
485 are redundant when you store all the previous versions in a version 485 are redundant when you store all the previous versions in a version
486 control system. @xref{VC Workfile Handling}. 486 control system. @xref{General VC Options}.
487 487
488 @vindex backup-enable-predicate 488 @vindex backup-enable-predicate
489 @vindex temporary-file-directory 489 @vindex temporary-file-directory
490 @vindex small-temporary-file-directory 490 @vindex small-temporary-file-directory
491 The default value of the @code{backup-enable-predicate} variable 491 The default value of the @code{backup-enable-predicate} variable
1059 versions of a source file, usually storing the unchanged parts of the 1059 versions of a source file, usually storing the unchanged parts of the
1060 file just once. Version control systems also record history information 1060 file just once. Version control systems also record history information
1061 such as the creation time of each version, who created it, and a 1061 such as the creation time of each version, who created it, and a
1062 description of what was changed in that version. 1062 description of what was changed in that version.
1063 1063
1064 The Emacs version control interface is called VC. Its commands work 1064 The Emacs version control interface is called VC. It allows you to
1065 with three version control systems---RCS, CVS and SCCS. The GNU 1065 use various version control systems from within
1066 Emacs---currently, it supports RCS, CVS, and SCCS. The GNU
1066 project recommends RCS and CVS, which are free software and available 1067 project recommends RCS and CVS, which are free software and available
1067 from the Free Software Foundation. We also have free software to 1068 from the Free Software Foundation. We also have free software to
1068 replace SCCS, known as CSSC; if you are using SCCS and don't want to 1069 replace SCCS, known as CSSC; if you are using SCCS and don't want to
1069 make the incompatible change to RCS or CVS, you can switch to CSSC. 1070 make the incompatible change to RCS or CVS, you can switch to CSSC.
1070 1071
1073 * VC Mode Line:: How the mode line shows version control status. 1074 * VC Mode Line:: How the mode line shows version control status.
1074 * Basic VC Editing:: How to edit a file under version control. 1075 * Basic VC Editing:: How to edit a file under version control.
1075 * Old Versions:: Examining and comparing old versions. 1076 * Old Versions:: Examining and comparing old versions.
1076 * Secondary VC Commands:: The commands used a little less frequently. 1077 * Secondary VC Commands:: The commands used a little less frequently.
1077 * Branches:: Multiple lines of development. 1078 * Branches:: Multiple lines of development.
1079 * Remote Repositories:: Efficient access to remote CVS servers.
1078 * Snapshots:: Sets of file versions treated as a unit. 1080 * Snapshots:: Sets of file versions treated as a unit.
1079 * Miscellaneous VC:: Various other commands and features of VC. 1081 * Miscellaneous VC:: Various other commands and features of VC.
1080 * Customizing VC:: Variables that change VC's behavior. 1082 * Customizing VC:: Variables that change VC's behavior.
1081 @end menu 1083 @end menu
1082 1084
1176 permitted; check-in is still the way to record a new version. 1178 permitted; check-in is still the way to record a new version.
1177 1179
1178 CVS normally allows each user to modify his own copy of the work file 1180 CVS normally allows each user to modify his own copy of the work file
1179 at any time, but requires merging with changes from other users at 1181 at any time, but requires merging with changes from other users at
1180 check-in time. However, CVS can also be set up to require locking. 1182 check-in time. However, CVS can also be set up to require locking.
1181 (@pxref{Backend Options}). 1183 (@pxref{CVS Options}).
1182 1184
1183 @node VC Mode Line 1185 @node VC Mode Line
1184 @subsection Version Control and the Mode Line 1186 @subsection Version Control and the Mode Line
1185 1187
1186 When you visit a file that is under version control, Emacs indicates 1188 When you visit a file that is under version control, Emacs indicates
1222 RCS normally use locking; CVS normally does not use locking. 1224 RCS normally use locking; CVS normally does not use locking.
1223 1225
1224 @menu 1226 @menu
1225 * VC with Locking:: RCS in its default mode, SCCS, and optionally CVS. 1227 * VC with Locking:: RCS in its default mode, SCCS, and optionally CVS.
1226 * Without Locking:: Without locking: default mode for CVS. 1228 * Without Locking:: Without locking: default mode for CVS.
1229 * Extended Actions:: Avanced features available with a prefix argument.
1227 * Log Buffer:: Features available in log entry buffers. 1230 * Log Buffer:: Features available in log entry buffers.
1228 @end menu 1231 @end menu
1229 1232
1230 @node VC with Locking 1233 @node VC with Locking
1231 @subsubsection Basic Version Control with Locking 1234 @subsubsection Basic Version Control with Locking
1271 1274
1272 @itemize @bullet 1275 @itemize @bullet
1273 @item 1276 @item
1274 If some other user has checked in changes into the master file, 1277 If some other user has checked in changes into the master file,
1275 Emacs asks you whether you want to merge those changes into your own 1278 Emacs asks you whether you want to merge those changes into your own
1276 work file (@pxref{Merging}). You must do this before you can check in 1279 work file. You must do this before you can check in
1277 your own changes. 1280 your own changes. (To pick up any recent changes from the master file
1281 @emph{without} trying to commit your own changes, type @kbd{C-x v m RET}.)
1282 @xref{Merging}.
1278 1283
1279 @item 1284 @item
1280 If there are no new changes in the master file, but you have made 1285 If there are no new changes in the master file, but you have made
1281 modifications in your work file, @kbd{C-x C-q} checks in your changes. 1286 modifications in your work file, @kbd{C-x C-q} checks in your changes.
1282 In order to do this, it first reads the log entry for the new version. 1287 In order to do this, it first reads the log entry for the new version.
1299 1304
1300 In addition, locking is possible with RCS even in this mode, although 1305 In addition, locking is possible with RCS even in this mode, although
1301 it is not required; @kbd{C-x C-q} with an unmodified file locks the 1306 it is not required; @kbd{C-x C-q} with an unmodified file locks the
1302 file, just as it does with RCS in its normal (locking) mode. 1307 file, just as it does with RCS in its normal (locking) mode.
1303 1308
1309 @node Extended Actions
1310 @subsubsection Calling @code{vc-next-action} with a Prefix Argument
1311
1312 When you give a prefix argument to @code{vc-next-action} (@kbd{C-u C-x
1313 C-q}), it still performs the next logical version control operation, but
1314 in an extended sense.
1315
1316 @itemize @bullet
1317 @item If the file is modified (or locked), you can specify the version
1318 number that should be used for check-in. This is also one way to create
1319 a new branch (@pxref{Branches}).
1320
1321 @item If the file is not modified (and unlocked), you can specify a new
1322 version to go to; this lets you start working from an older version, or
1323 on another branch. If you do not enter any version, that takes you to
1324 the highest version on the current branch; therefore @kbd{C-u C-x C-q
1325 RET} is a convenient way to get the latest version of a file from the
1326 repository.
1327
1328 @item Regardless of the state of the file, you can also enter the name
1329 of another version control system instead of a version number. This
1330 lets you use more than one version control system for a file
1331 (@pxref{Local Version Control}).
1332 @end itemize
1333
1304 @node Log Buffer 1334 @node Log Buffer
1305 @subsubsection Features of the Log Entry Buffer 1335 @subsubsection Features of the Log Entry Buffer
1306 1336
1307 When you check in changes, @kbd{C-x C-q} first reads a log entry. It 1337 When you check in changes, @kbd{C-x C-q} first reads a log entry. It
1308 pops up a buffer called @samp{*VC-Log*} for you to enter the log entry. 1338 pops up a buffer called @samp{*VC-Log*} for you to enter the log entry.
1374 You can specify a checked-in version by its number; an empty input 1404 You can specify a checked-in version by its number; an empty input
1375 specifies the current contents of the work file (which may be different 1405 specifies the current contents of the work file (which may be different
1376 from all the checked-in versions). You can also specify a snapshot name 1406 from all the checked-in versions). You can also specify a snapshot name
1377 (@pxref{Snapshots}) instead of one or both version numbers. 1407 (@pxref{Snapshots}) instead of one or both version numbers.
1378 1408
1379 This command works by running the @code{diff} utility, getting the 1409 @vindex diff-switches
1380 options from the variable @code{diff-switches}. It displays the output 1410 @vindex vc-diff-switches
1381 in a special buffer in another window. Unlike the @kbd{M-x diff} 1411 This command works by running a variant of the @code{diff} utility
1382 command, @kbd{C-x v =} does not try to locate the changes in the old and 1412 that is specific to the version control system in use. Emacs passes the
1383 new versions. This is because normally one or both versions do not 1413 contents of the variable @code{diff-switches} to that utility; you can
1384 exist as files when you compare them; they exist only in the records of 1414 define specific options for version control in @code{vc-diff-switches},
1385 the master file. @xref{Comparing Files}, for more information about 1415 and there are similar variables for each specific system,
1386 @kbd{M-x diff}. 1416 e.g. @code{vc-rcs-diff-switches}, and the like.
1417
1418 The output of the @code{diff} command is displayed in a special buffer
1419 in another window. Unlike the @kbd{M-x diff} command, @kbd{C-x v =}
1420 does not try to locate the changes in the old and new versions. This is
1421 because normally one or both versions do not exist as files when you
1422 compare them; they exist only in the records of the master file.
1423 @xref{Comparing Files}, for more information about @kbd{M-x diff}.
1387 1424
1388 @findex vc-annotate 1425 @findex vc-annotate
1389 @kindex C-x v g 1426 @kindex C-x v g
1390 For CVS-controlled files, you can display the result of the CVS 1427 For CVS-controlled files, you can display the result of the CVS
1391 annotate command, using colors to enhance the visual appearance. Use 1428 annotate command, using colors to enhance the visual appearance. Use
1419 @table @kbd 1456 @table @kbd
1420 @item C-x v i 1457 @item C-x v i
1421 Register the visited file for version control. 1458 Register the visited file for version control.
1422 @end table 1459 @end table
1423 1460
1424 @vindex vc-default-back-end
1425 To register the file, Emacs must choose which version control system 1461 To register the file, Emacs must choose which version control system
1426 to use for it. You can specify your choice explicitly by setting 1462 to use for it. If the file's directory already contains files
1427 @code{vc-default-back-end} to @code{RCS}, @code{CVS} or @code{SCCS}. 1463 registered in a version control system, Emacs uses that system. If
1428 Otherwise, if there is a subdirectory named @file{RCS}, @file{SCCS}, or 1464 there is more than one system in use for a directory, Emacs uses the one
1429 @file{CVS}, Emacs uses the corresponding version control system. In the 1465 that appears first in @var{vc-handled-backends} (@pxref{Customizing VC}).
1430 absence of any specification, the default choice is RCS if RCS is 1466 On the other hand, if there are no files already registered,
1431 installed, otherwise SCCS. 1467 Emacs uses the first system from @var{vc-handled-backends} that could
1468 register the file---for example, you cannot register a file under CVS if
1469 its directory is not already part of a CVS tree.
1470
1471 With the default value of @var{vc-handled-backends}, this means that
1472 Emacs uses RCS if there are any files under RCS control, and CVS if
1473 there are any files under CVS. If there are no files under version
1474 control, RCS is used.
1432 1475
1433 If locking is in use, @kbd{C-x v i} leaves the file unlocked and 1476 If locking is in use, @kbd{C-x v i} leaves the file unlocked and
1434 read-only. Type @kbd{C-x C-q} if you wish to start editing it. After 1477 read-only. Type @kbd{C-x C-q} if you wish to start editing it. After
1435 registering a file with CVS, you must subsequently commit the initial 1478 registering a file with CVS, you must subsequently commit the initial
1436 version by typing @kbd{C-x C-q}. 1479 version by typing @kbd{C-x C-q}.
1677 it. Switching branches in this way is allowed only when the file is not 1720 it. Switching branches in this way is allowed only when the file is not
1678 locked. 1721 locked.
1679 1722
1680 You can omit the minor version number, thus giving only the branch 1723 You can omit the minor version number, thus giving only the branch
1681 number; this takes you to the head version on the chosen branch. If you 1724 number; this takes you to the head version on the chosen branch. If you
1682 only type @key{RET}, Emacs goes to the highest version on the trunk. 1725 only type @kbd{RET}, Emacs goes to the highest version on the trunk.
1683 1726
1684 After you have switched to any branch (including the main branch), you 1727 After you have switched to any branch (including the main branch), you
1685 stay on it for subsequent VC commands, until you explicitly select some 1728 stay on it for subsequent VC commands, until you explicitly select some
1686 other branch. 1729 other branch.
1687 1730
1734 @end table 1777 @end table
1735 1778
1736 @kindex C-x v m 1779 @kindex C-x v m
1737 @findex vc-merge 1780 @findex vc-merge
1738 @kbd{C-x v m} (@code{vc-merge}) takes a set of changes and merges it 1781 @kbd{C-x v m} (@code{vc-merge}) takes a set of changes and merges it
1739 into the current version of the work file. It first asks you for a 1782 into the current version of the work file. It firsts asks you in the
1740 branch number or a pair of version numbers in the minibuffer. Then it 1783 minibuffer where the changes should come from. If you just type
1741 finds the changes from that branch, or between the two versions you 1784 @kbd{RET}, Emacs merges any changes that were made on the same branch
1742 specified, and merges them into the current version of the current file. 1785 since you checked the file out (we call this @dfn{merging the news}).
1786 This is the common way to pick up recent changes from the repository,
1787 regardless of whether you have already changed the file yourself.
1788
1789 You can also enter a branch number or a pair of version numbers in
1790 the minibuffer. Then it finds the changes from that branch, or between
1791 the two versions you specified, and merges them into the current version
1792 of the current file.
1743 1793
1744 As an example, suppose that you have finished a certain feature on 1794 As an example, suppose that you have finished a certain feature on
1745 branch 1.3.1. In the meantime, development on the trunk has proceeded 1795 branch 1.3.1. In the meantime, development on the trunk has proceeded
1746 to version 1.5. To merge the changes from the branch to the trunk, 1796 to version 1.5. To merge the changes from the branch to the trunk,
1747 first go to the head version of the trunk, by typing @kbd{C-u C-x C-q 1797 first go to the head version of the trunk, by typing @kbd{C-u C-x C-q
1811 explicitly in each session which branch you are working on. To do this, 1861 explicitly in each session which branch you are working on. To do this,
1812 first find the file, then type @kbd{C-u C-x C-q} and specify the correct 1862 first find the file, then type @kbd{C-u C-x C-q} and specify the correct
1813 branch number. This ensures that Emacs knows which branch it is using 1863 branch number. This ensures that Emacs knows which branch it is using
1814 during this particular editing session. 1864 during this particular editing session.
1815 1865
1866 @node Remote Repositories
1867 @subsection Remote Repositories
1868 @cindex remote repositories (CVS)
1869
1870 Many projects set up a central CVS repository somewhere in the Internet,
1871 and let each user check out a personal working copy of the files to
1872 his local machine. Committing changes to the repository, and picking
1873 up changes from other users into one's own working area, then works by
1874 direct interactions with the CVS server.
1875
1876 The problem is that access to the CVS server is often slow, and that
1877 developers might need to work offline as well. VC therefore offers
1878 some features that allow you to keep network interactions to a
1879 minimum.
1880
1881 @menu
1882 * Version Backups:: Keeping local copies of repository versions.
1883 * Local Version Control:: Using another version system for local editing.
1884 @end menu
1885
1886 @node Version Backups
1887 @subsubsection Version Backups
1888 @cindex version backups
1889
1890 When VC sees that the CVS repository for a file is on a remote machine,
1891 it automatically makes local backups of unmodified versions of the file.
1892 This means that you can compare the file to the repository version
1893 (@kbd{C-x v =}), or revert to that version (@kbd{C-x v u}), without any
1894 network interactions.
1895
1896 The local copy of the unmodified file is called a @dfn{version backup}.
1897 This is to indicate that it corresponds exactly to a version that is
1898 stored in the repository. Note that version backups are related to,
1899 but distinct from the other kinds of backups that Emacs can make:
1900 single backups and numbered backups (@pxref{Backup}).
1901
1902 @vindex vc-cvs-stay-local
1903 For a file that comes from a remote CVS repository, VC makes a version
1904 backup whenever you save the first changes to the file, and removes it
1905 after you have committed your modified version to the repository. (You
1906 can switch this off by setting the variable @code{vc-cvs-stay-local} to
1907 @code{nil}.)
1908
1909 @cindex automatic version backups
1910 @cindex manual version backups
1911 The name of a version backup for a file named @var{file}, with version
1912 @var{version}, is @code{@var{file}.~@var{version}.~}. Note that this
1913 naming convention is almost the same as that used by @kbd{C-x v ~}
1914 (@pxref{Old Versions}), the only difference being the additional dot
1915 (@samp{.}) after the version number. This similarity is intentional,
1916 because both kinds of files store the same kind of information. To
1917 distinguish between them, we speak of @dfn{automatic version backups}
1918 (those created by the mechanism described here) and @dfn{manual version
1919 backups} (created by @kbd{C-x v ~}). Their primary difference is that
1920 Emacs deletes automatic version backups when you commit to the
1921 repository (this is why the trailing dot is needed to identify them),
1922 while manual version backups are never deleted automatically.
1923
1924 Each of the two mechanisms can use the files created by the other one.
1925 For example, if you changed a file outside of Emacs, so that no
1926 automatic version backup was created, you can create a manual backup of
1927 that version using @kbd{C-x v ~}. Emacs will then use that file for
1928 local diff and revert operations.
1929
1930 @node Local Version Control
1931 @subsubsection Local Version Control
1932 @cindex local version control
1933 @cindex local back end (version control)
1934
1935 When you make many changes to a file that comes from a remote
1936 repository, it can be convenient to have version control on your local
1937 machine as well. You can then record intermediate versions, revert to
1938 a previous state, etc., before you actually commit your changes to the
1939 remote server.
1940
1941 VC lets you do this by putting a file under a second, local version
1942 control system, so that the file is effectively registered in two
1943 systems at the same time. For the description here, we will assume
1944 that the remote system is CVS, and you use RCS locally, although the
1945 mechanism works with any combination of version control systems
1946 (@dfn{back ends}).
1947
1948 To make it work with other back ends, you must make sure that the "more
1949 local" back end comes before the "more remote" back end in the setting
1950 of @var{vc-handled-backends} (@pxref{Customizing VC}). By default, this
1951 variable is set up correctly so that you can use RCS and CVS as
1952 described here.
1953
1954 To start using local RCS for a file that comes from a remote CVS server,
1955 you must @dfn{commit the file to RCS}, by typing @kbd{C-u C-x v v rcs
1956 RET}. (In other words, @code{vc-next-action}, when called with a prefix
1957 argument, accepts a back end name in place of the version to commit to.)
1958 VC then registers the file under RCS.
1959
1960 You can commit to RCS at any time; it does not matter whether you have
1961 already modified the file with respect to the version in the CVS
1962 repository. If possible, VC tries to make the RCS master start with
1963 the unmodified repository version, then checking in any local changes
1964 as a new version. This works if you have not made any changes yet,
1965 or if the unmodified repository version exists locally as a version
1966 backup (@pxref{Version Backups}). If the unmodified version is not
1967 available locally, the RCS master starts with the modified version;
1968 the only problem with this is that you cannot compare your changes
1969 locally to what is stored in the repository.
1970
1971 The version number of the RCS master is derived from the current CVS
1972 version, starting a branch from it. For example, if the current CVS
1973 version is 1.23, the local RCS branch will be 1.23.1. Version 1.23 in
1974 the RCS master will be identical to version 1.23 under CVS; your first
1975 changes are checked in as 1.23.1.1. (If the unmodified file is not
1976 available locally, VC will check-in the modified file twice, both as
1977 1.23 and 1.23.1.1, to make the revision numbers consistent.)
1978
1979 If you do not use locking under CVS (the default), locking is also
1980 switched off under RCS, so that editing under RCS works exactly as
1981 under CVS.
1982
1983 When you are done with your edits, you can commit the final version back
1984 to the CVS repository, typing @kbd{C-u C-x v v cvs RET}. Emacs will
1985 initialize the log entry buffer (@pxref{Log Buffer}) to contain all the
1986 check-in comments you have made in the RCS master; you can make changes
1987 to these comments as needed and then commit to CVS by typing @kbd{C-c
1988 C-c}. If the commit is successful, VC finally removes the RCS master,
1989 so that the file becomes once again registered under CVS only. (The RCS
1990 master is not actually deleted, but renamed by adding a @samp{~} to its
1991 name, so that you can get back to it later if you want.)
1992
1993 While you are working with a local RCS master, you might still want to
1994 pick up recent changes from the CVS repository into your local file,
1995 or you might want to commit some of your changes back to CVS, without
1996 actually switching back to CVS completely. VC lets you do this by
1997 switching to another backend temporarily.
1998
1999 @table @kbd
2000 @item C-x v b
2001 Switch to any other back end that the current file is registered
2002 under (@code{vc-switch-backend}).
2003 @end table
2004
2005 @kindex{C-x v b}
2006 @findex vc-switch-backend
2007 If the current file is registered in more than one back end, typing
2008 @kbd{C-x v b} lets you ``cycle'' through these back ends. (With a prefix
2009 argument, it asks for the back end to use in the minibuffer.) This
2010 command does not change any files, it only changes VC's perspective of
2011 the file. Any other VC commands that you use on a file will operate on
2012 the back end that is currently selected.
2013
2014 Thus, if you have a file under local RCS, and you want to pick up some
2015 recent changes from CVS, type @kbd{C-x v b} to switch to CVS, and then
2016 @kbd{C-x v m RET} to merge the news (@pxref{Merging}). You can then switch
2017 back to RCS by typing @kbd{C-x v b} again, and continue to edit locally.
2018
2019 Note though, that if you do this, the revision numbers in the RCS
2020 master no longer correspond to those of CVS in a meaningful way.
2021 Technically, this is not a problem, but it might be more difficult for
2022 you to keep track of what is in the repository and what is not. So we
2023 suggest that, frequently, you commit your changes back to CVS
2024 completely using @kbd{C-u C-x v v cvs RET}.
2025
1816 @node Snapshots 2026 @node Snapshots
1817 @subsection Snapshots 2027 @subsection Snapshots
1818 @cindex snapshots and version control 2028 @cindex snapshots and version control
1819 2029
1820 A @dfn{snapshot} is a named set of file versions (one for each 2030 A @dfn{snapshot} is a named set of file versions (one for each
2165 headers. 2375 headers.
2166 2376
2167 @node Customizing VC 2377 @node Customizing VC
2168 @subsection Customizing VC 2378 @subsection Customizing VC
2169 2379
2170 There are many ways of customizing VC. The options you can set fall 2380 @vindex vc-handled-backends
2171 into four categories, described in the following sections. 2381 The variable @var{vc-handled-backends} determines which version
2382 control systems VC should handle. The default value is @code{(RCS CVS
2383 SCCS)}, so it contains all three version systems that are currently
2384 supported. If you want VC to ignore one or more of these systems,
2385 exclude its name from the list.
2386
2387 The order of systems in the list is significant: when you visit a file
2388 is registered in more than one system (@pxref{Local Version Control}),
2389 VC uses the system that comes first in @var{vc-handled-backends} by
2390 default. The order is also significant when you register a file for
2391 the first time, @pxref{Registering} for details.
2172 2392
2173 @menu 2393 @menu
2174 * Backend Options:: Customizing the back-end to your needs. 2394 * General VC Options:: Options not specific for any back end system.
2175 * VC Workfile Handling:: Various options concerning working files. 2395 * RCS Options:: Options for RCS.
2176 * VC Status Retrieval:: How VC finds the version control status of a file, 2396 * CVS Options:: Options for CVS.
2177 and how to customize this. 2397 * SCCS Options:: Options for SCCS.
2178 * VC Command Execution:: Which commands VC should run, and how.
2179 @end menu 2398 @end menu
2180 2399
2181 @node Backend Options 2400 @node General VC Options
2182 @subsubsection Options for VC Backends 2401 @subsubsection General Options
2183 2402
2184 @vindex vc-handled-backends 2403 @vindex vc-make-backup-files
2185 By default, VC detects automatically which files are managed by RCS, 2404 Emacs normally does not save backup files for source files that are
2186 which by CVS, and which by SCCS, and it tries to do the right thing in 2405 maintained with version control. If you want to make backup files even
2187 all three cases. If you want VC to ignore one or more of these 2406 for files that use version control, set the variable
2188 backends, set @code{vc-handled-backends} to the list of backends that 2407 @code{vc-make-backup-files} to a non-@code{nil} value.
2189 @emph{should} be handled. 2408
2190 2409 @vindex vc-keep-workfiles
2191 @cindex backend options (VC) 2410 Normally the work file exists all the time, whether it is locked or
2192 @cindex locking under version control 2411 not. If you set @code{vc-keep-workfiles} to @code{nil}, then checking
2193 You can tell RCS and CVS whether to use locking for a file or not 2412 in a new version with @kbd{C-x C-q} deletes the work file; but any
2194 (@pxref{VC Concepts}, for a description of locking). VC automatically 2413 attempt to visit the file with Emacs creates it again. (With CVS, work
2195 recognizes what you have chosen, and behaves accordingly. 2414 files are always kept.)
2415
2416 @vindex vc-follow-symlinks
2417 Editing a version-controlled file through a symbolic link can be
2418 dangerous. It bypasses the version control system---you can edit the
2419 file without locking it, and fail to check your changes in. Also,
2420 your changes might overwrite those of another user. To protect against
2421 this, VC checks each symbolic link that you visit, to see if it points
2422 to a file under version control.
2423
2424 The variable @code{vc-follow-symlinks} controls what to do when a
2425 symbolic link points to a version-controlled file. If it is @code{nil},
2426 VC only displays a warning message. If it is @code{t}, VC automatically
2427 follows the link, and visits the real file instead, telling you about
2428 this in the echo area. If the value is @code{ask} (the default), VC
2429 asks you each time whether to follow the link.
2430
2431 @vindex vc-suppress-confirm
2432 If @code{vc-suppress-confirm} is non-@code{nil}, then @kbd{C-x C-q}
2433 and @kbd{C-x v i} can save the current buffer without asking, and
2434 @kbd{C-x v u} also operates without asking for confirmation. (This
2435 variable does not affect @kbd{C-x v c}; that operation is so drastic
2436 that it should always ask for confirmation.)
2437
2438 @vindex vc-command-messages
2439 VC mode does much of its work by running the shell commands for RCS,
2440 CVS and SCCS. If @code{vc-command-messages} is non-@code{nil}, VC
2441 displays messages to indicate which shell commands it runs, and
2442 additional messages when the commands finish.
2443
2444 @vindex vc-path
2445 You can specify additional directories to search for version control
2446 programs by setting the variable @code{vc-path}. These directories are
2447 searched before the usual search path. But the proper files are usually
2448 found automatically.
2449
2450 @node RCS Options
2451 @subsubsection Options specific for RCS
2196 2452
2197 @cindex non-strict locking (RCS) 2453 @cindex non-strict locking (RCS)
2198 @cindex locking, non-strict (RCS) 2454 @cindex locking, non-strict (RCS)
2199 For RCS, the default is to use locking, but there is a mode called 2455 By default, RCS uses locking to coordinate the activities of several
2200 @dfn{non-strict locking} in which you can check-in changes without 2456 users, but there is a mode called @dfn{non-strict locking} in which
2201 locking the file first. Use @samp{rcs -U} to switch to non-strict 2457 you can check-in changes without locking the file first. Use
2202 locking for a particular file, see the @samp{rcs} manpage for details. 2458 @samp{rcs -U} to switch to non-strict locking for a particular file,
2459 see the @samp{rcs(1)} manpage for details.
2460
2461 When deducing the version control state of a file, VC first looks
2462 for an RCS version header string in the file (@pxref{Version
2463 Headers}). If there is no header string, VC normally looks at the
2464 file permissions of the work file; this is fast. But there might be
2465 situations when the file permissions cannot be trusted. In this case
2466 the master file has to be consulted, which is rather expensive. Also
2467 the master file can only tell you @emph{if} there's any lock on the
2468 file, but not whether your work file really contains that locked
2469 version.
2470
2471 @vindex vc-consult-headers
2472 You can tell VC not to use version headers to determine the file
2473 status by setting @code{vc-consult-headers} to @code{nil}. VC then
2474 always uses the file permissions (if it can trust them), or else
2475 checks the master file.
2476
2477 @vindex vc-mistrust-permissions
2478 You can specify the criterion for whether to trust the file
2479 permissions by setting the variable @code{vc-mistrust-permissions}.
2480 Its value can be @code{t} (always mistrust the file permissions and
2481 check the master file), @code{nil} (always trust the file
2482 permissions), or a function of one argument which makes the decision.
2483 The argument is the directory name of the @file{RCS} subdirectory. A
2484 non-@code{nil} value from the function says to mistrust the file
2485 permissions. If you find that the file permissions of work files are
2486 changed erroneously, set @code{vc-mistrust-permissions} to @code{t}.
2487 Then VC always checks the master file to determine the file's status.
2488
2489 @node CVS Options
2490 @subsubsection Options specific for CVS
2203 2491
2204 @cindex locking (CVS) 2492 @cindex locking (CVS)
2205 Under CVS, the default is not to use locking; anyone can change a work 2493 By default, CVS does not use locking to coordinate the activities of
2206 file at any time. However, there are ways to restrict this, resulting 2494 several users; anyone can change a work file at any time. However,
2207 in behavior that resembles locking. 2495 there are ways to restrict this, resulting in behavior that resembles
2496 locking.
2208 2497
2209 @cindex CVSREAD environment variable (CVS) 2498 @cindex CVSREAD environment variable (CVS)
2210 For one thing, you can set the @env{CVSREAD} environment variable to 2499 For one thing, you can set the @env{CVSREAD} environment variable to
2211 an arbitrary value. If this variable is defined, CVS makes your work 2500 an arbitrary value. If this variable is defined, CVS makes your work
2212 files read-only by default. In Emacs, you must type @kbd{C-x C-q} to 2501 files read-only by default. In Emacs, you must type @kbd{C-x C-q} to
2224 make it writable. VC calls @code{cvs edit} to make the file writeable, 2513 make it writable. VC calls @code{cvs edit} to make the file writeable,
2225 and CVS takes care to notify other developers of the fact that you 2514 and CVS takes care to notify other developers of the fact that you
2226 intend to change the file. See the CVS documentation for details on 2515 intend to change the file. See the CVS documentation for details on
2227 using the watch feature. 2516 using the watch feature.
2228 2517
2229 @node VC Workfile Handling 2518 @vindex vc-cvs-stay-local
2230 @subsubsection VC Workfile Handling 2519 @cindex remote repositories (CVS)
2231 2520 When a file's repository is on a remote machine, VC tries to keep
2232 @vindex vc-make-backup-files 2521 network interactions to a minimum. This is controlled by the variable
2233 Emacs normally does not save backup files for source files that are 2522 @var{vc-cvs-stay-local}. If it is @code{t}, then VC uses only the
2234 maintained with version control. If you want to make backup files even 2523 entry in the local CVS subdirectory to determine the file's state (and
2235 for files that use version control, set the variable 2524 possibly information returned by previous CVS commands). One
2236 @code{vc-make-backup-files} to a non-@code{nil} value. 2525 consequence of this is that when you have modified a file, and
2237 2526 somebody else has already checked in other changes to the file, you
2238 @vindex vc-keep-workfiles 2527 are not notified of it until you actually try to commit. (But you can
2239 Normally the work file exists all the time, whether it is locked or 2528 try to pick up any recent changes from the repository first, using
2240 not. If you set @code{vc-keep-workfiles} to @code{nil}, then checking 2529 @kbd{C-x v m RET}, @pxref{Merging}).
2241 in a new version with @kbd{C-x C-q} deletes the work file; but any 2530
2242 attempt to visit the file with Emacs creates it again. (With CVS, work 2531 When @var{vc-cvs-stay-local} is @code{t}, VC also makes local
2243 files are always kept.) 2532 version backups, so that simple diff and revert operations are
2244 2533 completely local (@pxref{Version Backups}).
2245 @vindex vc-follow-symlinks 2534
2246 Editing a version-controlled file through a symbolic link can be 2535 On the other hand, if you set @var{vc-cvs-stay-local} to @code{nil},
2247 dangerous. It bypasses the version control system---you can edit the 2536 then VC queries the remote repository @emph{before} it decides what to
2248 file without locking it, and fail to check your changes in. Also, 2537 do in @code{vc-next-action} (@kbd{C-x v v}), just as it does for local
2249 your changes might overwrite those of another user. To protect against 2538 repositories. It also does not make any version backups.
2250 this, VC checks each symbolic link that you visit, to see if it points 2539
2251 to a file under version control. 2540 You can also set @var{vc-cvs-stay-local} to a regexp that is matched
2252 2541 against the repository hostname; VC then stays local only for
2253 The variable @code{vc-follow-symlinks} controls what to do when a 2542 repositories from hosts that match the pattern.
2254 symbolic link points to a version-controlled file. If it is @code{nil}, 2543
2255 VC only displays a warning message. If it is @code{t}, VC automatically 2544 @node SCCS Options
2256 follows the link, and visits the real file instead, telling you about 2545 @subsubsection Options specific for SCCS
2257 this in the echo area. If the value is @code{ask} (the default), VC 2546
2258 asks you each time whether to follow the link. 2547 VC determines the version control state of files under SCCS similar as
2259 2548 under RCS. It does not consider SCCS version headers, though. Thus,
2260 @node VC Status Retrieval 2549 the variable @var{vc-mistrust-permissions} is used in the same way as
2261 @subsubsection VC Status Retrieval 2550 under RCS, @pxref{RCS Options} for details.
2262 @c There is no need to tell users about vc-master-templates. 2551
2263
2264 When deducing the locked/unlocked state of a file, VC first looks for
2265 an RCS version header string in the file (@pxref{Version Headers}). If
2266 there is no header string, or if you are using SCCS, VC normally looks
2267 at the file permissions of the work file; this is fast. But there might
2268 be situations when the file permissions cannot be trusted. In this case
2269 the master file has to be consulted, which is rather expensive. Also
2270 the master file can only tell you @emph{if} there's any lock on the
2271 file, but not whether your work file really contains that locked
2272 version.
2273
2274 @vindex vc-consult-headers
2275 You can tell VC not to use version headers to determine lock status by
2276 setting @code{vc-consult-headers} to @code{nil}. VC then always uses
2277 the file permissions (if it can trust them), or else checks the master
2278 file.
2279
2280 @vindex vc-mistrust-permissions
2281 You can specify the criterion for whether to trust the file
2282 permissions by setting the variable @code{vc-mistrust-permissions}. Its
2283 value can be @code{t} (always mistrust the file permissions and check
2284 the master file), @code{nil} (always trust the file permissions), or a
2285 function of one argument which makes the decision. The argument is the
2286 directory name of the @file{RCS}, @file{CVS} or @file{SCCS}
2287 subdirectory. A non-@code{nil} value from the function says to mistrust
2288 the file permissions. If you find that the file permissions of work
2289 files are changed erroneously, set @code{vc-mistrust-permissions} to
2290 @code{t}. Then VC always checks the master file to determine the file's
2291 status.
2292
2293 @node VC Command Execution
2294 @subsubsection VC Command Execution
2295
2296 @vindex vc-suppress-confirm
2297 If @code{vc-suppress-confirm} is non-@code{nil}, then @kbd{C-x C-q}
2298 and @kbd{C-x v i} can save the current buffer without asking, and
2299 @kbd{C-x v u} also operates without asking for confirmation. (This
2300 variable does not affect @kbd{C-x v c}; that operation is so drastic
2301 that it should always ask for confirmation.)
2302
2303 @vindex vc-command-messages
2304 VC mode does much of its work by running the shell commands for RCS,
2305 CVS and SCCS. If @code{vc-command-messages} is non-@code{nil}, VC
2306 displays messages to indicate which shell commands it runs, and
2307 additional messages when the commands finish.
2308
2309 @vindex vc-path
2310 You can specify additional directories to search for version control
2311 programs by setting the variable @code{vc-path}. These directories are
2312 searched before the usual search path. But the proper files are usually
2313 found automatically.
2314 2552
2315 @node Directories 2553 @node Directories
2316 @section File Directories 2554 @section File Directories
2317 2555
2318 @cindex file directory 2556 @cindex file directory