monotone-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Monotone-devel] Packet I/O howto


From: Jeronimo Pellegrini
Subject: [Monotone-devel] Packet I/O howto
Date: Fri, 21 Apr 2006 23:01:56 -0300
User-agent: Mutt/1.5.11+cvs20060403

Hi.

I have been playing with packet I/O, and found that the documentation
gives commands for packet transfering, it doesn't say what exactly (and
in what order) I should do to transfer revisions between databases. I
found out, and thought I'd write this mini-howto for Monotone 0.26. I
hope it's useful.

Also, if I may add something to the wishlist... Maybe it would be nice
to have one single command for getting all packets from one revision?
Something like:

mtn automate packets_for_revision ID

That would be great!

Thanks,
J.




=========================================

Packet I/O mini-howto.

==========================================

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:

/--------------------------
$ mtn -d A db init
$ mtn -d B db init
\--------------------------

Now set up a branch in A:

/--------------------------
$ mtn -d A setup -b test test
\--------------------------

And let's put some revisions in that branch:

/-------------------------
$ cd test/
$ cat > file
xyz
^D
$ mtn add file
$ mtn ci -m "One"
$ 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"
\--------------------------

OK, that's enough Let's see what we have:

/--------------------------
$ cd ..
$ mtn -d A automate graph|awk '{print $1;}'|xargs -- mtn -d A automate toposort
$ mtn -d A automate get_revision a423db0ad651c74e41ab2529eca6f17513ccf714
format_version "1"

new_manifest [b6dbdbbe0e7f41e44d9b72f9fe29b1f1a4f47f18]

old_revision []

add_dir ""

add_file "file"
 content [8714e0ef31edb00e33683f575274379955b3526c]
\--------------------------

OK, one file was added in this revision. Will transfer it. Now, ORDER MATTERS!
We should transfer:

1. The fdata and fdeltas, if any
2. The rdata
3. The certs

In that order. This is because certs make reference to release data, and 
release data
makes reference to file data and file deltas.

/--------------------------
mtn -d A automate packet_for_fdata 8714e0ef31edb00e33683f575274379955b3526c > GO
mtn -d A automate packet_for_rdata a423db0ad651c74e41ab2529eca6f17513ccf714 >> 
GO
mtn -d A automate packets_for_certs a423db0ad651c74e41ab2529eca6f17513ccf714 >> 
GO
mtn -d B read < GO
\--------------------------

OK, let's transfer one more revision:

/--------------------------
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]
\--------------------------

OK, in this revision one we have one new file and one patch:

/--------------------------
mtn -d A automate packet_for_fdata d2178687226560032947c1deacb39d16a16ea5c6 > 
GO2
mtn -d A automate packet_for_fdelta 8714e0ef31edb00e33683f575274379955b3526c 
8b52d96d4fab6c1e56d6364b0a2673f4111b228e >> GO2
mtn -d A automate packet_for_rdata d14e89582ad9030e1eb62f563c8721be02ca0b65 >> 
GO2
mtn -d A automate packets_for_certs d14e89582ad9030e1eb62f563c8721be02ca0b65 >> 
GO2
mtn -d B read < GO2
\--------------------------

Fine. The two revisions should be on the second database now.
You may want to check the GO* files to see what the packets look like.


/--------------------------
mtn -d A automate graph|awk '{print $1;}'|xargs -- mtn -d A automate toposort
a423db0ad651c74e41ab2529eca6f17513ccf714
d14e89582ad9030e1eb62f563c8721be02ca0b65
151f1fb125f19ebe11eb8bfe3a5798fcbea4e736

mtn -d B automate graph|ate graph|awk '{print $1;}'|xargs -- mtn -d B automate 
toposort
a423db0ad651c74e41ab2529eca6f17513ccf714
d14e89582ad9030e1eb62f563c8721be02ca0b65
\--------------------------

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 
"address@hidden"):

/--------------------------
mtn -d A pubkey address@hidden > GO4
mtn -d B read < GO4
\--------------------------

Done.

/--------------------------
$ mtn -d B  mtn -d B co -b test test-B
$ ls test-B
file2  _MTN  x
more test-B/file2
file 2 getting in
\--------------------------

And that's it! The revisions were successfully transfered.

====================================




reply via email to

[Prev in Thread] Current Thread [Next in Thread]