Monotone — distributed version control system, using same concepts like other distributed VCS, like GNU Arch, Darcs and other. Work with Monotone from Emacs implemented by monotone.el package, that come together with Monotone distribution. There is also support for Monotone in DVC package, that described in the section Work with DVC.

Installation of monotone.el

You can find monotone.el in Monotone's distribution. It located in contrib directory of distribution. This package was tested with GNU Emacs 22.1, but it should works with other Emacs's versions. To work with it you need to place file to location, where Emacs find it, and add following commands to initialization file:

(require 'monotone)
(monotone-set-vc-prefix-key "\C-xv")
(setq monotone-passwd-remember t)

First line of code loads package, second sets prefix for key bindings, and third — force package to remember passwords entered by user1

Work with package

Commands, implemented by package, are accessible via menu, key bindings and by their direct call via M-x (all implemented commands have prefix monotone). By default prefix for key bindings is not defined, so you need to set it during package initialization. This could be done with monotone-set-vc-prefix-key function, and in the example above, it set to C-x v, and in the text below, this prefix always will used. All commands are executed in the buffer called *monotone*.

Registration of file in repository is performed with monotone-vc-register command (C-x v i). You can commit changes with monotone-vc-commit command, that bound to C-x v q or C-x v C-q.

Work with remote repositories is performed with following commands: the monotone-pull command (C-x v p) — fetches changes from server, the monotone-push command (C-x v P) — push changes to server, and the monotone-sync command sync current repository with remote one.

User can obtain list changes for file with monotone-vc-diff command, that bound to C-x v =. If you pass a numerical argument to this command, then changes will shown for repository, instead of single file.

There are several commands to retrieve information about registered objects. The main command is monotone-vc-status (C-x v s), that outputs information about current branch. With the monotone-vc-print-log command (C-x v l) you can obtain log for current file (and if you give a numerical argument, then log will obtained for whole project). You can also retrieve identifier of current object with monotone-grab-id command (C-x v 6) — this command stores object's identifier in the kill ring, from which you can paste with standard Emacs commands (for example, with C-y).

There is also one general purpose command — monotone (it bound to C-x v x), that allows to execute any command of Monotone, entered in the mini-buffer.

Customization of package

You can customize package by setting some variables. One of these variables, we already used — the monotone-passwd-remember variable, that caches passwords, entered by user. If this variable has non-nil value, then all passwords will be stored in monotone-passwd-alist variable. There is also monotone-program variable, that keeps name of the Monotone's executable.

Address and remote server, and names of collections user can set in monotone-server and monotone-collection variables. Already used servers and collections are stored in monotone-server-hist and monotone-collection-hist variables.

There are also other variables, that are usually not changed by user, but it's better to know what information they keep. If you set value of monotone-cmd-show variable to t, then results of execution of Monotone commands will shown. With monotone-program-args-always variable you can set command-line options, that will always passed to Monotone. If variable monotone-msg has non-nil value, then all messages from monotone.el will printed to the *Messages* buffer (this is very useful for debugging).

There are also two hooks, that allow to perform fine-grained customization — monotone-output-mode-hook and monotone-commit-mode-hook. First of them will called, when data will printed, and second, when buffer for entering of commit messages will created.

1. Passwords are stored only for the current sessions, and if you restart Emacs, then package will again ask you about passwords.

Last change: 05.03.2013 16:54

blog comments powered by Disqus