aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric S. Raymond2007-07-18 19:42:23 +0000
committerEric S. Raymond2007-07-18 19:42:23 +0000
commitbcc75fe3e021f08475b165c456372786ae5e539d (patch)
tree3591915196d78828cd232e001cc60509efe22f60
parente725d58ffd318c662c434e0a74b2fc00fed43f6b (diff)
downloademacs-bcc75fe3e021f08475b165c456372786ae5e539d.tar.gz
emacs-bcc75fe3e021f08475b165c456372786ae5e539d.zip
Improve the explanation of version control to include concepts
from more modern systems.
-rw-r--r--man/files.texi123
1 files changed, 106 insertions, 17 deletions
diff --git a/man/files.texi b/man/files.texi
index 588fe4cae0b..ef627ba8402 100644
--- a/man/files.texi
+++ b/man/files.texi
@@ -1258,11 +1258,32 @@ this section if you are already familiar with the version control system
1258you want to use. 1258you want to use.
1259 1259
1260@menu 1260@menu
1261* Why Version Control?:: Understanding the problems it addresses
1261* Version Systems:: Supported version control back-end systems. 1262* Version Systems:: Supported version control back-end systems.
1262* VC Concepts:: Words and concepts related to version control. 1263* VC Concepts:: Words and concepts related to version control.
1263* Types of Log File:: The per-file VC log in contrast to the ChangeLog. 1264* Types of Log File:: The per-file VC log in contrast to the ChangeLog.
1264@end menu 1265@end menu
1265 1266
1267@node Why Version Control?
1268@subsubsection Understanding the problems it addresses
1269
1270 Version control systems provide you with three important capabilities:
1271@dfn{reversibility}. @dfn{concurrency}, and @dfn{history}.
1272
1273 The most basic capability you get from a version-control system is
1274reversibility, the ability to back up to a saved, known-good state when
1275you discover that some modification you did was a mistake or a bad idea.
1276
1277 Version-control systems also support concurrency, the ability to
1278have many people modifying the same collection of code or documents
1279knowing that conflicting modifications can be detected and resolved.
1280
1281 Version-control systems give you the capability to attach a history
1282to your data, explanatory comments about the intention behind each
1283change to it. Even for a programmer working solo change histories
1284are an important aid to memory; for a multi-person project they
1285become a vitally important form of communication among developers.
1286
1266@node Version Systems 1287@node Version Systems
1267@subsubsection Supported Version Control Systems 1288@subsubsection Supported Version Control Systems
1268 1289
@@ -1351,34 +1372,102 @@ After you are done with a set of changes, you @dfn{check the file in},
1351which records the changes in the master file, along with a log entry for 1372which records the changes in the master file, along with a log entry for
1352them. 1373them.
1353 1374
1354 With CVS, there are usually multiple work files corresponding to a 1375 To go beyond these basic concepts, you will need to understand three
1355single master file---often each user has his own copy. It is also 1376ways in which version-control systems can differ from each other. They
1356possible to use RCS in this way, but this is not the usual way to use 1377can be locking or merging; they can be file-based or changeset-based;
1357RCS. 1378and they can be centralized or decentralized. VC handles all these
1379choices, but they lead to differing behaviors which you will need
1380to understand as you use it.
1358 1381
1359@cindex locking and version control 1382@cindex locking versus merging
1360 A version control system typically has some mechanism to coordinate 1383 A version control system typically has some mechanism to coordinate
1361between users who want to change the same file. One method is 1384between users who want to change the same file. One method is
1362@dfn{locking} (analogous to the locking that Emacs uses to detect 1385@dfn{locking} (analogous to the locking that Emacs uses to detect
1363simultaneous editing of a file, but distinct from it). The other method 1386simultaneous editing of a file, but distinct from it). In a locking
1364is to merge your changes with other people's changes when you check them 1387system, such as SCCS, you must @dfn{lock} a file before you start to
1365in. 1388edit it. The other method is @dfn{merging}; the system tries to
1389merge your changes with other people's changes when you check them in.
1366 1390
1367 With version control locking, work files are normally read-only so 1391 With version control locking, work files are normally read-only so
1368that you cannot change them. You ask the version control system to make 1392that you cannot change them. You ask the version control system to make
1369a work file writable for you by locking it; only one user can do 1393a work file writable for you by locking it; only one user can do
1370this at any given time. When you check in your changes, that unlocks 1394this at any given time. When you check in your changes, that unlocks
1371the file, making the work file read-only again. This allows other users 1395the file, making the work file read-only again. This allows other users
1372to lock the file to make further changes. SCCS always uses locking, and 1396to lock the file to make further changes.
1373RCS normally does. 1397
1374 1398 By contrast, a merging system lets each user check out and modify a
1375 The other alternative for RCS is to let each user modify the work file 1399work file at any time. When you check in a a file, the system will
1376at any time. In this mode, locking is not required, but it is 1400attempt to merge your changes with any others checked into the
1377permitted; check-in is still the way to record a new version. 1401repository since you checked out the file.
1402
1403 Both locking and merging systems can have problems when multiple users
1404try to modify the same file at the same time. Locking systems have
1405@dfn{lock conflicts}; a user may try to check a file out and be unable
1406to because it is locked. In merging systems, @dfn{merge conflicts}
1407happen when you check in a change to a file that conflicts with a change
1408checked in by someone else after your checkout. Both kinds of conflict
1409have to be resolved by human judgment and communication.
1410
1411 SCCS always uses locking. RCS is lock-based by default but can be told
1412to operate in a merging style. CVS is merge-based by default but can
1413be told to operate in a locking mode. Most later version-control
1414systems, such as Subversion and GNU Arch, have been fundamentally
1415merging-based rather than locking-based. This is because experience
1416has shown that the merging-based approach is generally superior to
1417the locking one, both in convenience to developers and in minimizing
1418the number and severity of conflicts that actually occur.
1419
1420 While it is rather unlikely that anyone will ever again build a
1421fundamentally locking-based rather than merging-based version-control
1422system in the future, merging-based version-systems sometimes have locks
1423retrofitted onto them for reasons having nothing to do with technology.
1424@footnote{Usually the control-freak instincts of managers} For this
1425reason, and to support older systems still in use, VC mode supports
1426both locking and merging version control and tries to hide the differences
1427between them as much as possible.
1428
1429@cindex files versus changesets.
1430
1431 On SCCS. RCS, CVS, and other early version-control systems, checkins
1432and other operations are @dfn{file-based}; each file has its own
1433@dfn{master file} with its own comment- and revision history separate
1434from that of all other files in the system. Later systems, beginning
1435with Subversion, are @dfn{changeset-based}; a checkin may include
1436changes to several files and that change set is treated as a unit by the
1437system. Any comment associated with the change doesn't belong to any
1438one file, but is attached to the changeset itself.
1439
1440 Changeset-based version control is in general both more flexible and
1441more powerful than file-based version control; usually, when a change to
1442multiple files has to be backed out, it's good to be able to easily
1443identify and remove all of it. But it took some years for designers to
1444figure that out, and while file-based systems are passing out of use
1445there are lots of legacy repositories still to be dealt with at time of
1446writing in 2007.
1447
1448@cindex centralized vs. decentralized
1449
1450 Early version-control systems were designed around a @dfn{centralized}
1451model in which each project has only one repository used by all
1452developers. SCCS, RCS, CVS, and Subversion share this kind of model.
1453It has two important problems. One is that a single repository is a
1454single point of failure--if the repository server is down all work
1455stops. The other is that you need to be connected live to the server to
1456do checkins and checkouts; if you're offline, you can't work.
1457
1458 Newer version-control systems like GNU Arch are @dfn{decentralized}.
1459A project may have several different repositories, and these systems
1460support a sort of super-merge between repositories that tries to
1461reconcile their change histories. At the limit, each developer has
1462his/her own repository, and repository merges replace checkin/commit
1463operations.
1464
1465 VC's job is to help you manage the traffic between your personal
1466workfiles and a repository. Whether that repository is a single master
1467or one of a network of peer repositories is not something VC has to care
1468about. Thus, the difference between a centralized and a decentralized
1469version-control system is invisible to VC mode.
1378 1470
1379 CVS normally allows each user to modify his own copy of the work file
1380at any time, but requires merging with changes from other users at
1381check-in time. However, CVS can also be set up to require locking.
1382@iftex 1471@iftex
1383(@pxref{CVS Options,,,emacs-xtra, Specialized Emacs Features}). 1472(@pxref{CVS Options,,,emacs-xtra, Specialized Emacs Features}).
1384@end iftex 1473@end iftex