language: python

cache:
  - pip
  - ccache

install:
  - test -z "$HG_VERSION" && HG_VERSION=3.0 || true
  - if [ "$HG_VERSION" != "dev" ];
    then pip install -q Mercurial${HG_VERSION+==$HG_VERSION};
    else pip install -q http://selenic.com/repo/hg/archive/tip.tar.gz;
    fi
  - pip install -q --allow-external bzr --allow-unverified bzr bzr${BZR_VERSION+==$BZR_VERSION} || true
  - pip install -q dulwich hg-git==0.6.1 || true

before_script:
  - hg --version || true
  - bzr --version || true
  - pip show hg-git dulwich
  - export PYTHON_PATH="$(which python)"
  - test -z "$TEST" -a -n "$BZR_VERSION" && TEST='bzr-test' || true
  - test -z "$TEST" -a -n "$HG_VERSION" && TEST='hg-test' || true
  - test -z "$TEST" -a -z "$HG_VERSION" -a -z "$BZR_VERSION" && TEST='hg-test bzr-test' || true
  - make -j2

script:
  - make -C t ${TEST:-all}

matrix:
  include:
    - env: TEST=all
    - env: BZR_VERSION=2.6.0
    - env: BZR_VERSION=2.5.1
    - env: BZR_VERSION=2.2.3
    - env: HG_VERSION=2.9.1
    - env: HG_VERSION=2.8.2
    - env: HG_VERSION=2.7.2
    - env: HG_VERSION=3.0
    - env: HG_VERSION=3.5.2
    - env: HG_VERSION=3.6.3
    - env: HG_VERSION=3.7
    - python: 2.7
    - python: 2.6
