Next: , Previous: , Up: Tutorial   [Contents][Index]


2.3 Creating a Database

The first step Jim, Abe and Beth each need to perform is to create a new database. This is done with the mtn db init command, providing a --db option to specify the location of the new database. Each programmer creates their own database, which will reside in their home directory and store all the revisions, files and manifests they work on.

In real life, most people prefer to keep one database for each project they work on. If we followed that convention here in the tutorial, though, then all the databases would be called juicebot.mtn, and that would make things more confusing to read. So instead, we’ll have them each name their database after themselves.

Thus Jim issues the command:

$ mtn db init --db=~/jim.mtn

and Abe issues the command:

$ mtn db init --db=~/abe.mtn

Beth decides to use monotone’s built-in database management functionality. monotone then expects to find managed database files in a list of directories (default $HOME/.monotone/databases on Unix and %APPDATA%\monotone\databases on Windows, see Managed Databases for more info) and acts upon those by knowing only their file or basename.

To create a new managed database, Beth issues the mtn db init command like this:

$ mtn db init --db=:beth

Beth can distinguish a managed database name from an unmanaged one by the leading colon in its name. This special alias can now be used interchangeably in every monotone invocation. If Beth wants to see where monotone actually created the database and what other databases monotone knows of, she uses the mtn list databases command (or mtn ls dbs) for that. We’ll come back to this in a bit.


Next: , Previous: , Up: Tutorial   [Contents][Index]

Quick Links:     www.monotone.ca    -     Downloads    -     Documentation    -     Wiki    -     Code Forge    -     Build Status