1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071
|
<html>
<head>
<title>Basic Revision Control</title>
</head>
<body>
<a name="Basic_Revision_Control"></a>
<a href="http://www.regexps.com">The Hackerlab at <code>regexps.com</code></a>
<h2 align=center>Basic Revision Control</h2>
<small>
<b>up: </b><a href="arch.html#arch">arch</a></br>
<b>next: </b><a href="basic-branching-and-merging.html#Basic_Branching_and_Merging">Basic Branching and Merging</a></br>
<b>prev: </b><a href="development-paths.html#Development_Paths">Development Paths</a></br>
</small>
<br>
<p>This chapter introduces the fundamental operations for storing
revisions in archives, retrieving them, doing clever things with
patches, and managing project trees for archived projects.
</p><ul>
<li><a href="basic-rc.html#The_First_Revision">The First Revision</a></li>
<li><a href="basic-rc.html#Successive_Revisions">Successive Revisions</a></li>
<li><a href="basic-rc.html#Patch_Levels_and_Development_Phases">Patch Levels and Development Phases</a></li>
<li><a href="basic-rc.html#Getting_a_Revision">Getting a Revision</a></li>
<li><a href="basic-rc.html#Optimizing_Archives_for_get">Optimizing Archives for get</a></li>
<li><a href="basic-rc.html#Finding_Out_What_Changed">Finding Out What Changed</a></li>
<li><a href="basic-rc.html#The_whats-missing_Command">The whats-missing Command</a></li>
<li><a href="basic-rc.html#Update">Update</a></li>
<li><a href="basic-rc.html#Replay">Replay</a></li>
<li><a href="basic-rc.html#The_Next_Version">The Next Version</a></li>
</ul>
<hr>
<a name="The_First_Revision"></a>
<h3 align=center>The First Revision</h3>
<small>
<b>up: </b><a href="basic-rc.html#Basic_Revision_Control">Basic Revision Control</a></br>
<b>next: </b><a href="basic-rc.html#Successive_Revisions">Successive Revisions</a></br>
</small>
<br>
<p><a name="index-pt:0"></a>
</p><p>When beginning a new project, the first step is to check in the very
first revision of the tree.
</p><p><strong><u>Prepare the Archive</u></strong> We've already seen how to prepare the archive by
creating the category, branch, and version for the project (see
<a href="development-paths.html#Creating_a_Development_Path">Creating a Development Path</a>). You have to perform those
steps before checking in the first revision:
</p><pre>
% larch make-category CATEGORY
% larch make-branch BRANCH
% larch make-version VERSION
</pre>
<p><strong><u>Prepare the Project Tree</u></strong> We've also seen how to turn an ordinary
directory into a project tree using the <code>init-tree</code>
command (see
<a href="project-trees.html#Initializing_a_Project_Tree">Initializing a Project Tree</a>). And we've seen how to set the
default version of a project tree using <code>set-tree-version</code>
(see
<a href="project-names.html#Labelling_Project_Trees">Labelling Project Trees</a>). Both of these steps must be
completed before checking in the first revision:
</p><pre>
% larch init-tree
% larch set-tree-version VERSION-NAME
</pre>
<p>In addition, you must create for the project tree a "patch log" --
where log entries for revisions in the development path <code>VERSION-NAME</code>
will be stored:
</p><pre>
% larch add-log VERSION-NAME
</pre>
<p>Patch logs are explained in detail in the next chapter. For now, just
accept the necessity of that command on faith.
</p><p><strong><u>Prepare a Log Message</u></strong> In the root of the project tree, the command:
</p><pre>
% larch make-log
</pre>
<p>creates a template for a log file (look for file whose name begins
with <code>++log</code>
). The details of what should go in a log message are
project specific. In general, the format of a log message uses
<code>RFC822</code>
style headers followed by a free-form body. When <code>arch</code>
stores a log message, it will add some headers of its own.
</p><p><strong><u>Archive the Tree</u></strong> Again, in the root of the project tree, use
the <code>import</code>
command to archive the tree:
</p><pre>
% larch import
</pre>
<p><code>import</code>
will print the headers of the log message (including headers
added by <code>arch</code>
), store the tree in the archive (as a compressed tar
file), and update the patch log of the working directory to reflect
the commit.
</p><p>After commiting a revision to, say, <code>hello--devo--1.0</code>
, you can use
the command <code>revisions</code>
to see a list of archived revisions:
</p><pre>
% larch revisions hello--devo--1.0
base-0
</pre>
<p><code>base-0</code>
is the "patch level name" for the first revision. Patch
levels are described in greater detail below.
</p>
<hr>
<a name="Successive_Revisions"></a>
<h3 align=center>Successive Revisions</h3>
<small>
<b>up: </b><a href="basic-rc.html#Basic_Revision_Control">Basic Revision Control</a></br>
<b>next: </b><a href="basic-rc.html#Patch_Levels_and_Development_Phases">Patch Levels and Development Phases</a></br>
<b>prev: </b><a href="basic-rc.html#The_First_Revision">The First Revision</a></br>
</small>
<br>
<p><a name="index-pt:1"></a>
</p><p>Suppose that you have continued to edit your working directory after
checking in the initial revision. Successive revisions can be checked
in with the command <code>commit</code>
, issued at the root of the working
directory. As with <code>import</code>
, you must first use <code>make-log</code>
to
prepare a log message for each commit:
</p><pre>
% larch make-log
</pre>
<pre>
[...edit log message...]
</pre>
<pre>
% larch commit
[output omitted]
</pre>
<p>After several commits, you'll have a number of patch levels:
</p><pre>
% larch revisions hello--devo--1.0
base-0
patch-1
patch-2
patch-3
...
</pre>
<p>As a point of interest, the base revision is stored as a compressed
tar file of the entire tree. Each <code>patch-N</code>
is stored as a compressed
tar file of just a patch set that describes how to derive that
revision from the previous revision.
</p>
<hr>
<a name="Patch_Levels_and_Development_Phases"></a>
<h3 align=center>Patch Levels and Development Phases</h3>
<small>
<b>up: </b><a href="basic-rc.html#Basic_Revision_Control">Basic Revision Control</a></br>
<b>next: </b><a href="basic-rc.html#Getting_a_Revision">Getting a Revision</a></br>
<b>prev: </b><a href="basic-rc.html#Successive_Revisions">Successive Revisions</a></br>
</small>
<br>
<p>Within a version, there is a sequence of revisions, each of which is a
different <em>
<a name="index-pt:2"></a>
patch level
</em>
. Every patch level has a <em>
<a name="index-pt:3"></a>
patch level name
</em>
,
derived from the version name by adding a suffix:
</p><pre>
hello--devo--1.0--base-0
hello--devo--1.0--patch-1
hello--devo--1.0--patch-2
hello--devo--1.0--patch-3
...
</pre>
<p>Just as with version names, there is also such a thing as a <em>
<a name="index-pt:4"></a>
fully
qualified patch level name
</em>
:
</p><pre>
joe.hacker@gnu.org--test-archive/hello--devo--1.0--patch-3
</pre>
<p>Development within a version may be optionally divided into four
phases: <em>
<a name="index-pt:5"></a>
base revision
</em>
, <em>
<a name="index-pt:6"></a>
pre-patches
</em>
, <em>
<a name="index-pt:7"></a>
version revision
</em>
, and
<em>
<a name="index-pt:8"></a>
post-patches
</em>
. Conceptually, "pre-patches" are revisions made
before the version is "done". "Post-patches" are revisions made
after the version is done (e.g. "bug fix patches").
</p><p>At the beginning of a development path is the <em>
<a name="index-pt:9"></a>
base revision
</em>
(called <code>base-0</code>
). Between the pre-patch and post-patch phases is the
<em>
<a name="index-pt:10"></a>
version revision
</em>
(called <code>version-0</code>
). Post-patches have names like
<code>versionfix-1</code>
, <code>versionfix-2</code>
, etc.
</p><p>So the total sequence of revisions within a development path has the
form:
</p><pre>
The Initial Revision:
</pre>
<pre>
base-0
</pre>
<pre>
Pre-Patches:
</pre>
<pre>
patch-1
patch-2
patch-3
...
patch-N
</pre>
<pre>
The Version Revision:
</pre>
<pre>
version-0
</pre>
<pre>
Post-Patches:
</pre>
<pre>
versionfix-1
versionfix-2
versionfix-3
...
</pre>
<p>Typically, the <code>version-0</code>
revision is what would be released under
the version number and the post-patch revisions are fixes made after
the release.
</p><p>The ordinary <code>commit</code>
command creates pre-patches (<code>patch-N</code>
revisions).
</p><p>To create the version revision, use <code>commit --seal</code>
:
</p><pre>
% larch commit --seal
</pre>
<p>After the version revision exists, ordinary commit will no longer
work. To create a post-patch revision, use <code>commit --fix</code>
:
</p><pre>
% larch commit --fix
</pre>
<p>It is perhaps worth mentioning that patch level names can be sorted
easily using:
</p><pre>
sort -t - -k 1,1 -k 2,2n
</pre>
<p>or in reverse:
</p><pre>
sort -t - -k 1,1r -k 2,2rn
</pre>
<p>If you are familiar with other revision control systems, a four-phased
development process may at first seem somewhat arbitrary and
needlessly complicated. Two points are worth mentioning:
</p><p>First, phased development is entirely optional. Nothing requires you
to ever <code>--seal</code>
a version, and if you never seal a version,
you never need to use <code>--fix</code>
. Instead, every revision (after
<code>base-0</code>
) will be a <code>patch-N</code>
revision.
</p><p>Second, phased development is a handy way to prevent accidents when
organizing more complex projects. Sealing a version is a
way to set a flag that says, in effect, "ordinary development in this
version has stopped -- you might not really want to make a new
revision here." You can make a new revision if you insist (by
specifying <code>--fix</code>
), but the requirement that you insist helps alert
you to the fact that your new revision might need to be merged with
later versions of the same project; or that that version you are
revising has already been released. Phased development is a
bookkeeping convenience: for the most part, <code>arch</code>
treats all
revisions equally, regardless of their phase.
</p>
<hr>
<a name="Getting_a_Revision"></a>
<h3 align=center>Getting a Revision</h3>
<small>
<b>up: </b><a href="basic-rc.html#Basic_Revision_Control">Basic Revision Control</a></br>
<b>next: </b><a href="basic-rc.html#Optimizing_Archives_for_get">Optimizing Archives for get</a></br>
<b>prev: </b><a href="basic-rc.html#Patch_Levels_and_Development_Phases">Patch Levels and Development Phases</a></br>
</small>
<br>
<p>To retrieve a revision from an archive, use <code>larch get</code>
:
</p><pre>
% larch get REVISION DIR
</pre>
<p>as in:
</p><pre>
% larch get hello--devo--1.0--patch-4 hello
</pre>
<p>to retrieve the revision <code>patch-4</code>
and store it in the new directory
<code>hello</code>
.
</p><p>An abbreviation can be used to obtain the most recent revision of a
version:
</p><pre>
% larch get hello--devo--1.0 hello
</pre>
<p>or to obtain the most recent revsion of the highest-numbered version:
</p><pre>
% larch get hello--devo hello
</pre>
<p>A fully-qualified name can be used to obtain a revision from someplace
other than the default archive:
</p><pre>
% larch get joe.hacker@gnu.org--test-archive/hello--devo
</pre>
<hr>
<a name="Optimizing_Archives_for_get"></a>
<h3 align=center>Optimizing Archives for get</h3>
<small>
<b>up: </b><a href="basic-rc.html#Basic_Revision_Control">Basic Revision Control</a></br>
<b>next: </b><a href="basic-rc.html#Finding_Out_What_Changed">Finding Out What Changed</a></br>
<b>prev: </b><a href="basic-rc.html#Getting_a_Revision">Getting a Revision</a></br>
</small>
<br>
<p>The way that <code>get</code>
ordinarilly works is that it searches backwards
from the desired revision to find the nearest full-source base
revision. It gets the compressed tar file for that base revision and
creates a source tree. Then, for each intermediate patch level, it
gets a compressed tar file of the patch set, uncompresses and un-tars
the patch-set, and applies the patch-set to the source tree.
</p><p>If there are many intermediate patch-sets, that process can be slow.
In such cases, you can ask <code>arch</code>
to cache a full-source copy of an
arbitrary revision, with the command:
</p><pre>
% larch archive-cache-revision [ARCHIVE/]REVISION
</pre>
<p>That command first builds the requested revision, then it builds a
compressed tar file of the revision, then it stores the tar file back
in the archive. Subsequent attempts to <code>get</code>
the same revision (or
any later revision) will use the cached tree.
</p><p>To remove a previously cached tree, use:
</p><pre>
% larch archive-uncache-revision [ARCHIVE/]REVISION
</pre>
<p>For each user, <code>arch</code>
also maintains a "client side" cache of
revisions that can speed up <code>get</code>
(and other operations). The details
of client side caching are documented in a later chapter (xref!!!).
</p>
<hr>
<a name="Finding_Out_What_Changed"></a>
<h3 align=center>Finding Out What Changed</h3>
<small>
<b>up: </b><a href="basic-rc.html#Basic_Revision_Control">Basic Revision Control</a></br>
<b>next: </b><a href="basic-rc.html#The_whats-missing_Command">The whats-missing Command</a></br>
<b>prev: </b><a href="basic-rc.html#Optimizing_Archives_for_get">Optimizing Archives for get</a></br>
</small>
<br>
<p><a name="index-pt:11"></a>
</p><p>Before performing a <code>commit</code>
, you might want to check to see what
has actually changed -- that is, find out exactly what patch set your
<code>commit</code>
will create.
</p><p>You can do that with the command <code>what-changed</code>
:
</p><pre>
% larch what-changed
[...patch set report...]
</pre>
<p><code>what-changed</code>
computes a patch set between your modified project tree
and the latest patch level for which your project tree is up-to-date.
In other words, it tells you what changes have been made to your tree
compared to the tree in the archive.
</p><p><code>what-changed</code>
leaves behind a directory containing the patch set and
patch report, which you can usefully browse by hand.
</p><pre>
% ls
,,what-changed.arch--devo--0.5--patch-14--lord@regexps.com--arch-1
[...]
</pre>
<p>The default output of <code>what-changed</code>
is formatted for use with the
<code>outline</code>
mode of <strong>GNU Emacs</strong>.
</p><p>You can ask <code>what-changed</code>
to also generate an HTML-formatted report
with:
</p><pre>
% larch what-changed --url
URL of patch report
</pre>
<p>The HTML report has links to each context diff, added, and removed
file. The output of the command is a <code>file:</code>
method URL. For
example, a useful command for <code>netscape</code>
users is:
</p><pre>
% netscape --remote "openURL(`larch what-changed --url`)"
</pre>
<hr>
<a name="The_whats-missing_Command"></a>
<h3 align=center>The whats-missing Command</h3>
<small>
<b>up: </b><a href="basic-rc.html#Basic_Revision_Control">Basic Revision Control</a></br>
<b>next: </b><a href="basic-rc.html#Update">Update</a></br>
<b>prev: </b><a href="basic-rc.html#Finding_Out_What_Changed">Finding Out What Changed</a></br>
</small>
<br>
<p><a name="index-pt:12"></a>
</p><p>Suppose that more than one programmer is checking revisions into a
version, Alice and Bob for example.
</p><p>Alice and Bob both start with working directories and both make some
changes. Alice commits several changes. Now Bob's working directory
has fallen behind archived development path.
</p><p>The command <code>whats-missing</code>
can be used to tell Bob which patches he
is missing:
</p><pre>
% larch whats-missing --summary
patch-N
summary of patch N
patch-N+1
summary of patch N+1
...
</pre>
<p>For each patch that Bob is missing, <code>whats-missing --summary</code>
prints
the name of the patch and the contents of the <code>Summary:</code>
header from
its log message.
</p><p>The <code>whats-missing</code>
command is explained in greater detail in a later
chapter (see <a href="patch-logs.html#Patch_Logs_and_ChangeLogs">Patch Logs and ChangeLogs</a>).
</p>
<hr>
<a name="Update"></a>
<h3 align=center>Update</h3>
<small>
<b>up: </b><a href="basic-rc.html#Basic_Revision_Control">Basic Revision Control</a></br>
<b>next: </b><a href="basic-rc.html#Replay">Replay</a></br>
<b>prev: </b><a href="basic-rc.html#The_whats-missing_Command">The whats-missing Command</a></br>
</small>
<br>
<p>So Bob is behind by a few patches, but also has his own modifications.
</p><p>Diagramatically, we have something like:
</p><pre>
Patch Levels Bob's Working
in the Directory
Archive:
------------------------------
</pre>
<pre>
base-0
</pre>
<pre>
patch-1
patch-2
patch-3
patch-4 --------> bob-0 (Bob's initial working directory)
patch-5 |
patch-6 |
patch-7 V
patch-8 bob-1 (Bob's working dir with changes)
</pre>
<p>Bob is missing patches five through eight.
</p><p>The command <code>update</code>
can be used to fix the situation:
</p><pre>
% larch update OLD-DIR NEW-DIR
</pre>
<p>as in:
</p><pre>
% larch update bob-1 bob-2
</pre>
<p><code>update</code>
works in several steps. First, it gets a copy of the latest
revision (<code>patch-8</code>
in this case). It also gets a copy of the
revision from which <code>OLD-DIR</code>
is dervied (<code>patch-4</code>
in this case).
Then it uses <code>mkpatch</code>
to compute the differences between <code>OLD-DIR</code>
and its source revision, and applies those differences (using
<code>dopatch</code>
) to the latest revision.
</p><p>In the example, update will create the directory <code>bob-2</code>
, with
the source:
</p><pre>
delta(patch-4, bob-1)[patch-8]
</pre>
<p>(For information about this notation, see <a href="theory-of-patches.html#The_Theory_of_Patches_and_Revisions">The Theory of Patches and Revisions</a>.)
</p><p>Applying that patch might cause conflicts. In that case, <code>update</code>
will print a message telling Bob to look for <code>.rej</code>
files.
</p><p>As a convenience, <code>update</code>
also copies all "precious" non-source
files from <code>OLD-DIR</code>
to <code>NEW-DIR</code>
(see <a href="inventory.html#arch_Project_Inventories">arch Project Inventories</a>).
</p><p>Of course, if Bob only wanted to "partly update", he could do that
with an extra parameter to <code>update</code>
, as in the example:
</p><pre>
# update, but only up to patch level 6:
#
</pre>
<pre>
% larch update bob-1 bob-2 hello--devo--1.1--patch-6
</pre>
<p>Finally, <code>update</code>
can replace <code>OLD-DIR</code>
with the updated directory if
given the <code>--in-place</code>
flag:
</p><pre>
% larch update --in-place OLD-DIR
</pre>
<hr>
<a name="Replay"></a>
<h3 align=center>Replay</h3>
<small>
<b>up: </b><a href="basic-rc.html#Basic_Revision_Control">Basic Revision Control</a></br>
<b>next: </b><a href="basic-rc.html#The_Next_Version">The Next Version</a></br>
<b>prev: </b><a href="basic-rc.html#Update">Update</a></br>
</small>
<br>
<p><code>update</code>
isn't the only way to catch-up with a development path.
Another option is <code>replay</code>
:
</p><pre>
% larch replay old-dir new-dir
</pre>
<p>Using the same example:
</p><pre>
Patch Levels Bob's Working
in the Directory
Archive:
------------------------------
</pre>
<pre>
base-0
</pre>
<pre>
patch-1
patch-2
patch-3
patch-4 --------> bob-0 (Bob's initial working directory)
patch-5 |
patch-6 |
patch-7 V
patch-8 bob-1 (Bob's working dir with changes)
</pre>
<p>and the command:
</p><pre>
% larch replay bob-1 bob-2
</pre>
<p><code>replay</code>
will first copy <code>bob-1</code>
to create <code>bob-2</code>
. Then it will
apply each missing patch in succession until <code>bob-2</code>
is up-to-date, or
until a merge conflict occurs.
</p><p>Thus, if no conflict occurs, <code>replay</code>
computes:
</p><pre>
patch-8 [ patch-7 [ patch-6 [ patch-5 [ bob-1 ]]]]
</pre>
<p>If a conflict occured in, say, <code>patch-6</code>
, then <code>replay</code>
would compute:
</p><pre>
patch-6 [ patch-5 [ bob-1 ]]
</pre>
<p>and after fixing the conflict, Bob could use a second <code>replay</code>
command
to apply patches seven and eight.
</p><p>As with <code>update</code>
, <code>replay</code>
also copies all "precious" non-source
files from <code>OLD-DIR</code>
to <code>NEW-DIR</code>
(see <a href="inventory.html#arch_Project_Inventories">arch Project Inventories</a>).
</p><p>Of course, if Bob only wanted to "partly replay", he could do that
with an extra parameter to <code>replay</code>
, as in the example:
</p><pre>
# replay, but only up to patch level 6:
#
</pre>
<pre>
% larch replay bob-1 bob-2 hello--devo--1.1--patch-6
</pre>
<p>You can use <code>replay</code>
to modify an existing directory rather than
creating a new directory:
</p><pre>
% larch replay --in-place DIR [REVISION]
</pre>
<p>but be careful: if <code>DIR</code>
contains precious local changes, and
conflicts occur, or if you simply decide the <code>replay</code>
wasn't a good
idea, you'll have to do some work to revert the <code>replay</code>
.
</p>
<hr>
<a name="The_Next_Version"></a>
<h3 align=center>The Next Version</h3>
<small>
<b>up: </b><a href="basic-rc.html#Basic_Revision_Control">Basic Revision Control</a></br>
<b>prev: </b><a href="basic-rc.html#Replay">Replay</a></br>
</small>
<br>
<p>In simple situations, a version like <code>hello--devo--1.0</code>
will be
followed by the <em>
<a name="index-pt:13"></a>
next version
</em>
: <code>hello--devo--1.1</code>
or
<code>hello--devo--2.0</code>
, for example.
</p><p>Such a version is called a <em>
<a name="index-pt:14"></a>
continuation
</em>
of the previous version and
it is created with this sequence of commands (in the root of a working
directory):
</p><pre>
% larch make-version NEXT-VERSION
% larch add-log NEXT-VERSION
% larch set-tree-version NEXT-VERSION
% larch make-log
[...edit log message...]
% larch commit --continuation PREVIOUS-VERSION
</pre>
<p>as in:
</p><pre>
% larch make-version hello--devo--1.1
% larch add-log hello--devo--1.1
% larch set-tree-version hello--devo--1.1
% larch make-log
[...edit log message...]
% larch commit --continuation hello--devo--1.0
</pre>
<p>Those commands create the <code>base-0</code>
revision of the new version but
instead of storing complete source for the base revision, they store a
pointer to the older revision which the base revision is equal to.
</p><p>On the other hand, if you wanted the next version to start completely
from scratch (perhaps because a program is being replaced by an
entirely new implementation), the <code>import</code>
command can create the next
version as documented earlier in this chapter.
</p><p>Finally, there is another command (besides <code>commit --continuation</code>
)
for creating the next version, <code>larch tag</code>
, described in the next
chapter.
</p>
<small><i>arch: The arch Revision Control System
</i></small><br>
<a href="http://www.regexps.com">The Hackerlab at <code>regexps.com</code></a>
</body>
|