annotate tests/test-summary.py @ 70:bdc1650f216c

tests: set HGRCPATH so local hgrc's aren't loaded
author Idan Kamara <idankk86@gmail.com>
date Fri, 09 Sep 2011 23:05:57 +0300
parents c52383a550fb
children 3bbf6a3266f4
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
51
c52383a550fb client: add summary command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
1 import common
c52383a550fb client: add summary command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
2 import hglib
c52383a550fb client: add summary command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
3
c52383a550fb client: add summary command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
4 class test_summary(common.basetest):
c52383a550fb client: add summary command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
5 def test_empty(self):
c52383a550fb client: add summary command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
6 d = {'parent' : [(-1, '000000000000', 'tip', None)],
c52383a550fb client: add summary command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
7 'branch' : 'default',
c52383a550fb client: add summary command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
8 'commit' : True,
c52383a550fb client: add summary command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
9 'update' : 0}
c52383a550fb client: add summary command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
10
c52383a550fb client: add summary command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
11 self.assertEquals(self.client.summary(), d)
c52383a550fb client: add summary command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
12
c52383a550fb client: add summary command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
13 def test_basic(self):
c52383a550fb client: add summary command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
14 self.append('a', 'a')
c52383a550fb client: add summary command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
15 rev, node = self.client.commit('first', addremove=True)
c52383a550fb client: add summary command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
16
c52383a550fb client: add summary command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
17 d = {'parent' : [(0, node[:12], 'tip', 'first')],
c52383a550fb client: add summary command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
18 'branch' : 'default',
c52383a550fb client: add summary command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
19 'commit' : True,
c52383a550fb client: add summary command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
20 'update' : 0}
c52383a550fb client: add summary command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
21
c52383a550fb client: add summary command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
22 self.assertEquals(self.client.summary(), d)
c52383a550fb client: add summary command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
23
c52383a550fb client: add summary command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
24 def test_commit_dirty(self):
c52383a550fb client: add summary command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
25 self.append('a', 'a')
c52383a550fb client: add summary command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
26 rev, node = self.client.commit('first', addremove=True)
c52383a550fb client: add summary command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
27 self.append('a', 'a')
c52383a550fb client: add summary command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
28
c52383a550fb client: add summary command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
29 d = {'parent' : [(0, node[:12], 'tip', 'first')],
c52383a550fb client: add summary command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
30 'branch' : 'default',
c52383a550fb client: add summary command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
31 'commit' : False,
c52383a550fb client: add summary command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
32 'update' : 0}
c52383a550fb client: add summary command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
33
c52383a550fb client: add summary command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
34 self.assertEquals(self.client.summary(), d)
c52383a550fb client: add summary command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
35
c52383a550fb client: add summary command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
36 def test_update(self):
c52383a550fb client: add summary command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
37 self.append('a', 'a')
c52383a550fb client: add summary command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
38 rev, node = self.client.commit('first', addremove=True)
c52383a550fb client: add summary command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
39 self.append('a', 'a')
c52383a550fb client: add summary command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
40 self.client.commit('second')
c52383a550fb client: add summary command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
41 self.client.update(0)
c52383a550fb client: add summary command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
42
c52383a550fb client: add summary command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
43 d = {'parent' : [(0, node[:12], None, 'first')],
c52383a550fb client: add summary command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
44 'branch' : 'default',
c52383a550fb client: add summary command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
45 'commit' : True,
c52383a550fb client: add summary command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
46 'update' : 1}
c52383a550fb client: add summary command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
47
c52383a550fb client: add summary command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
48 self.assertEquals(self.client.summary(), d)
c52383a550fb client: add summary command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
49
c52383a550fb client: add summary command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
50 def test_remote(self):
c52383a550fb client: add summary command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
51 self.append('a', 'a')
c52383a550fb client: add summary command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
52 rev, node = self.client.commit('first', addremove=True)
c52383a550fb client: add summary command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
53
c52383a550fb client: add summary command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
54 self.client.clone(dest='other')
c52383a550fb client: add summary command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
55 other = hglib.open('other')
c52383a550fb client: add summary command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
56
c52383a550fb client: add summary command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
57 d = {'parent' : [(0, node[:12], 'tip', 'first')],
c52383a550fb client: add summary command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
58 'branch' : 'default',
c52383a550fb client: add summary command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
59 'commit' : True,
c52383a550fb client: add summary command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
60 'update' : 0,
c52383a550fb client: add summary command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
61 'remote' : (0, 0, 0, 0)}
c52383a550fb client: add summary command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
62
c52383a550fb client: add summary command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
63 self.assertEquals(other.summary(remote=True), d)
c52383a550fb client: add summary command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
64
c52383a550fb client: add summary command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
65 self.append('a', 'a')
c52383a550fb client: add summary command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
66 self.client.commit('second')
c52383a550fb client: add summary command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
67
c52383a550fb client: add summary command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
68 d['remote'] = (1, 0, 0, 0)
c52383a550fb client: add summary command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
69 self.assertEquals(other.summary(remote=True), d)
c52383a550fb client: add summary command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
70
c52383a550fb client: add summary command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
71 self.client.bookmark('bm')
c52383a550fb client: add summary command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
72 d['remote'] = (1, 1, 0, 0)
c52383a550fb client: add summary command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
73 self.assertEquals(other.summary(remote=True), d)
c52383a550fb client: add summary command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
74
c52383a550fb client: add summary command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
75 other.bookmark('bmother')
c52383a550fb client: add summary command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
76 d['remote'] = (1, 1, 0, 1)
c52383a550fb client: add summary command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
77 d['parent'] = [(0, node[:12], 'tip bmother', 'first')]
c52383a550fb client: add summary command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
78 self.assertEquals(other.summary(remote=True), d)
c52383a550fb client: add summary command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
79
c52383a550fb client: add summary command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
80 self.append('other/a', 'a')
c52383a550fb client: add summary command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
81 rev, node = other.commit('second in other')
c52383a550fb client: add summary command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
82
c52383a550fb client: add summary command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
83 d['remote'] = (1, 1, 1, 1)
c52383a550fb client: add summary command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
84 d['parent'] = [(1, node[:12], 'tip bmother', 'second in other')]
c52383a550fb client: add summary command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
85
c52383a550fb client: add summary command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
86 self.assertEquals(other.summary(remote=True), d)
c52383a550fb client: add summary command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
87
c52383a550fb client: add summary command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
88 def test_two_parents(self):
c52383a550fb client: add summary command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
89 self.append('a', 'a')
c52383a550fb client: add summary command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
90 rev0, node = self.client.commit('first', addremove=True)
c52383a550fb client: add summary command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
91
c52383a550fb client: add summary command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
92 self.append('a', 'a')
c52383a550fb client: add summary command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
93 rev1, node1 = self.client.commit('second')
c52383a550fb client: add summary command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
94
c52383a550fb client: add summary command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
95 self.client.update(rev0)
c52383a550fb client: add summary command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
96 self.append('b', 'a')
c52383a550fb client: add summary command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
97 rev2, node2 = self.client.commit('third', addremove=True)
c52383a550fb client: add summary command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
98
c52383a550fb client: add summary command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
99 self.client.merge(rev1)
c52383a550fb client: add summary command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
100
c52383a550fb client: add summary command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
101 d = {'parent' : [(2, node2[:12], 'tip', 'third'),
c52383a550fb client: add summary command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
102 (1, node1[:12], None, 'second')],
c52383a550fb client: add summary command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
103 'branch' : 'default',
c52383a550fb client: add summary command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
104 'commit' : False,
c52383a550fb client: add summary command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
105 'update' : 0}
c52383a550fb client: add summary command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
106
c52383a550fb client: add summary command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
107 self.assertEquals(self.client.summary(), d)