Repo instructions

De Stoq Wiki
Ir para: navegação, pesquisa

Initial configuration

repo is a tool built on top of git, and was developed by google to make it easier to work with multiple git projects (primarily for the android project). It's by far the simplest way for working with stoq.

First, make sure to download repo following these instructions.

Then you can create your checkout by running:

repo init -u ssh://

At the first time running this, it will create all the stoq's repo infrastructure and put you in a virtual shell on base directory (the one you choose on setup) path and having a subdirectory in it for each project stoq uses (i.e. stoq, stoqdrivers and kiwi). Every time you need to update the projects sources you just need to execute this inside stoq's shell:

repo sync

To initialize and update all of the projects submodules, you can do that easily with repo:

repo forall -c git submodule init
repo forall -c git submodule update

Setting up the environment

To be able to run Stoq in your development tree, you need to set PATH and PYTHONPATH variables. We have a script that will do that for you. You can run it with:

source stoq/utils/

To leave the Stoq environment and restore the original PATH/PYTHONPATH, just run:


Adding extra repositories

If you need to add more projects than the already present on the manifest, you can do that by first creating a local_manifests directory inside the .repo directory:

mkdir .repo/local_manifests

Then create a xml file inside it (for example, local.xml). For example, lets add a new manifest to add a ssh remote to gerrit, track the project stoq-utils and an example project foo and a project bar fixed at a given revision. Replace <username> by your username on gerrit:

<?xml version="1.0" encoding="UTF-8"?>
  <remote name="origin-private"
          review="" />
  <project path="stoq-utils" name="stoq-utils" />
  <project path="foo" name="foo" remote="origin-private" />
  <project path="bar" name="bar" remote="origin-private" revision="<commit_sha1>" />

Working with repo

To create a new branch for working on a feature you can run:

repo start <branch_name> --all

The --all is to create for all projects. But you can specify just just one or n projects instead. Then, to checkout to that branch you just need to do:

repo checkout <branch_name>

To see a list of branchs you have on repo, just run:

repo branches

It will show you the list of branchs and which projects are on each one.

You can see the diff of all projects in your working tree with:

repo diff

And even grep all the files in all the projects with:

repo grep <expr to grep for>

If you want to send your contributions to gerrit, just run:

repo upload

You can see more information about commands here: