DEPRECATED - DO NOT USE
We have switched to using Mercurial instead of Monotone. See
UsingPidginMercurial for details.
}}}
[[TOC]]
= Using Monotone for Pidgin =
[http://monotone.ca Monotone] is a distributed version control system, and as such has some user-visible differences compared to, say, CVS or SVN. In addition, each of the existing DVCS solutions seem to have idiosyncrasies to themselves, and monotone is no exception. Due to these things, we'll try to grow some monotone howtos and best practices on this page.
== External Documentation ==
* The [http://monotone.ca/docs/Tutorial.html Monotone tutorial] is an excellent place to start, with good examples on using Monotone for day-to-day tasks and some treatment of the workflow differences between a DVCS and a legacy VCS
* The [http://monotone.ca/docs/index.html official manual]
* The [http://www.monotone.ca/wiki/ monotone wiki] has a lot of good information, as well
== Best Practices ==
We are currently drafting a best practices page at MonotoneBestPractices, which will at some point, be merged into this documentation.
== Getting Started with Pidgin monotone ==
There is a monotone server running on mtn.pidgin.im. Its key fingerprint is {{{42a055d77e641de411e118d121cfc598ec0e7725}}}.
The initial revision history retrieval is quite taxing on the server. In order to make the initial pull more efficient, we provide a snapshot of the mtn database to bootstrap the process. '''This database requires monotone 0.36 or newer.'''
To fetch the revision history from this server, and check out a working copy, do:
{{{
# Set some useful environment variables for the check out.
$ DATABASE=$HOME/monotone_databases/pidgin.mtn
$ WORKINGDIR=$HOME/code/pidgin-mtn
# Download the bootstrap database. For example:
$ cd $(dirname $DATABASE)
$ wget http://developer.pidgin.im/static/pidgin.mtn.bz2
$ bzip2 -d pidgin.mtn.bz2
# Pull from our mtn server to update the database.
# If your version of mtn is older than 0.99:
$ mtn -d $DATABASE pull --set-default mtn.pidgin.im "im.pidgin.*"
# If your version of mtn is 0.99 or newer:
$ mtn -d $DATABASE pull --set-default "mtn://mtn.pidgin.im/pidgin?im.pidgin.*"
# Check out a working copy of our main development branch:
$ mtn -d $DATABASE co -b im.pidgin.pidgin $WORKINGDIR
}}}
If you get this message:
{{{
$ mtn -d $DATABASE pull --set-default mtn.pidgin.im "im.pidgin.*"
mtn: misuse: database /home/user/monotone_databases/pidgin.mtn is laid out according to an old schema
mtn: misuse: try 'mtn db migrate' to upgrade
mtn: misuse: (this is irreversible; you may want to make a backup copy first)
}}}
it means you have to "update" the schema used by the Pidgin MTN database. Do:
{{{
mtn -d $DATABASE db migrate
}}}
... and try again. You will ''have'' to run the migration command if your mtn version is 0.45 or newer. Multiple migrations may be necessary--if this is the case, mtn will automatically do all the work for you.[[BR]]
(The variables here are just to help you understand which parts of the process are up to your personal choice.)
This will create a database for storing your development stuff, fetch the entire revision history available from mtn.pidgin.im to that database, and then check out a working copy of the newest revision of Pidgin in that database. To update the database from the server in the future, you can either a) simply go to {{{$WORKINGDIR}}} and execute {{{mtn pull}}}, or execute {{{mtn -d $DATABASE pull}}} from anywhere. Note that this will pull the new revision ''history'' from the server, but will not update your working directory to reflect the newest available revision. For this, you need to run {{{mtn up}}} in {{{$WORKINGDIR}}}.
Consult the monotone documents, and particularly [http://www.monotone.ca/docs/CVS-Phrasebook.html their CVS phrasebook] to see the things you can now do with your database and working copy. You should find that most of the actions at this point feel pretty familiar.
== Keys and Key Management ==
Monotone uses asymmetric keypairs for various trust and identification tasks. Every certificate created by a developer is signed by a keypair unique to that developer. In practice, this means that every commit to a branch is signed by the developer which made the commit (because the piece of data tying a particular revision to a branch is a certificate).
Therefore, in order to commit revisions, push a revision to most netsync servers, create a certificate, or perform a number of other activities, you will have to have a monotone keypair. To generate a keypair, use {{{mtn genkey $KEYID}}}. Key IDs are normally email addresses, and at this point there is no way to use two keys with the same key ID on the same project (keys are addressed by their ID, not fingerprint etc.). For playing, you might want to generate a throwaway key ID just in case; I recommend that developers' normal pidgin keys be of the form {{{username@pidgin.im}}}. There is nothing which says this must be the case, however, and there is certainly something to be said for using a different key for each physical workstation or administrative domain that one uses.
Once you have created a key, you can generate a public key which can be shared with other developers (for the purpose of establishing trust, giving netsync permission, etc.) with the command {{{mtn pubkey $KEYID}}}. The output of this command can be imported into a monotone database with {{{mtn read < $FILE}}}, and then synced to a remote server by a user who has commit access (even if it has not been used to sign any certificates) with {{{mtn push --key-to-push $KEYID}}}. Note that if a key has been used to sign certificates which are communicated in a netsync transaction, it will be automatically synced along with the revisions; this means that if third-party developers use monotone (which we should encourage!) and we retrieve changes from them via mtn pull, their keys will be automatically installed in the pidgin.im repository at the next developer push of those revisions.
== Branching {{{im.pidgin.pidgin}}} ==
There are two kinds of branches in monotone, which I will call ''macro-'' and ''micro-''branches. We will deal with each in turn.
=== macro-branches ===
A ''macro-branch'' is a set of monotone revisions which have a particular certificate associated with them, identifying them as belonging to the same branch. In our case, the "main" branch of development is {{{im.pidgin.pidgin}}}. All revisions in the monotone database which carry a cert of type {{{branch}}} with the value {{{im.pidgin.pidgin}}} are on this branch. Note that, technically, revisions on such a branch don't have to have any relation to one another -- however, it probably makes sense that they are all descended from some ultimate ancestor revision, and that they are logically related in some fashion. In the case of {{{im.pidgin.pidgin}}}, they form a (presently) linear history taken from the Gaim svn repository.
Branch certificates are a little bit "magic", in that monotone knows about them and changes its behavior based on them. For example, a {{{commit}}}ted revision will inherit the branch certificate of its parent. An {{{update}}} on a workspace will update to the "newest" (DAG-wise; more on this later) revision bearing the same branch tag. The set of revisions to synchronize via netsync is chosen by a branch specification pattern.
==== Creating a new branch ====
Creating a new branch is as easy as committing a revision with a new branch name, or adding a new branch certificate to an existing revision.
To create a new branch from a set of changes in your workspace (that is, commit a revision with a new branch name, supply the {{{-b}}} or {{{--branch}}} argument to {{{monotone commit}}}. In other words:
{{{
mtn ci -b