Next: Committing Work, Previous: Starting a New Project, Up: Tutorial [Contents][Index]
Next Jim decides to add some files to the project. He writes up a file containing the prototypes for the JuiceBot 7:
$ mkdir include $ cat >include/jb.h /* Standard JuiceBot hw interface */ #define FLOW_JUICE 0x1 #define POLL_JUICE 0x2 int spoutctl(int port, int cmd, void *x); /* JuiceBot 7 API */ #define APPLE_SPOUT 0x7e #define BANANA_SPOUT 0x7f void dispense_apple_juice (); void dispense_banana_juice (); ^D
Then adds a couple skeleton source files which he wants Abe and Beth to fill in:
$ mkdir src $ cat >src/apple.c #include "jb.h" void dispense_apple_juice() { /* Fill this in please, Abe. */ } ^D $ cat >src/banana.c #include "jb.h" void dispense_banana_juice() { /* Fill this in please, Beth. */ } ^D
Now Jim tells monotone to add these files to its record of his workspace. He specifies one filename and one directory; monotone recursively scans the directory and adds all its files.
$ mtn add -R include/jb.h src mtn: adding include/jb.h to workspace manifest mtn: adding src/apple.c to workspace manifest mtn: adding src/banana.c to workspace manifest
This command produces a record of Jim’s intentions in a special file called _MTN/revision, stored in the workspace. The file is plain text:
$ cat _MTN/revision format_version "1" new_manifest [0000000000000000000000000000000000000002] old_revision [] add_dir "" add_dir "include" add_dir "src" add_file "include/jb.h" content [f6996ce2dfc5d32bda8b574c3e9ce75db8d55492] add_file "src/apple.c" content [1ce885d2cc59842ff16785834391e864068fbc3c] add_file "src/banana.c" content [ad88bbbb1b7507ddff26be67efd91d95e069afb6]
You will never have to look at this file, but it is nice to know that it is there.
Jim then gets up from his machine to get a coffee. When he returns he has forgotten what he was doing. He asks monotone:
$ mtn status ---------------------------------------------------------------------- Revision: 493bda86628fd72c992eb56f73899db9ead3cf6f Author: jim@juicebot.co.jp Date: 2004-10-26T02:53:08 Branch: jp.co.juicebot.jb7 Changes added added include added src added include/jb.h added src/apple.c added src/banana.c
The output of this command tells Jim that his edits, so far, constitute only the addition of some files and directories.
Jim wants to see the actual details of the files he added, however, so he runs a command which prints out the revision and a GNU “unified diff” of the patches involved in the changeset:
$ mtn diff # # old_revision [] # # add_dir "" # # add_dir "include" # # add_dir "src" # # add_file "include/jb.h" # content [f6996ce2dfc5d32bda8b574c3e9ce75db8d55492] # # add_file "src/apple.c" # content [1ce885d2cc59842ff16785834391e864068fbc3c] # # add_file "src/banana.c" # content [ad88bbbb1b7507ddff26be67efd91d95e069afb6] # ============================================================ --- include/jb.h f6996ce2dfc5d32bda8b574c3e9ce75db8d55492 +++ include/jb.h f6996ce2dfc5d32bda8b574c3e9ce75db8d55492 @ -0,0 +1,13 @ +/* Standard JuiceBot hw interface */ + +#define FLOW_JUICE 0x1 +#define POLL_JUICE 0x2 +#define SET_INTR 0x3 +int spoutctl(int port, int cmd, void *x); + +/* JuiceBot 7 API */ + +#define APPLE_SPOUT 0x7e +#define BANANA_SPOUT 0x7f +void dispense_apple_juice (); +void dispense_banana_juice (); ============================================================ --- src/apple.c 1ce885d2cc59842ff16785834391e864068fbc3c +++ src/apple.c 1ce885d2cc59842ff16785834391e864068fbc3c @ -0,0 +1,7 @ +#include "jb.h" + +void +dispense_apple_juice() +{ + /* Fill this in please, Abe. */ +} ============================================================ --- src/banana.c ad88bbbb1b7507ddff26be67efd91d95e069afb6 +++ src/banana.c ad88bbbb1b7507ddff26be67efd91d95e069afb6 @ -0,0 +1,7 @ +#include "jb.h" + +void +dispense_banana_juice() +{ + /* Fill this in please, Beth. */ +}
Next: Committing Work, Previous: Starting a New Project, Up: Tutorial [Contents][Index]