comparison tests/test-phase.py @ 125:8d9a9da3e7b4

client: add 'phase' method to set or get the phase of a changeset
author Paul Tonelli <paul.tonelli@logilab.fr>
date Fri, 16 May 2014 18:21:12 +0200
parents
children a7fe976b1931
comparison
equal deleted inserted replaced
124:cc7569bffb26 125:8d9a9da3e7b4
1 import common, hglib
2
3 class test_phase(common.basetest):
4 """test the different ways to use the phase command"""
5 def test_phase(self):
6 """test getting data from a single changeset"""
7 self.append('a', 'a')
8 rev, node0 = self.client.commit('first', addremove=True)
9 self.assertEqual([(0, 'draft')], self.client.phase(node0))
10
11 def test_phase_public(self):
12 """phase change from draft to public"""
13 self.append('a', 'a')
14 rev, node0 = self.client.commit('first', addremove=True)
15 self.client.phase(node0, public=True)
16 self.assertEqual([(0, 'public')], self.client.phase(node0))
17
18 def test_phase_secret(self):
19 """phase change from draft to secret"""
20 self.append('a', 'a')
21 rev, node0 = self.client.commit('first', addremove=True)
22 with self.assertRaises(hglib.error.CommandError):
23 self.client.phase(node0, secret=True)
24 self.client.phase(node0, secret=True, force=True)
25 self.assertEqual([(0, 'secret')], self.client.phase(node0))
26
27 def test_phase_multiple(self):
28 """phase changes and show the phases of the different changesets"""
29 self.append('a', 'a')
30 rev, node0 = self.client.commit('a', addremove=True)
31 self.client.phase(node0, public=True)
32 self.append('b', 'b')
33 rev, node1 = self.client.commit('b', addremove=True)
34 self.append('c', 'c')
35 rev, node2 = self.client.commit('c', addremove=True)
36 self.client.phase(node2, secret=True, force=True)
37 self.assertEqual([(0, 'public'), (2, 'secret'), (1, 'draft')],
38 self.client.phase([node0,node2,node1]))
39
40