view tests/test-branch.py @ 102:cc2b7540fa2b 0.2

tests: don't set the time zone There seems to be no need and it misbehaves on Windows.
author Idan Kamara <idankk86@gmail.com>
date Wed, 18 Jan 2012 00:39:25 +0200
parents f1af31960414
children 1b47146a4a2c
line wrap: on
line source

import common
import hglib

class test_branch(common.basetest):
    def test_empty(self):
        self.assertEquals(self.client.branch(), 'default')

    def test_basic(self):
        self.assertEquals(self.client.branch('foo'), 'foo')
        self.append('a', 'a')
        rev, node = self.client.commit('first', addremove=True)

        rev = self.client.log(node)[0]

        self.assertEquals(rev.branch, 'foo')
        self.assertEquals(self.client.branches(),
                          [(rev.branch, int(rev.rev), rev.node[:12])])

    def test_reset_with_name(self):
        self.assertRaises(ValueError, self.client.branch, 'foo', clean=True)

    def test_reset(self):
        self.client.branch('foo')
        self.assertEquals(self.client.branch(clean=True), 'default')

    def test_exists(self):
        self.append('a', 'a')
        self.client.commit('first', addremove=True)
        self.client.branch('foo')
        self.append('a', 'a')
        self.client.commit('second')
        self.assertRaises(hglib.error.CommandError, self.client.branch, 'default')

    def test_force(self):
        self.append('a', 'a')
        self.client.commit('first', addremove=True)
        self.client.branch('foo')
        self.append('a', 'a')
        self.client.commit('second')

        self.assertRaises(hglib.error.CommandError, self.client.branch, 'default')
        self.assertEquals(self.client.branch('default', force=True), 'default')