monotone crash course
First time actions
Initialise database
mtn --db=YOUR_DATABASE db init
Pull the repository
mtn --db=YOUR_DATABASE pull ADDRESS[:PORT] BRANCH
Check out the source
mtn --db=YOUR_DATABASE --branch=BRANCH co WORK_DIRECTORY
Every day actions
When standing in the working directory, the database is recorded in MT/options, and the database itself contains data about the default server and collection to use (this got initialised by the first monotone pull), so further updates are done like this:
mtn pull
mtn update
Commit and push (write to server) access
All writes are signed. This includes any commit to your own database and pushing the changes in your database to any server. To be able to do that, you need to do two things:
- create a key pair.
- send your public key to the owner of the server you want to push your changes to.
Create a key pair
Creating a key pair requires a bit of forethought. You have to keep in mind that key identifiers are considered to be globally unique, and it's up to you to make sure they are. The easiest way is to use you email address or a derivative thereof.
If you want to have different keys for different projects, and idea is to use key identifiers like this: your.mail+project@address.com. In that case, you can jump down to the section about creating keys.
OK, so you want to create a new key pair
If you have determined that you don't have a key pair associated with your chosen identifier, you simply ask monotone to generate a new key for you, like this:
mtn --db=YOUR_DATABASE \ genkey your.mail@address.com
or, if you choose to have different key pairs for different projects:
mtn --db=YOUR_DATABASE \ genkey your.mail+project@address.com
Send me your public key
If you want to have push access to my server, you need to send me your public key. All you need to do is run the following command and send me the output:
mtn --db=YOUR_DATABASE \ pubkey your.mail@address.com
or, if you choose to have different key pairs for different projects:
mtn --db=YOUR_DATABASE \ pubkey your.mail+project@address.com
Every day actions with write access
When you have write access, these are practical operations.
Add a file
mtn add FILE
Drop (delete) a file
For monotone version 0.33 and lower, you delete a file like this:
mtn drop -e FILE
Monotone version 0.34 and up will automatically delete the file physically for you, so the command is simpler:
mtn drop FILE
Rename a file
For monotone version 0.33 and lower, you rename a file like this:
mtn rename -e OLDFILE NEWFILE
Monotone version 0.34 and up will automatically rename the file physically for you, so the command is simpler:
mtn rename OLDFILE NEWFILE
Check the status of currently known files
This variant only shows which files have changed, been added, deleted or renamed. This differs from cvs status, which shows the status of unknown files.
mtn status
Check the status of all file in the directory tree
mtn automate inventory
Commit all your changes
mtn commit [--message="message"]
Commit only selected files
mtn commit [--message="message"] FILE1 FILE2 ...
Send your changes to the server you pulled from
mtn push