comparison en/ch03-concepts.xml @ 719:2ff0a43f1152

Update ch03
author Bryan O'Sullivan <bos@serpentine.com>
date Mon, 06 Apr 2009 23:13:53 -0700
parents 0b45854f0b7b
children e9ef075327c1
comparison
equal deleted inserted replaced
718:4e23c220d1b0 719:2ff0a43f1152
2 2
3 <chapter id="chap:concepts"> 3 <chapter id="chap:concepts">
4 <?dbhtml filename="behind-the-scenes.html"?> 4 <?dbhtml filename="behind-the-scenes.html"?>
5 <title>Behind the scenes</title> 5 <title>Behind the scenes</title>
6 6
7 <para id="x_2e8">Unlike many revision control systems, the concepts upon which 7 <para id="x_2e8">Unlike many revision control systems, the concepts
8 Mercurial is built are simple enough that it's easy to understand 8 upon which Mercurial is built are simple enough that it's easy to
9 how the software really works. Knowing this certainly isn't 9 understand how the software really works. Knowing these details
10 necessary, but I find it useful to have a <quote>mental 10 certainly isn't necessary, so it is certainly safe to skip this
11 model</quote> of what's going on.</para> 11 chapter. However, I think you will get more out of the software
12 12 with a <quote>mental model</quote> of what's going on.</para>
13 <para id="x_2e9">This understanding gives me confidence that Mercurial has been 13
14 carefully designed to be both <emphasis>safe</emphasis> and 14 <para id="x_2e9">Being able to understand what's going on behind the
15 scenes gives me confidence that Mercurial has been carefully
16 designed to be both <emphasis>safe</emphasis> and
15 <emphasis>efficient</emphasis>. And just as importantly, if it's 17 <emphasis>efficient</emphasis>. And just as importantly, if it's
16 easy for me to retain a good idea of what the software is doing 18 easy for me to retain a good idea of what the software is doing
17 when I perform a revision control task, I'm less likely to be 19 when I perform a revision control task, I'm less likely to be
18 surprised by its behaviour.</para> 20 surprised by its behaviour.</para>
19 21
434 synced at the same changeset as before the pull. If you 436 synced at the same changeset as before the pull. If you
435 make some changes and commit afterwards, you'll thus create 437 make some changes and commit afterwards, you'll thus create
436 a new head, because your working directory isn't synced to 438 a new head, because your working directory isn't synced to
437 whatever the current tip is.</para> 439 whatever the current tip is.</para>
438 440
439 <para id="x_316"> I put the word <quote>error</quote> in quotes because 441 <para id="x_316"> I put the word <quote>error</quote> in
440 all that you need to do to rectify this situation is 442 quotes because all that you need to do to rectify this
441 <command role="hg-cmd">hg merge</command>, then <command 443 situation is <command role="hg-cmd">hg merge</command>, then
442 role="hg-cmd">hg commit</command>. In other words, this 444 <command role="hg-cmd">hg commit</command>. In other words,
443 almost never has negative consequences; it just surprises 445 this almost never has negative consequences; it's just
444 people. I'll discuss other ways to avoid this behaviour, 446 something of a surprise for newcomers. I'll discuss other
445 and why Mercurial behaves in this initially surprising way, 447 ways to avoid this behaviour, and why Mercurial behaves in
446 later on.</para> 448 this initially surprising way, later on.</para>
447 </note> 449 </note>
448 450
449 </sect2> 451 </sect2>
450 <sect2> 452 <sect2>
451 <title>Merging heads</title> 453 <title>Merging changes</title>
452 454
453 <para id="x_317">When you run the <command role="hg-cmd">hg 455 <para id="x_317">When you run the <command role="hg-cmd">hg
454 merge</command> command, Mercurial leaves the first parent 456 merge</command> command, Mercurial leaves the first parent
455 of the working directory unchanged, and sets the second parent 457 of the working directory unchanged, and sets the second parent
456 to the changeset you're merging with, as shown in <xref 458 to the changeset you're merging with, as shown in <xref
516 technically possible to merge multiple changesets at once, the 518 technically possible to merge multiple changesets at once, the
517 prospect of user confusion and making a terrible mess of a 519 prospect of user confusion and making a terrible mess of a
518 merge immediately becomes overwhelming.</para> 520 merge immediately becomes overwhelming.</para>
519 521
520 </sect2> 522 </sect2>
523
524 <sect2>
525 <title>Merging and renames</title>
526
527 <para>A surprising number of revision control systems pay little
528 or no attention to a file's <emphasis>name</emphasis> over
529 time. For instance, it used to be common that if a file got
530 renamed on one side of a merge, the changes from the other
531 side would be silently dropped.</para>
532
533 <para>Mercurial records metadata when you tell it to perform a
534 rename or copy. It uses this metadata during a merge to do the
535 right thing in the case of a merge. For instance, if I rename
536 a file, and you edit it without renaming it, when we merge our
537 work the file will be renamed and have your edits
538 applied.</para>
539 </sect2>
521 </sect1> 540 </sect1>
541
522 <sect1> 542 <sect1>
523 <title>Other interesting design features</title> 543 <title>Other interesting design features</title>
524 544
525 <para id="x_323">In the sections above, I've tried to highlight some of the 545 <para id="x_323">In the sections above, I've tried to highlight some of the
526 most important aspects of Mercurial's design, to illustrate that 546 most important aspects of Mercurial's design, to illustrate that
573 gives a better compression ratio (the Burrows-Wheeler 593 gives a better compression ratio (the Burrows-Wheeler
574 algorithm from the widely used <literal>bzip2</literal> 594 algorithm from the widely used <literal>bzip2</literal>
575 compression package). This combination of algorithm and 595 compression package). This combination of algorithm and
576 compression of the entire stream (instead of a revision at a 596 compression of the entire stream (instead of a revision at a
577 time) substantially reduces the number of bytes to be 597 time) substantially reduces the number of bytes to be
578 transferred, yielding better network performance over almost 598 transferred, yielding better network performance over most
579 all kinds of network.</para> 599 kinds of network.</para>
580 600
581 <para id="x_329">(If the connection is over <command>ssh</command>, 601 <para id="x_329">(If the connection is over <command>ssh</command>,
582 Mercurial <emphasis>doesn't</emphasis> recompress the 602 Mercurial <emphasis>doesn't</emphasis> recompress the
583 stream, because <command>ssh</command> can already do this 603 stream, because <command>ssh</command> can already do this
584 itself.)</para> 604 itself.)</para>