Mercurial > python-hglib
annotate tests/test-summary.py @ 115:8867908fe8c7 1.0
tests: deal with missing largefiles support for 1.9
author | Matt Mackall <mpm@selenic.com> |
---|---|
date | Mon, 06 May 2013 15:17:40 -0500 |
parents | 3bbf6a3266f4 |
children | 4359cabcb0cc |
rev | line source |
---|---|
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) | |
88
3bbf6a3266f4
test-summary: fix test due to bookmarks being separated from tags in hg >= 2.0
Idan Kamara <idankk86@gmail.com>
parents:
51
diff
changeset
|
77 if self.client.version < (2, 0, 0): |
3bbf6a3266f4
test-summary: fix test due to bookmarks being separated from tags in hg >= 2.0
Idan Kamara <idankk86@gmail.com>
parents:
51
diff
changeset
|
78 d['parent'] = [(0, node[:12], 'tip bmother', 'first')] |
3bbf6a3266f4
test-summary: fix test due to bookmarks being separated from tags in hg >= 2.0
Idan Kamara <idankk86@gmail.com>
parents:
51
diff
changeset
|
79 else: |
3bbf6a3266f4
test-summary: fix test due to bookmarks being separated from tags in hg >= 2.0
Idan Kamara <idankk86@gmail.com>
parents:
51
diff
changeset
|
80 d['bookmarks'] = '*bmother' |
51 | 81 self.assertEquals(other.summary(remote=True), d) |
82 | |
83 self.append('other/a', 'a') | |
84 rev, node = other.commit('second in other') | |
85 | |
86 d['remote'] = (1, 1, 1, 1) | |
88
3bbf6a3266f4
test-summary: fix test due to bookmarks being separated from tags in hg >= 2.0
Idan Kamara <idankk86@gmail.com>
parents:
51
diff
changeset
|
87 if self.client.version < (2, 0, 0): |
3bbf6a3266f4
test-summary: fix test due to bookmarks being separated from tags in hg >= 2.0
Idan Kamara <idankk86@gmail.com>
parents:
51
diff
changeset
|
88 tags = 'tip bmother' |
3bbf6a3266f4
test-summary: fix test due to bookmarks being separated from tags in hg >= 2.0
Idan Kamara <idankk86@gmail.com>
parents:
51
diff
changeset
|
89 else: |
3bbf6a3266f4
test-summary: fix test due to bookmarks being separated from tags in hg >= 2.0
Idan Kamara <idankk86@gmail.com>
parents:
51
diff
changeset
|
90 tags = 'tip' |
3bbf6a3266f4
test-summary: fix test due to bookmarks being separated from tags in hg >= 2.0
Idan Kamara <idankk86@gmail.com>
parents:
51
diff
changeset
|
91 d['parent'] = [(1, node[:12], tags, 'second in other')] |
51 | 92 |
93 self.assertEquals(other.summary(remote=True), d) | |
94 | |
95 def test_two_parents(self): | |
96 self.append('a', 'a') | |
97 rev0, node = self.client.commit('first', addremove=True) | |
98 | |
99 self.append('a', 'a') | |
100 rev1, node1 = self.client.commit('second') | |
101 | |
102 self.client.update(rev0) | |
103 self.append('b', 'a') | |
104 rev2, node2 = self.client.commit('third', addremove=True) | |
105 | |
106 self.client.merge(rev1) | |
107 | |
108 d = {'parent' : [(2, node2[:12], 'tip', 'third'), | |
109 (1, node1[:12], None, 'second')], | |
110 'branch' : 'default', | |
111 'commit' : False, | |
112 'update' : 0} | |
113 | |
114 self.assertEquals(self.client.summary(), d) |