Skip to content
Christian Dietrich edited this page Sep 27, 2010 · 3 revisions

Configuration of metagit

You must put all your metagit configuration, which is essentially the definition of several Repositories into ~/.metagitrc. This file is a python script which is sourced by metagit, so you can use the full power of python, while configurating metagit. For an example of an working configuration you might have a look at metagitrc-example in the Repository. In order to make it usable with metagit every metagitrc must load the modules with the essential classes like this:

#!/usr/bin/env python

# Import everything from the work module
from gmp import *

After this you start directly defining several (or just one if you like) repository lists (also called set in the config), which are simply python lists with instances of the Repository class, which names ends with _repos. For example would be hub_repos name the list hub. The easiest example of a repo list definition whould a definition of a list with just one Repository:

remote_repos = [ Repository("example.com:remote", "~/local_clone") ]

Some useful python list functions are .append, which takes an elements and appends it to the list, and .extend, which concatenates argument list with the current one.

There is also the possibility to define your own commands in your configuration, just append the three lines to your metagitrc and test them:

manager.register_shortcut("log")
def barfoo(repo):
    print repo
manager.register_command("barfoo", barfoo)

If you want to proceed, just might be interested in Defining Repositories

Clone this wiki locally