annotate 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
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
7
eac8be119d81 tests: rearrange tests and use nosetests
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
1 import common
eac8be119d81 tests: rearrange tests and use nosetests
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
2 import hglib
eac8be119d81 tests: rearrange tests and use nosetests
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
3
eac8be119d81 tests: rearrange tests and use nosetests
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
4 class test_branch(common.basetest):
11
0549d00a617d client: add missing options to branch()
Idan Kamara <idankk86@gmail.com>
parents: 7
diff changeset
5 def test_empty(self):
0549d00a617d client: add missing options to branch()
Idan Kamara <idankk86@gmail.com>
parents: 7
diff changeset
6 self.assertEquals(self.client.branch(), 'default')
0549d00a617d client: add missing options to branch()
Idan Kamara <idankk86@gmail.com>
parents: 7
diff changeset
7
7
eac8be119d81 tests: rearrange tests and use nosetests
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
8 def test_basic(self):
11
0549d00a617d client: add missing options to branch()
Idan Kamara <idankk86@gmail.com>
parents: 7
diff changeset
9 self.assertEquals(self.client.branch('foo'), 'foo')
7
eac8be119d81 tests: rearrange tests and use nosetests
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
10 self.append('a', 'a')
eac8be119d81 tests: rearrange tests and use nosetests
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
11 rev = self.client.commit('first', addremove=True)
11
0549d00a617d client: add missing options to branch()
Idan Kamara <idankk86@gmail.com>
parents: 7
diff changeset
12
0549d00a617d client: add missing options to branch()
Idan Kamara <idankk86@gmail.com>
parents: 7
diff changeset
13 self.assertEquals(rev.branch, 'foo')
0549d00a617d client: add missing options to branch()
Idan Kamara <idankk86@gmail.com>
parents: 7
diff changeset
14 self.assertEquals(self.client.branches()[rev.branch], rev)
0549d00a617d client: add missing options to branch()
Idan Kamara <idankk86@gmail.com>
parents: 7
diff changeset
15
0549d00a617d client: add missing options to branch()
Idan Kamara <idankk86@gmail.com>
parents: 7
diff changeset
16 def test_reset_with_name(self):
0549d00a617d client: add missing options to branch()
Idan Kamara <idankk86@gmail.com>
parents: 7
diff changeset
17 self.assertRaises(ValueError, self.client.branch, 'foo', clean=True)
0549d00a617d client: add missing options to branch()
Idan Kamara <idankk86@gmail.com>
parents: 7
diff changeset
18
0549d00a617d client: add missing options to branch()
Idan Kamara <idankk86@gmail.com>
parents: 7
diff changeset
19 def test_reset(self):
0549d00a617d client: add missing options to branch()
Idan Kamara <idankk86@gmail.com>
parents: 7
diff changeset
20 self.client.branch('foo')
0549d00a617d client: add missing options to branch()
Idan Kamara <idankk86@gmail.com>
parents: 7
diff changeset
21 self.assertEquals(self.client.branch(clean=True), 'default')
7
eac8be119d81 tests: rearrange tests and use nosetests
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
22
11
0549d00a617d client: add missing options to branch()
Idan Kamara <idankk86@gmail.com>
parents: 7
diff changeset
23 def test_exists(self):
0549d00a617d client: add missing options to branch()
Idan Kamara <idankk86@gmail.com>
parents: 7
diff changeset
24 self.append('a', 'a')
0549d00a617d client: add missing options to branch()
Idan Kamara <idankk86@gmail.com>
parents: 7
diff changeset
25 self.client.commit('first', addremove=True)
0549d00a617d client: add missing options to branch()
Idan Kamara <idankk86@gmail.com>
parents: 7
diff changeset
26 self.client.branch('foo')
0549d00a617d client: add missing options to branch()
Idan Kamara <idankk86@gmail.com>
parents: 7
diff changeset
27 self.append('a', 'a')
0549d00a617d client: add missing options to branch()
Idan Kamara <idankk86@gmail.com>
parents: 7
diff changeset
28 self.client.commit('second')
0549d00a617d client: add missing options to branch()
Idan Kamara <idankk86@gmail.com>
parents: 7
diff changeset
29 self.assertRaises(hglib.error.CommandError, self.client.branch, 'default')
0549d00a617d client: add missing options to branch()
Idan Kamara <idankk86@gmail.com>
parents: 7
diff changeset
30
0549d00a617d client: add missing options to branch()
Idan Kamara <idankk86@gmail.com>
parents: 7
diff changeset
31 def test_force(self):
0549d00a617d client: add missing options to branch()
Idan Kamara <idankk86@gmail.com>
parents: 7
diff changeset
32 self.append('a', 'a')
0549d00a617d client: add missing options to branch()
Idan Kamara <idankk86@gmail.com>
parents: 7
diff changeset
33 self.client.commit('first', addremove=True)
0549d00a617d client: add missing options to branch()
Idan Kamara <idankk86@gmail.com>
parents: 7
diff changeset
34 self.client.branch('foo')
0549d00a617d client: add missing options to branch()
Idan Kamara <idankk86@gmail.com>
parents: 7
diff changeset
35 self.append('a', 'a')
0549d00a617d client: add missing options to branch()
Idan Kamara <idankk86@gmail.com>
parents: 7
diff changeset
36 self.client.commit('second')
0549d00a617d client: add missing options to branch()
Idan Kamara <idankk86@gmail.com>
parents: 7
diff changeset
37
0549d00a617d client: add missing options to branch()
Idan Kamara <idankk86@gmail.com>
parents: 7
diff changeset
38 self.assertRaises(hglib.error.CommandError, self.client.branch, 'default')
0549d00a617d client: add missing options to branch()
Idan Kamara <idankk86@gmail.com>
parents: 7
diff changeset
39 self.assertEquals(self.client.branch('default', force=True), 'default')