This week, I have learned how to run tests on Pony-build using the nosetests script. I had to download the nose package and make sure that the nosetests is added to the path in the environment variables. Running tests then become as easy as typing “nosetests” once in the right directory or “nosetests + name of the test file” to run that specific test.
My objective this week, was to write a test for branches other than default.
When cloning a repository in mercurial, the working directory is updated to the tip, which is the most recent changeset /commit in the repo. So it actually doesn’t matter in which branch we currently are , since the clone will happen in the branch, committed to last.
Hg identify prints a summary of the current state of the repository
C:\Users\Fatima\pony-build-hg-test>hg identify
1d4537588c4c (extrabranch) tip
Switched to the default branch
C:\Users\Fatima\pony-build-hg-test>hg update default
resolving manifests
removing test3.txt
removing test4.py
getting test1
1 files updated, 0 files merged, 2 files removed, 0 files unresolv
C:\Users\Fatima\pony-build-hg-test>hg identify
949a4d660f2e
Hg tip to show the most recent changeset in the repository. We are still in the Default branch:
C:\Users\Fatima\pony-build-hg-test>hg tip
changeset: 7:1d4537588c4c
branch: extrabranch
tag: tip
user: Fatima Cherkaoui
date: Mon Mar 15 18:52:04 2010 -0500
files: test1
description:
test1
“Hg Clone” clones all branches automatically and points to the default branch.
C:\Users\Fatima\pony-build-hg-test>cd pony-build-hg-test
C:\Users\Fatima\pony-build-hg-test\pony-build-hg-test>ls
test1 test2
C:\Users\Fatima\pony-build-hg-test\pony-build-hg-test>hg branch
default
C:\Users\Fatima\pony-build-hg-test\pony-build-hg-test>hg branches
extrabranch 7:1d4537588c4c
default 2:949a4d660f2e (inactive)
So if we are in branch other than default we can:
—>clone then update to that branch: hg clone and hg update branchname
—> clone directly to the branch and/or revision : hg clone -r branchname
C:\Users\Fatima\pony-build-hg-test>hg clone http://bitbucket.org/cherkf/pony-bu
ld-hg-test/ -r extrabranch
destination directory: pony-build-hg-test
requesting all changes
adding changesets
adding manifests
adding file changes
added 8 changesets with 7 changes to 4 files
updating to branch extrabranch
4 files updated, 0 files merged, 0 files removed, 0 files unresolved
C:\Users\Fatima\pony-build-hg-test>cd pony-build-hg-test
C:\Users\Fatima\pony-build-hg-test\pony-build-hg-test>hg branch
extrabranch
C:\Users\Fatima\pony-build-hg-test\pony-build-hg-test>hg branches
extrabranch 7:1d4537588c4c
default 2:949a4d660f2e (inactive)