Abe decides to do some work on his part of the code. He has a copy of
Jim's database contents, but cannot edit any of that data yet. He
begins his editing by checking out the head of the
jp.co.juicebot.jb7
branch into a working copy, so he can edit
it:
$ monotone --db=abe.db --branch=jp.co.juicebot.jb7 checkout .
Monotone unpacks the set of files in the head revision's manifest directly into Abe's current directory. (If he had specified something other than . at the end, monotone would have created that directory and unpacked the files into it.) Abe then opens up one of the files, src/apple.c, and edits it:
$ vi src/apple.c <Abe writes some apple-juice dispensing code>
The file src/apple.c has now been changed. Abe gets up to answer a phone call, and when he returns to his work he has forgotten what he changed. He can ask monotone for details:
$ monotone diff # # patch "src/apple.c" # from [2650ffc660dd00a08b659b883b65a060cac7e560] # to [e2c418703c863eabe70f9bde988765406f885fd0] # --- src/apple.c +++ src/apple.c @ -1,7 +1,10 @ #include "jb.h" void dispense_apple_juice() { - /* Fill this in please, Abe. */ + spoutctl(APPLE_SPOUT, FLOW_JUICE, 1); + while (spoutctl(APPLE_SPOUT, POLL_JUICE, 1) == 0) + usleep (1000); + spoutctl(APPLE_SPOUT, FLOW_JUICE, 0); }
Satisfied with his day's work, Abe decides to commit.
$ monotone commit monotone: beginning commit monotone: manifest b33cb337dccf21d6673f462d677a6010b60699d1 monotone: revision 70decb4b31a8227a629c0e364495286c5c75f979 monotone: branch jp.co.juicebot.jb7
Abe neglected to provide a --message option specifying the change log on the command line. Monotone therefore invokes an external “log message editor” — typically an editor like vi — with an explanation of the changes being committed and the opportunity to enter a log message.
polling implementation of src/apple.c MT: MT: ---------------------------------------------------------------------- MT: Enter Log. Lines beginning with `MT:' are removed automatically MT: MT: new_manifest [b33cb337dccf21d6673f462d677a6010b60699d1] MT: MT: old_revision [2e24d49a48adf9acf3a1b6391a080008cbef9c21] MT: old_manifest [2098eddbe833046174de28172a813150a6cbda7b] MT: MT: patch "src/apple.c" MT: from [2650ffc660dd00a08b659b883b65a060cac7e560] MT: to [e2c418703c863eabe70f9bde988765406f885fd0] MT: MT: ---------------------------------------------------------------------- MT:
Abe enters a single line above the explanatory message, saying “polling implementation of src/apple.c”. He then saves the file and quits the editor. Monotone deletes all the lines beginning with “MT:” and leaves only Abe's short message. Returning to the shell, Abe's commit completes:
monotone: committed revision 70decb4b31a8227a629c0e364495286c5c75f979
Abe then sends his new revision back to Jim:
$ monotone sync jim-laptop.juicebot.co.jp jp.co.juicebot.jb7 monotone: rebuilding merkle trees for collection jp.co.juicebot.jb7 monotone: including branch jp.co.juicebot.jb7 monotone: [keys: 2] [rcerts: 8] monotone: connecting to jim-laptop.juicebot.co.jp monotone: [bytes in: 630] [bytes out: 2844] monotone: successful exchange with jim-laptop.juicebot.co.jp
Beth does a similar sequence. First she syncs her database with Jim's:
monotone --db=beth.db sync jim-laptop.juicebot.co.jp jp.co.juicebot.jb7 monotone: rebuilding merkle trees for collection jp.co.juicebot.jb7 monotone: connecting to jim-laptop.juicebot.co.jp monotone: [bytes in: 3200] [bytes out: 673] monotone: successful exchange with jim-laptop.juicebot.co.jp
She checks out a copy of the tree from her database:
$ monotone --db=beth.db --branch=jp.co.juicebot.jb7 checkout .
She edits the file src/banana.c:
$ vi src/banana.c <Beth writes some banana-juice dispensing code>
She commits her work:
$ monotone commit --message='polling implementation of src/banana.c' monotone: beginning commit monotone: manifest eaebc3c558d9e30db6616ef543595a5a64cc6d5f monotone: revision 80ef9c9d251d39074d37e72abf4897e0bbae1cfb monotone: branch jp.co.juicebot.jb7 monotone: committed revision 80ef9c9d251d39074d37e72abf4897e0bbae1cfb
And she syncs with Jim again:
$ monotone sync jim-laptop.juicebot.co.jp jp.co.juicebot.jb7 monotone: rebuilding merkle trees for collection jp.co.juicebot.jb7 monotone: including branch jp.co.juicebot.jb7 monotone: [keys: 3] [rcerts: 12] monotone: connecting to jim-laptop.juicebot.co.jp monotone: [bytes in: 630] [bytes out: 2844] monotone: successful exchange with jim-laptop.juicebot.co.jp