aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChong Yidong2008-10-15 23:40:16 +0000
committerChong Yidong2008-10-15 23:40:16 +0000
commite3e89c088e3a41e3bb10f817ae3e53e49c50a6c6 (patch)
tree15d395ec3ba79ab4d56fb741a74ad1c1a0efd3f5
parentc3aaf1d70f7d4baafb8c4f6d67d1de3283625c9a (diff)
downloademacs-e3e89c088e3a41e3bb10f817ae3e53e49c50a6c6.tar.gz
emacs-e3e89c088e3a41e3bb10f817ae3e53e49c50a6c6.zip
(File Names): Reorganize description.
(Visiting): Add xref to Mode Line. Copyedits. (Save Commands): Mention prefix behavior of C-x C-s. (Numbered Backups): Node deleted. (Backup Names): Contents of Numbered Backups moved here. State default of version-control variable. (Reverting): Copyedits. (Version Control): Add additional version control systems.
-rw-r--r--doc/emacs/files.texi277
1 files changed, 143 insertions, 134 deletions
diff --git a/doc/emacs/files.texi b/doc/emacs/files.texi
index b21947619cf..02a6c04411b 100644
--- a/doc/emacs/files.texi
+++ b/doc/emacs/files.texi
@@ -1163,18 +1163,19 @@ implies the effect of @code{find-file-existing-other-name}.
1163@section Version Control 1163@section Version Control
1164@cindex version control 1164@cindex version control
1165 1165
1166 @dfn{Version control systems} are packages that can record multiple 1166 A @dfn{version control system} is a package that can record multiple
1167versions of a source file, usually storing the unchanged parts of the 1167versions of a source file, storing information such as the creation
1168file just once. Version control systems also record history information 1168time of each version, who created it, and a description of what was
1169such as the creation time of each version, who created it, and a 1169changed in that version.
1170description of what was changed in that version.
1171 1170
1172 The Emacs version control interface is called VC. Its commands work 1171 The Emacs version control interface is called VC. Its commands work
1173with different version control systems---currently, it supports CVS, 1172with different version control systems; currently, it supports GNU
1174GNU Arch, RCS, Subversion, SCCS, Mercurial, Monotone, Bazaar, and Git. 1173Arch, Bazaar, CVS, Git, Mercurial, Monotone, RCS, SCCS, and
1175Of these, the GNU project distributes CVS, GNU Arch, RCS, and Bazaar. 1174Subversion. Of these, the GNU project distributes CVS, GNU Arch, RCS,
1175and Bazaar.
1176 1176
1177 VC is enabled by default in Emacs. To disable it, set the 1177 VC is enabled automatically whenever you visit a file that is
1178governed by a version control system. To disable VC entirely, set the
1178customizable variable @code{vc-handled-backends} to @code{nil} 1179customizable variable @code{vc-handled-backends} to @code{nil}
1179@iftex 1180@iftex
1180(@pxref{Customizing VC,,,emacs-xtra, Specialized Emacs Features}). 1181(@pxref{Customizing VC,,,emacs-xtra, Specialized Emacs Features}).
@@ -1232,125 +1233,137 @@ you want to use.
1232reversibility, the ability to back up to a saved, known-good state when 1233reversibility, the ability to back up to a saved, known-good state when
1233you discover that some modification you did was a mistake or a bad idea. 1234you discover that some modification you did was a mistake or a bad idea.
1234 1235
1235 Version-control systems also support concurrency, the ability to 1236 Version control systems also support concurrency: the ability to
1236have many people modifying the same collection of code or documents 1237have many people modifying the same collection of code or documents
1237knowing that conflicting modifications can be detected and resolved. 1238knowing that conflicting modifications can be detected and resolved.
1238 1239
1239 Version-control systems give you the capability to attach a history 1240 Version control systems give you the capability to attach a history
1240to your data, explanatory comments about the intention behind each 1241to your data, such as explanatory comments about the intention behind
1241change to it. Even for a programmer working solo change histories 1242each change to it. Even for a programmer working solo, change
1242are an important aid to memory; for a multi-person project they 1243histories are an important aid to memory; for a multi-person project,
1243become a vitally important form of communication among developers. 1244they are a vitally important form of communication among developers.
1244 1245
1245@node Version Control Systems 1246@node Version Control Systems
1246@subsubsection Supported Version Control Systems 1247@subsubsection Supported Version Control Systems
1247 1248
1248@cindex back end (version control) 1249@cindex back end (version control)
1249 VC currently works with many different version control systems or 1250 VC currently works with many different version control systems or
1250``back ends'': SCCS, RCS, CVS, Subversion, GNU Arch, 1251``back ends'':
1251git, and Mercurial.
1252@comment Omitting bzr because support is very scratchy and incomplete. 1252@comment Omitting bzr because support is very scratchy and incomplete.
1253 1253
1254
1255@itemize @bullet
1256
1254@cindex SCCS 1257@cindex SCCS
1255 SCCS was the first version-control system ever built, and was long ago 1258@item
1259SCCS was the first version control system ever built, and was long ago
1256superseded by later and more advanced ones; Emacs supports it only for 1260superseded by later and more advanced ones; Emacs supports it only for
1257backward compatibility and historical reasons. VC compensates for 1261backward compatibility and historical reasons. VC compensates for
1258certain features missing in SCCS (tag names for releases, for example) by 1262certain features missing in SCCS (e.g., tag names for releases) by
1259implementing them itself. Some other VC features, such as multiple 1263implementing them itself. Other VC features, such as multiple
1260branches, are not available with SCCS. Since SCCS is non-free you 1264branches, are simply unavailable. Since SCCS is non-free, we
1261should not use it; use its free replacement CSSC instead. But you 1265recommend avoiding it.
1262should use CSSC only if for some reason you cannot use a more 1266
1263recent and better-designed version-control system. 1267@cindex CSSC
1268@item
1269CSSC is a free replacement for SCCS. You should use CSSC only if, for
1270some reason, you cannot use a more recent and better-designed
1271version-control system.
1264 1272
1265@cindex RCS 1273@cindex RCS
1266 RCS is the free version control system around which VC was initially 1274@item
1267built. Almost everything you can do with RCS can be done through VC. You 1275RCS is the free version control system around which VC was initially
1268cannot use RCS over the network, though, and it only works at the level 1276built. Almost everything you can do with RCS can be done through VC.
1269of individual files, rather than projects. You should use it if you 1277However, you cannot use RCS over the network, and it only works at the
1270want a simple, yet reliable tool for handling individual files. 1278level of individual files rather than projects.
1271 1279
1272@cindex CVS 1280@cindex CVS
1273 CVS is the free version control system that was until recently (as of 1281@item
12742007) used for the majority of free software projects, though it is now 1282CVS is the free version control system that was, until recently (circa
1275being superseded by other systems. It allows concurrent 12832008), used for the majority of free software projects. Nowadays, it
1276multi-user development either locally or over the network. Some of its 1284is slowly being superseded by other systems. CVS allows concurrent
1277shortcomings, corrected by newer systems such as Subversion or GNU Arch, 1285multi-user development either locally or over the network. It lacks
1278are that it lacks atomic commits or support for renaming files. VC 1286support for atomic commits or file moving/renaming. VC supports all
1279supports all basic editing operations under CVS, but for some less 1287basic editing operations under CVS. For some less common tasks, you
1280common tasks you still need to call CVS from the command line. Note 1288still need to call CVS from the command line. Note also that before
1281also that before using CVS you must set up a repository, which is a 1289using CVS you must set up a repository, which is a subject too complex
1282subject too complex to treat here. 1290to treat here.
1283 1291
1284@cindex SVN 1292@cindex SVN
1285@cindex Subversion 1293@cindex Subversion
1286 Subversion is a free version control system designed to be similar 1294@item
1287to CVS but without CVS's problems, and is now (2007) rapidly 1295Subversion (SVN) is a free version control system designed to be
1288superseding CVS. Subversion supports atomic commits of filesets, and 1296similar to CVS but without its problems. It supports atomic commits
1289versions directories, symbolic links, meta-data, renames, copies, and 1297of filesets, and versioning of directories, symbolic links, meta-data,
1290deletes. It can be used via http or via its own protocol. 1298renames, copies, and deletes.
1291 1299
1292@cindex GNU Arch 1300@cindex GNU Arch
1293@cindex Arch 1301@cindex Arch
1294 GNU Arch is a new version control system that is designed for 1302@item
1295distributed work. It differs in many ways from old well-known 1303GNU Arch is a version control system designed for distributed work.
1296systems, such as CVS and RCS. It supports different transports for 1304It differs in many ways from older systems like CVS and RCS. It
1297interoperating between users, offline operations, and it has good 1305provides different methods for interoperating between users, support
1298branching and merging features. It also supports atomic commits of 1306for offline operations, and good branching and merging features. It
1299filesets, and keeps a history of file renaming and moving. VC 1307also supports atomic commits of filesets and file moving/renaming. VC
1300does not support all operations provided by GNU Arch, so you must 1308does not support all operations provided by GNU Arch, so you must
1301sometimes invoke it from the command line, or use a specialized 1309sometimes invoke it from the command line.
1302module.
1303 1310
1304@cindex git 1311@cindex git
1305 git is a version-control system invented by Linus Torvalds to 1312@item
1306support Linux kernel development. Like GNU Arch, it supports atomic 1313Git is a version control system invented by Linus Torvalds to support
1307commits of filesets, and keeps a history of file renaming and 1314Linux kernel development. It supports atomic commits of filesets and
1308moving. One significant feature of git is that it largely abolishes 1315file moving/renaming. One significant feature of git is that it
1309the notion of a single centralized repository; instead, each working 1316largely abolishes the notion of a single centralized repository;
1310copy of a git project is its own repository and coordination is done 1317instead, each working copy of a git project is its own repository and
1311through repository-sync operations. VC fully supports git, except 1318coordination is done through repository-sync operations. VC supports
1312that it doesn't do news merges and repository sync operations must 1319most git operations, with the exception of news merges and repository
1313be done from the command line. 1320syncing; these must be done from the command line.
1314 1321
1315@cindex hg 1322@cindex hg
1316@cindex Mercurial 1323@cindex Mercurial
1317 Mercurial is a distributed version-control systems broadly 1324@item
1318resembling GNU Arch and git, with atomic fileset commits and 1325Mercurial (hg) is a distributed version control system broadly
1319rename/move histories. Like git it is fully decentralized. 1326resembling GNU Arch and git, with atomic fileset commits and file
1320VC fully supports Mercurial, except for repository sync operations 1327moving/renaming. Like git, it is fully decentralized. VC supports
1321which still need to be done from the command line. 1328most Mercurial commands, with the exception of repository sync
1329operations; this needs to be done from the command line.
1330
1331@cindex bzr
1332@cindex Bazaar
1333@item
1334Bazaar (bzr) is a version control system that supports both
1335repository-based and distributed versioning, with atomic fileset
1336commits and file moving/renaming. VC supports most basic editing
1337operations under Bazaar.
1338@end itemize
1322 1339
1323@node VCS Concepts 1340@node VCS Concepts
1324@subsubsection Concepts of Version Control 1341@subsubsection Concepts of Version Control
1325 1342
1326@cindex repository 1343@cindex repository
1327@cindex registered file 1344@cindex registered file
1328 When a file is under version control, we also say that it is 1345 When a file is under version control, we say that it is
1329@dfn{registered} in the version control system. The system has a 1346@dfn{registered} in the version control system. The system has a
1330@dfn{repository} which stores both the file's present state plus its 1347@dfn{repository} which stores both the file's present state and its
1331change history---enough to reconstruct the current version or any 1348change history---enough to reconstruct the current version or any
1332earlier version. The repository will also contain a @dfn{log entry} for 1349earlier version. The repository also contains other information, such
1333each change to the file, describing in words what was modified in that 1350as @dfn{log entries} that describe the changes made to each file.
1334revision.
1335 1351
1336@cindex work file 1352@cindex work file
1337@cindex checking out files 1353@cindex checking out files
1338 A file checked out of a version-control repository is sometimes 1354 A file @dfn{checked out} of a repository is called the @dfn{work
1339called the @dfn{work file}. You edit the work file and make changes 1355file}. You edit the work file and make changes in it, as you would
1340in it, as you would with an ordinary file. After you are done with a 1356with an ordinary file. After you are done with a set of changes, you
1341set of changes, you @dfn{check in} or @dfn{commit} the file, which 1357@dfn{check in} or @dfn{commit} the file; this records the changes in
1342records the changes in the repository, along with a log entry for 1358the repository, along with a log entry for those changes.
1343them.
1344 1359
1345@cindex revision 1360@cindex revision
1346@cindex revision ID 1361@cindex revision ID
1347 A copy of a file stored in a repository is called a @dfn{revision}. 1362 A copy of a file stored in a repository is called a @dfn{revision}.
1348The history of a file is a sequence of revisions. Each revisions is 1363The history of a file is a sequence of revisions. Each revisions is
1349named by a @dfn{revision ID}. In older VCSes (such as SCCS and RCS), 1364named by a @dfn{revision ID}. The format of the revision ID depends
1350the simplest kind of revision ID consisted of a @dfn{dot-pair}; 1365on the version control system; in the simplest case, it is just an
1351integers (the @dfn{major} and @dfn{minor} revisions) separated by a 1366integer.
1352dot. Newer VCSes tend to use @dfn{monotonic} revision IDs that are
1353simple integers counting from 1.
1354 1367
1355 To go beyond these basic concepts, you will need to understand three 1368 To go beyond these basic concepts, you will need to understand three
1356ways in which version-control systems can differ from each other. They 1369ways in which version-control systems can differ from each other. They
@@ -1361,24 +1374,24 @@ to understand as you use it.
1361 1374
1362@cindex locking versus merging 1375@cindex locking versus merging
1363 A version control system typically has some mechanism to coordinate 1376 A version control system typically has some mechanism to coordinate
1364between users who want to change the same file. One method is 1377between users who want to change the same file. There are two ways to
1365@dfn{locking} (analogous to the locking that Emacs uses to detect 1378do this: locking and merging.
1366simultaneous editing of a file, but distinct from it). In a locking 1379
1367system, such as SCCS, you must @dfn{lock} a file before you start to 1380 In a version control system that uses locking, work files are
1368edit it. The other method is @dfn{merging}; the system tries to 1381normally read-only. To edit a file, you ask the version control
1369merge your changes with other people's changes when you check them in. 1382system to make it writable for you by @dfn{locking} it; only one user
1370 1383can lock a given file at any given time. This procedure is analogous
1371 With version control locking, work files are normally read-only so 1384to, but different from, the locking that Emacs uses to detect
1372that you cannot change them. You ask the version control system to make 1385simultaneous editing of ordinary files (@pxref{Interlocking}). When
1373a work file writable for you by locking it; only one user can do 1386you check in your changes, that unlocks the file, and the work file
1374this at any given time. When you check in your changes, that unlocks 1387becomes read-only again. Other users may then lock the file for
1375the file, making the work file read-only again. This allows other users 1388making their own changes.
1376to lock the file to make further changes. 1389
1377 1390 In a version control system that uses merging, each user may check
1378 By contrast, a merging system lets each user check out and modify a 1391out and modify a work file at any time. The system allows you to
1379work file at any time. When you check in a file, the system will 1392@dfn{merge} your work file, which may contain changes that have not
1380attempt to merge your changes with any others checked into the 1393been checked in, with the latest changes that others have checked into
1381repository since you checked out the file. 1394the repository.
1382 1395
1383 Both locking and merging systems can have problems when multiple users 1396 Both locking and merging systems can have problems when multiple users
1384try to modify the same file at the same time. Locking systems have 1397try to modify the same file at the same time. Locking systems have
@@ -1392,46 +1405,42 @@ have to be resolved by human judgment and communication.
1392told to operate in a merging style. CVS and Subversion are 1405told to operate in a merging style. CVS and Subversion are
1393merge-based by default but can be told to operate in a locking mode. 1406merge-based by default but can be told to operate in a locking mode.
1394Most later version-control systems, such as GNU Arch, git, and 1407Most later version-control systems, such as GNU Arch, git, and
1395Mercurial, have been based exclusively on merging rather than locking. 1408Mercurial, are based exclusively on merging rather than locking. This
1396This is because experience has shown that the merging-based approach 1409is because experience has shown that merging is generally superior to
1397is generally superior to the locking one, both in convenience to 1410locking, both in convenience to developers and in minimizing the
1398developers and in minimizing the number and severity of conflicts that 1411number and severity of conflicts that actually occur. Sometimes,
1399actually occur. 1412newer version control systems may have locks retrofitted onto them for
1400 1413reasons having nothing to do with technology@footnote{Usually the
1401 While it is rather unlikely that anyone will ever again build a 1414control-freak instincts of managers.}.
1402fundamentally locking-based rather than merging-based version-control 1415
1403system in the future, merging-based version-systems sometimes have locks 1416 VC mode supports both locking and merging version control and tries
1404retrofitted onto them for reasons having nothing to do with technology. 1417to hide the differences between them as much as possible.
1405@footnote{Usually the control-freak instincts of managers.} For this
1406reason, and to support older systems still in use, VC mode supports
1407both locking and merging version control and tries to hide the differences
1408between them as much as possible.
1409 1418
1410@cindex files versus changesets. 1419@cindex files versus changesets.
1411 On SCCS, RCS, CVS, and other early version-control systems, checkins 1420 On SCCS, RCS, CVS, and other early version-control systems, checkins
1412and other operations are @dfn{file-based}; each file has its own 1421and other operations are @dfn{file-based}; each file has its own
1413@dfn{master file} with its own comment and revision history separate 1422@dfn{master file} with its own comment and revision history separate
1414from that of all other files in the system. Later systems, beginning 1423from that of all other files in the system. Later systems, beginning
1415with Subversion, are @dfn{changeset-based}; a checkin under these 1424with Subversion, are @dfn{changeset-based}: a checkin may include
1416may include changes to several files and that change set is treated as 1425changes to several files, and the entire set of changes is treated as
1417a unit by the system. Any comment associated with the change belongs 1426a unit by the system. Any comment associated with the change does not
1418to no single file, but is attached to the changeset itself. 1427belong to a single file, but to the changeset itself.
1419 1428
1420 Changeset-based version control is in general both more flexible and 1429 Changeset-based version control is generally more flexible and
1421more powerful than file-based version control; usually, when a change to 1430powerful than file-based version control; usually, when a change to
1422multiple files has to be backed out, it's good to be able to easily 1431multiple files has to be backed out, it's good to be able to easily
1423identify and remove all of it. But it took some years for designers to 1432identify and remove all of it. But it took some years for designers
1424figure that out, and while file-based systems are passing out of use 1433to figure that out, and while file-based systems are passing out of
1425there are lots of legacy repositories still to be dealt with at time of 1434use there are lots of legacy repositories still to be dealt with at
1426writing in 2007. 1435time of writing (2008).
1427 1436
1428 In fact, older versions of VC mode supported only file-based systems, 1437 Older versions of VC supported only file-based systems, leading to
1429leading to some unhappy results when it was used to drive 1438some unhappy results when it was used to drive changeset-based
1430changeset-based ones---the Subversion support, for example, used to break 1439ones---the Subversion support, for example, used to break up
1431up changesets into multiple per-file commits. This has been fixed, but 1440changesets into multiple per-file commits. This has been fixed, but
1432it has left a legacy in VC-mode's terminology. The terms ``checkin'' 1441it has left a legacy in VC's terminology. The terms ``checkin'' and
1433and ``checkout'' are associated with file-based and locking-based 1442``checkout'' are associated with file-based and locking-based systems
1434systems and a bit archaic; nowadays those operations are usually called 1443and a bit archaic; nowadays those operations are usually called
1435``commit'' and ``update''. 1444``commit'' and ``update''.
1436 1445
1437@cindex centralized vs. decentralized 1446@cindex centralized vs. decentralized
@@ -1443,8 +1452,8 @@ single point of failure---if the repository server is down all work
1443stops. The other is that you need to be connected live to the server to 1452stops. The other is that you need to be connected live to the server to
1444do checkins and checkouts; if you're offline, you can't work. 1453do checkins and checkouts; if you're offline, you can't work.
1445 1454
1446 Newer version-control systems like GNU Arch, git, Mercurial, and Bzr 1455 Newer version-control systems like GNU Arch, git, Mercurial, and
1447are @dfn{decentralized}. A project may have several different 1456Bazaar are @dfn{decentralized}. A project may have several different
1448repositories, and these systems support a sort of super-merge between 1457repositories, and these systems support a sort of super-merge between
1449repositories that tries to reconcile their change histories. At the 1458repositories that tries to reconcile their change histories. At the
1450limit, each developer has his/her own repository, and repository 1459limit, each developer has his/her own repository, and repository