comparison tests/test-branch.py @ 11:0549d00a617d

client: add missing options to branch() and add some more tests
author Idan Kamara <idankk86@gmail.com>
date Wed, 10 Aug 2011 00:21:05 +0300
parents eac8be119d81
children c2a9b716cd80
comparison
equal deleted inserted replaced
10:fce3102c19e5 11:0549d00a617d
1 import common 1 import common
2 import hglib 2 import hglib
3 3
4 class test_branch(common.basetest): 4 class test_branch(common.basetest):
5 def test_empty(self):
6 self.assertEquals(self.client.branch(), 'default')
7
5 def test_basic(self): 8 def test_basic(self):
6 self.assertEquals(self.client.branch(), 'default') 9 self.assertEquals(self.client.branch('foo'), 'foo')
7 self.append('a', 'a') 10 self.append('a', 'a')
8 rev = self.client.commit('first', addremove=True) 11 rev = self.client.commit('first', addremove=True)
9 branches = self.client.branches()
10 12
11 self.assertEquals(rev, branches[rev.branch]) 13 self.assertEquals(rev.branch, 'foo')
14 self.assertEquals(self.client.branches()[rev.branch], rev)
15
16 def test_reset_with_name(self):
17 self.assertRaises(ValueError, self.client.branch, 'foo', clean=True)
18
19 def test_reset(self):
20 self.client.branch('foo')
21 self.assertEquals(self.client.branch(clean=True), 'default')
22
23 def test_exists(self):
24 self.append('a', 'a')
25 self.client.commit('first', addremove=True)
26 self.client.branch('foo')
27 self.append('a', 'a')
28 self.client.commit('second')
29 self.assertRaises(hglib.error.CommandError, self.client.branch, 'default')
30
31 def test_force(self):
32 self.append('a', 'a')
33 self.client.commit('first', addremove=True)
34 self.client.branch('foo')
35 self.append('a', 'a')
36 self.client.commit('second')
37
38 self.assertRaises(hglib.error.CommandError, self.client.branch, 'default')
39 self.assertEquals(self.client.branch('default', force=True), 'default')