diff options
| author | Eric S. Raymond | 2007-07-18 19:42:23 +0000 |
|---|---|---|
| committer | Eric S. Raymond | 2007-07-18 19:42:23 +0000 |
| commit | bcc75fe3e021f08475b165c456372786ae5e539d (patch) | |
| tree | 3591915196d78828cd232e001cc60509efe22f60 | |
| parent | e725d58ffd318c662c434e0a74b2fc00fed43f6b (diff) | |
| download | emacs-bcc75fe3e021f08475b165c456372786ae5e539d.tar.gz emacs-bcc75fe3e021f08475b165c456372786ae5e539d.zip | |
Improve the explanation of version control to include concepts
from more modern systems.
| -rw-r--r-- | man/files.texi | 123 |
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 | |||
| 1258 | you want to use. | 1258 | you 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 | ||
| 1274 | reversibility, the ability to back up to a saved, known-good state when | ||
| 1275 | you discover that some modification you did was a mistake or a bad idea. | ||
| 1276 | |||
| 1277 | Version-control systems also support concurrency, the ability to | ||
| 1278 | have many people modifying the same collection of code or documents | ||
| 1279 | knowing that conflicting modifications can be detected and resolved. | ||
| 1280 | |||
| 1281 | Version-control systems give you the capability to attach a history | ||
| 1282 | to your data, explanatory comments about the intention behind each | ||
| 1283 | change to it. Even for a programmer working solo change histories | ||
| 1284 | are an important aid to memory; for a multi-person project they | ||
| 1285 | become 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}, | |||
| 1351 | which records the changes in the master file, along with a log entry for | 1372 | which records the changes in the master file, along with a log entry for |
| 1352 | them. | 1373 | them. |
| 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 |
| 1355 | single master file---often each user has his own copy. It is also | 1376 | ways in which version-control systems can differ from each other. They |
| 1356 | possible to use RCS in this way, but this is not the usual way to use | 1377 | can be locking or merging; they can be file-based or changeset-based; |
| 1357 | RCS. | 1378 | and they can be centralized or decentralized. VC handles all these |
| 1379 | choices, but they lead to differing behaviors which you will need | ||
| 1380 | to 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 |
| 1361 | between users who want to change the same file. One method is | 1384 | between 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 |
| 1363 | simultaneous editing of a file, but distinct from it). The other method | 1386 | simultaneous editing of a file, but distinct from it). In a locking |
| 1364 | is to merge your changes with other people's changes when you check them | 1387 | system, such as SCCS, you must @dfn{lock} a file before you start to |
| 1365 | in. | 1388 | edit it. The other method is @dfn{merging}; the system tries to |
| 1389 | merge 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 |
| 1368 | that you cannot change them. You ask the version control system to make | 1392 | that you cannot change them. You ask the version control system to make |
| 1369 | a work file writable for you by locking it; only one user can do | 1393 | a work file writable for you by locking it; only one user can do |
| 1370 | this at any given time. When you check in your changes, that unlocks | 1394 | this at any given time. When you check in your changes, that unlocks |
| 1371 | the file, making the work file read-only again. This allows other users | 1395 | the file, making the work file read-only again. This allows other users |
| 1372 | to lock the file to make further changes. SCCS always uses locking, and | 1396 | to lock the file to make further changes. |
| 1373 | RCS 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 | 1399 | work file at any time. When you check in a a file, the system will |
| 1376 | at any time. In this mode, locking is not required, but it is | 1400 | attempt to merge your changes with any others checked into the |
| 1377 | permitted; check-in is still the way to record a new version. | 1401 | repository since you checked out the file. |
| 1402 | |||
| 1403 | Both locking and merging systems can have problems when multiple users | ||
| 1404 | try 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 | ||
| 1406 | to because it is locked. In merging systems, @dfn{merge conflicts} | ||
| 1407 | happen when you check in a change to a file that conflicts with a change | ||
| 1408 | checked in by someone else after your checkout. Both kinds of conflict | ||
| 1409 | have to be resolved by human judgment and communication. | ||
| 1410 | |||
| 1411 | SCCS always uses locking. RCS is lock-based by default but can be told | ||
| 1412 | to operate in a merging style. CVS is merge-based by default but can | ||
| 1413 | be told to operate in a locking mode. Most later version-control | ||
| 1414 | systems, such as Subversion and GNU Arch, have been fundamentally | ||
| 1415 | merging-based rather than locking-based. This is because experience | ||
| 1416 | has shown that the merging-based approach is generally superior to | ||
| 1417 | the locking one, both in convenience to developers and in minimizing | ||
| 1418 | the number and severity of conflicts that actually occur. | ||
| 1419 | |||
| 1420 | While it is rather unlikely that anyone will ever again build a | ||
| 1421 | fundamentally locking-based rather than merging-based version-control | ||
| 1422 | system in the future, merging-based version-systems sometimes have locks | ||
| 1423 | retrofitted onto them for reasons having nothing to do with technology. | ||
| 1424 | @footnote{Usually the control-freak instincts of managers} For this | ||
| 1425 | reason, and to support older systems still in use, VC mode supports | ||
| 1426 | both locking and merging version control and tries to hide the differences | ||
| 1427 | between them as much as possible. | ||
| 1428 | |||
| 1429 | @cindex files versus changesets. | ||
| 1430 | |||
| 1431 | On SCCS. RCS, CVS, and other early version-control systems, checkins | ||
| 1432 | and other operations are @dfn{file-based}; each file has its own | ||
| 1433 | @dfn{master file} with its own comment- and revision history separate | ||
| 1434 | from that of all other files in the system. Later systems, beginning | ||
| 1435 | with Subversion, are @dfn{changeset-based}; a checkin may include | ||
| 1436 | changes to several files and that change set is treated as a unit by the | ||
| 1437 | system. Any comment associated with the change doesn't belong to any | ||
| 1438 | one file, but is attached to the changeset itself. | ||
| 1439 | |||
| 1440 | Changeset-based version control is in general both more flexible and | ||
| 1441 | more powerful than file-based version control; usually, when a change to | ||
| 1442 | multiple files has to be backed out, it's good to be able to easily | ||
| 1443 | identify and remove all of it. But it took some years for designers to | ||
| 1444 | figure that out, and while file-based systems are passing out of use | ||
| 1445 | there are lots of legacy repositories still to be dealt with at time of | ||
| 1446 | writing in 2007. | ||
| 1447 | |||
| 1448 | @cindex centralized vs. decentralized | ||
| 1449 | |||
| 1450 | Early version-control systems were designed around a @dfn{centralized} | ||
| 1451 | model in which each project has only one repository used by all | ||
| 1452 | developers. SCCS, RCS, CVS, and Subversion share this kind of model. | ||
| 1453 | It has two important problems. One is that a single repository is a | ||
| 1454 | single point of failure--if the repository server is down all work | ||
| 1455 | stops. The other is that you need to be connected live to the server to | ||
| 1456 | do checkins and checkouts; if you're offline, you can't work. | ||
| 1457 | |||
| 1458 | Newer version-control systems like GNU Arch are @dfn{decentralized}. | ||
| 1459 | A project may have several different repositories, and these systems | ||
| 1460 | support a sort of super-merge between repositories that tries to | ||
| 1461 | reconcile their change histories. At the limit, each developer has | ||
| 1462 | his/her own repository, and repository merges replace checkin/commit | ||
| 1463 | operations. | ||
| 1464 | |||
| 1465 | VC's job is to help you manage the traffic between your personal | ||
| 1466 | workfiles and a repository. Whether that repository is a single master | ||
| 1467 | or one of a network of peer repositories is not something VC has to care | ||
| 1468 | about. Thus, the difference between a centralized and a decentralized | ||
| 1469 | version-control system is invisible to VC mode. | ||
| 1378 | 1470 | ||
| 1379 | CVS normally allows each user to modify his own copy of the work file | ||
| 1380 | at any time, but requires merging with changes from other users at | ||
| 1381 | check-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 |