# # # patch "ChangeLog" # from [1dfdd66ef55d0d9ec0d3bc97aa00d9d685075d39] # to [07e6a584fcd89373f4ae1d08b4610f167c1ab237] # # patch "monotone.texi" # from [ff023633331816e19ac5c26d54ab83b3c07f29b4] # to [c78e69ae3bd028c853790a03997ccf6c77c2c830] # ============================================================ --- ChangeLog 1dfdd66ef55d0d9ec0d3bc97aa00d9d685075d39 +++ ChangeLog 07e6a584fcd89373f4ae1d08b4610f167c1ab237 @@ -1,5 +1,10 @@ 2006-04-25 Jeronimo Pellegrini + * monotone.texi (Using packets): New section, short tutorial + showing how packets work. (With some small fixups by Nathaniel.) + +2006-04-25 Jeronimo Pellegrini + * monotone.texi: Replace many references to 'monotone' with 'mtn'. ============================================================ --- monotone.texi ff023633331816e19ac5c26d54ab83b3c07f29b4 +++ monotone.texi c78e69ae3bd028c853790a03997ccf6c77c2c830 @@ -2566,6 +2566,7 @@ * Merging:: Merging with external tools, handling binary files. * Migrating and Dumping:: Changing the underlying storage system. * Importing from CVS:: Building a monotone database from a CVS repository. +* Using packets:: Transferring data ``by hand''. @end menu @@ -3366,7 +3367,189 @@ @end group @end smallexample address@hidden address@hidden Using packets address@hidden Using packets +This is a tutorial on how to transfer single revisions between +databases by dumping them from one database to a text file and then +reading the dump in a second database. + +We will create two databases, A and B, then create a few revisions in +A, and transfer part of them to B. + +First we initialize the databases: + address@hidden address@hidden +$ mtn -d A db init +$ mtn -d B db init address@hidden group address@hidden smallexample + +Now set up a branch in A: + address@hidden address@hidden +$ mtn -d A setup -b test test address@hidden group address@hidden smallexample + +And let's put some revisions in that branch: + address@hidden address@hidden +$ cd test/ +$ cat > file +xyz +^D +$ mtn add file +$ mtn ci -m "One" @i{You may need to select a key and type a passphrase here} +$ cat > file2 +file 2 getting in +^D +$ cat > file +ERASE +^D +$ mtn add file2 +$ mtn ci -m "Two" +$ cat > file +THIRD +^D +$ mtn ci -m "Three" address@hidden group address@hidden smallexample + +OK, that's enough. Let's see what we have: + address@hidden address@hidden +$ cd .. +$ mtn -d A automate select i: | mtn -d A automate toposort address@hidden +a423db0ad651c74e41ab2529eca6f17513ccf714 +d14e89582ad9030e1eb62f563c8721be02ca0b65 +151f1fb125f19ebe11eb8bfe3a5798fcbea4e736 address@hidden group address@hidden smallexample + +Three revisions! Let's transfer the first one to the database B. First we +get the meta-information on that revision: + address@hidden address@hidden +$ mtn -d A automate get_revision a423db0ad651c74e41ab2529eca6f17513ccf714 +format_version "1" + +new_manifest [b6dbdbbe0e7f41e44d9b72f9fe29b1f1a4f47f18] + +old_revision [] + +add_dir "" + +add_file "file" + content [8714e0ef31edb00e33683f575274379955b3526c] address@hidden group address@hidden smallexample + +OK, one file was added in this revision. We'll transfer it. Now, @emph{ORDER MATTERS}! +We should transfer: + address@hidden address@hidden The file data (fdata) and file deltas (fdeltas), if any address@hidden The release data (rdata) address@hidden The certs address@hidden enumerate + +In that order. This is because certs make reference to release data, and release data +makes reference to file data and file deltas. + address@hidden address@hidden +mtn -d A automate packet_for_fdata 8714e0ef31edb00e33683f575274379955b3526c > PACKETS +mtn -d A automate packet_for_rdata a423db0ad651c74e41ab2529eca6f17513ccf714 >> PACKETS +mtn -d A automate packets_for_certs a423db0ad651c74e41ab2529eca6f17513ccf714 >> PACKETS +mtn -d B read < PACKETS address@hidden group address@hidden smallexample + +This revision (a423db0ad651c74e41ab2529eca6f17513ccf714) was already sent to database +B. You may want to check the PACKETS file to see what the packets look like. + +Now let's transfer one more revision: + address@hidden address@hidden +mtn -d A automate get_revision d14e89582ad9030e1eb62f563c8721be02ca0b65 +format_version "1" + +new_manifest [48a03530005d46ed9c31c8f83ad96c4fa22b8b28] + +old_revision [a423db0ad651c74e41ab2529eca6f17513ccf714] + +add_file "file2" + content [d2178687226560032947c1deacb39d16a16ea5c6] + +patch "file" + from [8714e0ef31edb00e33683f575274379955b3526c] + to [8b52d96d4fab6c1e56d6364b0a2673f4111b228e] address@hidden group address@hidden smallexample + +From what we see, in this revision we have one new file and one patch, so we do the +same we did before for them: + address@hidden address@hidden +mtn -d A automate packet_for_fdata d2178687226560032947c1deacb39d16a16ea5c6 > PACKETS2 +mtn -d A automate packet_for_fdelta 8714e0ef31edb00e33683f575274379955b3526c 8b52d96d4fab6c1e56d6364b0a2673f4111b228e >> PACKETS2 +mtn -d A automate packet_for_rdata d14e89582ad9030e1eb62f563c8721be02ca0b65 >> PACKETS2 +mtn -d A automate packets_for_certs d14e89582ad9030e1eb62f563c8721be02ca0b65 >> PACKETS2 +mtn -d B read < PACKETS2 address@hidden group address@hidden smallexample + +Fine. The two revisions should be in the second database now. +Let's take a look at what's in each database: + address@hidden address@hidden +$ mtn -d A automate select i: | mtn -d A automate toposort address@hidden +a423db0ad651c74e41ab2529eca6f17513ccf714 +d14e89582ad9030e1eb62f563c8721be02ca0b65 +151f1fb125f19ebe11eb8bfe3a5798fcbea4e736 + +$ mtn -d B automate select i: | mtn -d B automate toposort address@hidden +a423db0ad651c74e41ab2529eca6f17513ccf714 +d14e89582ad9030e1eb62f563c8721be02ca0b65 address@hidden group address@hidden smallexample + +Good! B has the two first revisions (as expected), and A has all three. However, a checkout +of that branch on B will not work, because the certificate signatures cannot be verified. +We need to transfer the signatures too (suppose the key used had the ID @code{"johndoe@@domain.com"}): + address@hidden address@hidden +mtn -d A pubkey johndoe@@domain.com > KEY_PACKETS +mtn -d B read < KEY_PACKETS address@hidden group address@hidden smallexample + +Done. + address@hidden address@hidden +$ mtn -d B co -b test test-B +$ ls test-B +file2 _MTN x +more test-B/file2 +file 2 getting in address@hidden group address@hidden smallexample + +And that's it! The revisions were successfully transfered. + + @page @node CVS Phrasebook @chapter CVS Phrasebook