annotate 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
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
125
8d9a9da3e7b4 client: add 'phase' method to set or get the phase of a changeset
Paul Tonelli <paul.tonelli@logilab.fr>
parents:
diff changeset
1 import common, hglib
8d9a9da3e7b4 client: add 'phase' method to set or get the phase of a changeset
Paul Tonelli <paul.tonelli@logilab.fr>
parents:
diff changeset
2
8d9a9da3e7b4 client: add 'phase' method to set or get the phase of a changeset
Paul Tonelli <paul.tonelli@logilab.fr>
parents:
diff changeset
3 class test_phase(common.basetest):
8d9a9da3e7b4 client: add 'phase' method to set or get the phase of a changeset
Paul Tonelli <paul.tonelli@logilab.fr>
parents:
diff changeset
4 """test the different ways to use the phase command"""
8d9a9da3e7b4 client: add 'phase' method to set or get the phase of a changeset
Paul Tonelli <paul.tonelli@logilab.fr>
parents:
diff changeset
5 def test_phase(self):
8d9a9da3e7b4 client: add 'phase' method to set or get the phase of a changeset
Paul Tonelli <paul.tonelli@logilab.fr>
parents:
diff changeset
6 """test getting data from a single changeset"""
8d9a9da3e7b4 client: add 'phase' method to set or get the phase of a changeset
Paul Tonelli <paul.tonelli@logilab.fr>
parents:
diff changeset
7 self.append('a', 'a')
8d9a9da3e7b4 client: add 'phase' method to set or get the phase of a changeset
Paul Tonelli <paul.tonelli@logilab.fr>
parents:
diff changeset
8 rev, node0 = self.client.commit('first', addremove=True)
8d9a9da3e7b4 client: add 'phase' method to set or get the phase of a changeset
Paul Tonelli <paul.tonelli@logilab.fr>
parents:
diff changeset
9 self.assertEqual([(0, 'draft')], self.client.phase(node0))
8d9a9da3e7b4 client: add 'phase' method to set or get the phase of a changeset
Paul Tonelli <paul.tonelli@logilab.fr>
parents:
diff changeset
10
8d9a9da3e7b4 client: add 'phase' method to set or get the phase of a changeset
Paul Tonelli <paul.tonelli@logilab.fr>
parents:
diff changeset
11 def test_phase_public(self):
8d9a9da3e7b4 client: add 'phase' method to set or get the phase of a changeset
Paul Tonelli <paul.tonelli@logilab.fr>
parents:
diff changeset
12 """phase change from draft to public"""
8d9a9da3e7b4 client: add 'phase' method to set or get the phase of a changeset
Paul Tonelli <paul.tonelli@logilab.fr>
parents:
diff changeset
13 self.append('a', 'a')
8d9a9da3e7b4 client: add 'phase' method to set or get the phase of a changeset
Paul Tonelli <paul.tonelli@logilab.fr>
parents:
diff changeset
14 rev, node0 = self.client.commit('first', addremove=True)
8d9a9da3e7b4 client: add 'phase' method to set or get the phase of a changeset
Paul Tonelli <paul.tonelli@logilab.fr>
parents:
diff changeset
15 self.client.phase(node0, public=True)
8d9a9da3e7b4 client: add 'phase' method to set or get the phase of a changeset
Paul Tonelli <paul.tonelli@logilab.fr>
parents:
diff changeset
16 self.assertEqual([(0, 'public')], self.client.phase(node0))
8d9a9da3e7b4 client: add 'phase' method to set or get the phase of a changeset
Paul Tonelli <paul.tonelli@logilab.fr>
parents:
diff changeset
17
8d9a9da3e7b4 client: add 'phase' method to set or get the phase of a changeset
Paul Tonelli <paul.tonelli@logilab.fr>
parents:
diff changeset
18 def test_phase_secret(self):
8d9a9da3e7b4 client: add 'phase' method to set or get the phase of a changeset
Paul Tonelli <paul.tonelli@logilab.fr>
parents:
diff changeset
19 """phase change from draft to secret"""
8d9a9da3e7b4 client: add 'phase' method to set or get the phase of a changeset
Paul Tonelli <paul.tonelli@logilab.fr>
parents:
diff changeset
20 self.append('a', 'a')
8d9a9da3e7b4 client: add 'phase' method to set or get the phase of a changeset
Paul Tonelli <paul.tonelli@logilab.fr>
parents:
diff changeset
21 rev, node0 = self.client.commit('first', addremove=True)
8d9a9da3e7b4 client: add 'phase' method to set or get the phase of a changeset
Paul Tonelli <paul.tonelli@logilab.fr>
parents:
diff changeset
22 with self.assertRaises(hglib.error.CommandError):
8d9a9da3e7b4 client: add 'phase' method to set or get the phase of a changeset
Paul Tonelli <paul.tonelli@logilab.fr>
parents:
diff changeset
23 self.client.phase(node0, secret=True)
8d9a9da3e7b4 client: add 'phase' method to set or get the phase of a changeset
Paul Tonelli <paul.tonelli@logilab.fr>
parents:
diff changeset
24 self.client.phase(node0, secret=True, force=True)
8d9a9da3e7b4 client: add 'phase' method to set or get the phase of a changeset
Paul Tonelli <paul.tonelli@logilab.fr>
parents:
diff changeset
25 self.assertEqual([(0, 'secret')], self.client.phase(node0))
8d9a9da3e7b4 client: add 'phase' method to set or get the phase of a changeset
Paul Tonelli <paul.tonelli@logilab.fr>
parents:
diff changeset
26
8d9a9da3e7b4 client: add 'phase' method to set or get the phase of a changeset
Paul Tonelli <paul.tonelli@logilab.fr>
parents:
diff changeset
27 def test_phase_multiple(self):
8d9a9da3e7b4 client: add 'phase' method to set or get the phase of a changeset
Paul Tonelli <paul.tonelli@logilab.fr>
parents:
diff changeset
28 """phase changes and show the phases of the different changesets"""
8d9a9da3e7b4 client: add 'phase' method to set or get the phase of a changeset
Paul Tonelli <paul.tonelli@logilab.fr>
parents:
diff changeset
29 self.append('a', 'a')
8d9a9da3e7b4 client: add 'phase' method to set or get the phase of a changeset
Paul Tonelli <paul.tonelli@logilab.fr>
parents:
diff changeset
30 rev, node0 = self.client.commit('a', addremove=True)
8d9a9da3e7b4 client: add 'phase' method to set or get the phase of a changeset
Paul Tonelli <paul.tonelli@logilab.fr>
parents:
diff changeset
31 self.client.phase(node0, public=True)
8d9a9da3e7b4 client: add 'phase' method to set or get the phase of a changeset
Paul Tonelli <paul.tonelli@logilab.fr>
parents:
diff changeset
32 self.append('b', 'b')
8d9a9da3e7b4 client: add 'phase' method to set or get the phase of a changeset
Paul Tonelli <paul.tonelli@logilab.fr>
parents:
diff changeset
33 rev, node1 = self.client.commit('b', addremove=True)
8d9a9da3e7b4 client: add 'phase' method to set or get the phase of a changeset
Paul Tonelli <paul.tonelli@logilab.fr>
parents:
diff changeset
34 self.append('c', 'c')
8d9a9da3e7b4 client: add 'phase' method to set or get the phase of a changeset
Paul Tonelli <paul.tonelli@logilab.fr>
parents:
diff changeset
35 rev, node2 = self.client.commit('c', addremove=True)
8d9a9da3e7b4 client: add 'phase' method to set or get the phase of a changeset
Paul Tonelli <paul.tonelli@logilab.fr>
parents:
diff changeset
36 self.client.phase(node2, secret=True, force=True)
8d9a9da3e7b4 client: add 'phase' method to set or get the phase of a changeset
Paul Tonelli <paul.tonelli@logilab.fr>
parents:
diff changeset
37 self.assertEqual([(0, 'public'), (2, 'secret'), (1, 'draft')],
8d9a9da3e7b4 client: add 'phase' method to set or get the phase of a changeset
Paul Tonelli <paul.tonelli@logilab.fr>
parents:
diff changeset
38 self.client.phase([node0,node2,node1]))
8d9a9da3e7b4 client: add 'phase' method to set or get the phase of a changeset
Paul Tonelli <paul.tonelli@logilab.fr>
parents:
diff changeset
39
8d9a9da3e7b4 client: add 'phase' method to set or get the phase of a changeset
Paul Tonelli <paul.tonelli@logilab.fr>
parents:
diff changeset
40