Stoq plugin for git

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

The stoq plugin for git will prepare the environment and provides some commands to make it easier to work with stoq development.

Installation

After you have installed git, you can run this command to install the plugin (make sure you have a ~/bin/ directory and it's on your PATH):

wget https://raw.github.com/stoq/git-stoq/master/git-stoq -O ~/bin/git-stoq && chmod +x ~/bin/git-stoq

After this command finishes, you should have the plugin working. You can test it with:

git stoq --help

And you should see some help for the new stoq command.

It may also be necessary to update the plugin from time to time. To do this, run the installation command again.

First time configuration

Before you start using the plugin features, you first need to configure it. Run this command:

git stoq --setup

You will be prompted to enter a base directory for development. This is where the plugin will create the trees for stoq. Default is ~/devel

We are almost ready to start working on stoq.

Working with repo

NOTE: This information is deprecated. Instructions are now in Repo instructions.


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.

All you need to do it execute:

git stoq --repo

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 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.

Using git-stoq like bzr-stoq

This script was first written to make it easier for people using Stoq plugin for bzr to have a similar workflow. Unlike repo, the base directory will contain subdirectories for each tree you create, and each of these trees will have it's own projects subdirectories (just like you would do with bzr):

To create a new tree, you just need to run:

git stoq --init <tree_name>

Then, to checkout to that tree you just need to do:

git stoq <tree_name>

Before checking out, if you need to list all the trees you have (and thus, you can checkout to), just:

git stoq --list

And to update a tree, do:

git stoq --update <tree_name>

Showing TREE_NAME on PS1

If you want to display the current tree of Stoq, include $STOQ_BRANCH in your PS1, for example:

export PS1='[$(echo $STOQ_BRANCH)]\u@$ENVNAME$(__git_ps1 "(%s)"):\w\$ '