annotate tests/test-phase.py @ 129:bcc8390d7819

tests: remove "with" usage for 2.4 compatibility
author Matt Mackall <mpm@selenic.com>
date Thu, 31 Jul 2014 15:49:00 -0500
parents a7fe976b1931
children b6f601ba7f3c
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))
126
a7fe976b1931 context: add 'phase' getter
Paul Tonelli <paul.tonelli@logilab.fr>
parents: 125
diff changeset
10 ctx = self.client[rev]
a7fe976b1931 context: add 'phase' getter
Paul Tonelli <paul.tonelli@logilab.fr>
parents: 125
diff changeset
11 self.assertEqual('draft', ctx.phase())
125
8d9a9da3e7b4 client: add 'phase' method to set or get the phase of a changeset
Paul Tonelli <paul.tonelli@logilab.fr>
parents:
diff changeset
12
8d9a9da3e7b4 client: add 'phase' method to set or get the phase of a changeset
Paul Tonelli <paul.tonelli@logilab.fr>
parents:
diff changeset
13 def test_phase_public(self):
126
a7fe976b1931 context: add 'phase' getter
Paul Tonelli <paul.tonelli@logilab.fr>
parents: 125
diff changeset
14 """test phase change from draft to public"""
125
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.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
16 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
17 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
18 self.assertEqual([(0, 'public')], self.client.phase(node0))
126
a7fe976b1931 context: add 'phase' getter
Paul Tonelli <paul.tonelli@logilab.fr>
parents: 125
diff changeset
19 ctx = self.client[rev]
a7fe976b1931 context: add 'phase' getter
Paul Tonelli <paul.tonelli@logilab.fr>
parents: 125
diff changeset
20 self.assertEqual('public', ctx.phase())
125
8d9a9da3e7b4 client: add 'phase' method to set or get the phase of a changeset
Paul Tonelli <paul.tonelli@logilab.fr>
parents:
diff changeset
21
8d9a9da3e7b4 client: add 'phase' method to set or get the phase of a changeset
Paul Tonelli <paul.tonelli@logilab.fr>
parents:
diff changeset
22 def test_phase_secret(self):
126
a7fe976b1931 context: add 'phase' getter
Paul Tonelli <paul.tonelli@logilab.fr>
parents: 125
diff changeset
23 """test phase change from draft to secret"""
125
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.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
25 rev, node0 = self.client.commit('first', addremove=True)
129
bcc8390d7819 tests: remove "with" usage for 2.4 compatibility
Matt Mackall <mpm@selenic.com>
parents: 126
diff changeset
26 self.assertRaises(hglib.error.CommandError,
bcc8390d7819 tests: remove "with" usage for 2.4 compatibility
Matt Mackall <mpm@selenic.com>
parents: 126
diff changeset
27 self.client.phase, node0, secret=True)
125
8d9a9da3e7b4 client: add 'phase' method to set or get the phase of a changeset
Paul Tonelli <paul.tonelli@logilab.fr>
parents:
diff changeset
28 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
29 self.assertEqual([(0, 'secret')], self.client.phase(node0))
126
a7fe976b1931 context: add 'phase' getter
Paul Tonelli <paul.tonelli@logilab.fr>
parents: 125
diff changeset
30 ctx = self.client[rev]
a7fe976b1931 context: add 'phase' getter
Paul Tonelli <paul.tonelli@logilab.fr>
parents: 125
diff changeset
31 self.assertEqual('secret', ctx.phase())
a7fe976b1931 context: add 'phase' getter
Paul Tonelli <paul.tonelli@logilab.fr>
parents: 125
diff changeset
32
125
8d9a9da3e7b4 client: add 'phase' method to set or get the phase of a changeset
Paul Tonelli <paul.tonelli@logilab.fr>
parents:
diff changeset
33
8d9a9da3e7b4 client: add 'phase' method to set or get the phase of a changeset
Paul Tonelli <paul.tonelli@logilab.fr>
parents:
diff changeset
34 def test_phase_multiple(self):
126
a7fe976b1931 context: add 'phase' getter
Paul Tonelli <paul.tonelli@logilab.fr>
parents: 125
diff changeset
35 """test phase changes and show the phases of the different changesets"""
125
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.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
37 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
38 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
39 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
40 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
41 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
42 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
43 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
44 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
45 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
46
8d9a9da3e7b4 client: add 'phase' method to set or get the phase of a changeset
Paul Tonelli <paul.tonelli@logilab.fr>
parents:
diff changeset
47