51
|
1 import common
|
|
2 import hglib
|
|
3
|
|
4 class test_summary(common.basetest):
|
|
5 def test_empty(self):
|
|
6 d = {'parent' : [(-1, '000000000000', 'tip', None)],
|
|
7 'branch' : 'default',
|
|
8 'commit' : True,
|
|
9 'update' : 0}
|
|
10
|
|
11 self.assertEquals(self.client.summary(), d)
|
|
12
|
|
13 def test_basic(self):
|
|
14 self.append('a', 'a')
|
|
15 rev, node = self.client.commit('first', addremove=True)
|
|
16
|
|
17 d = {'parent' : [(0, node[:12], 'tip', 'first')],
|
|
18 'branch' : 'default',
|
|
19 'commit' : True,
|
|
20 'update' : 0}
|
|
21
|
|
22 self.assertEquals(self.client.summary(), d)
|
|
23
|
|
24 def test_commit_dirty(self):
|
|
25 self.append('a', 'a')
|
|
26 rev, node = self.client.commit('first', addremove=True)
|
|
27 self.append('a', 'a')
|
|
28
|
|
29 d = {'parent' : [(0, node[:12], 'tip', 'first')],
|
|
30 'branch' : 'default',
|
|
31 'commit' : False,
|
|
32 'update' : 0}
|
|
33
|
|
34 self.assertEquals(self.client.summary(), d)
|
|
35
|
|
36 def test_update(self):
|
|
37 self.append('a', 'a')
|
|
38 rev, node = self.client.commit('first', addremove=True)
|
|
39 self.append('a', 'a')
|
|
40 self.client.commit('second')
|
|
41 self.client.update(0)
|
|
42
|
|
43 d = {'parent' : [(0, node[:12], None, 'first')],
|
|
44 'branch' : 'default',
|
|
45 'commit' : True,
|
|
46 'update' : 1}
|
|
47
|
|
48 self.assertEquals(self.client.summary(), d)
|
|
49
|
|
50 def test_remote(self):
|
|
51 self.append('a', 'a')
|
|
52 rev, node = self.client.commit('first', addremove=True)
|
|
53
|
|
54 self.client.clone(dest='other')
|
|
55 other = hglib.open('other')
|
|
56
|
|
57 d = {'parent' : [(0, node[:12], 'tip', 'first')],
|
|
58 'branch' : 'default',
|
|
59 'commit' : True,
|
|
60 'update' : 0,
|
|
61 'remote' : (0, 0, 0, 0)}
|
|
62
|
|
63 self.assertEquals(other.summary(remote=True), d)
|
|
64
|
|
65 self.append('a', 'a')
|
|
66 self.client.commit('second')
|
|
67
|
|
68 d['remote'] = (1, 0, 0, 0)
|
|
69 self.assertEquals(other.summary(remote=True), d)
|
|
70
|
|
71 self.client.bookmark('bm')
|
|
72 d['remote'] = (1, 1, 0, 0)
|
|
73 self.assertEquals(other.summary(remote=True), d)
|
|
74
|
|
75 other.bookmark('bmother')
|
|
76 d['remote'] = (1, 1, 0, 1)
|
|
77 d['parent'] = [(0, node[:12], 'tip bmother', 'first')]
|
|
78 self.assertEquals(other.summary(remote=True), d)
|
|
79
|
|
80 self.append('other/a', 'a')
|
|
81 rev, node = other.commit('second in other')
|
|
82
|
|
83 d['remote'] = (1, 1, 1, 1)
|
|
84 d['parent'] = [(1, node[:12], 'tip bmother', 'second in other')]
|
|
85
|
|
86 self.assertEquals(other.summary(remote=True), d)
|
|
87
|
|
88 def test_two_parents(self):
|
|
89 self.append('a', 'a')
|
|
90 rev0, node = self.client.commit('first', addremove=True)
|
|
91
|
|
92 self.append('a', 'a')
|
|
93 rev1, node1 = self.client.commit('second')
|
|
94
|
|
95 self.client.update(rev0)
|
|
96 self.append('b', 'a')
|
|
97 rev2, node2 = self.client.commit('third', addremove=True)
|
|
98
|
|
99 self.client.merge(rev1)
|
|
100
|
|
101 d = {'parent' : [(2, node2[:12], 'tip', 'third'),
|
|
102 (1, node1[:12], None, 'second')],
|
|
103 'branch' : 'default',
|
|
104 'commit' : False,
|
|
105 'update' : 0}
|
|
106
|
|
107 self.assertEquals(self.client.summary(), d)
|