Mercurial > python-hglib
annotate tests/test-summary.py @ 148:c1b966866ed7
hglib: make all imports absolute (issue4520)
author | Brett Cannon <brett@python.org> |
---|---|
date | Fri, 13 Mar 2015 14:46:13 -0400 |
parents | 4359cabcb0cc |
children | 568bca4ff58e |
rev | line source |
---|---|
148
c1b966866ed7
hglib: make all imports absolute (issue4520)
Brett Cannon <brett@python.org>
parents:
143
diff
changeset
|
1 from tests import common |
51 | 2 import hglib |
143
4359cabcb0cc
hglib: move string literals in the test code to util.b() (issue4520)
Brett Cannon <brett@python.org>
parents:
88
diff
changeset
|
3 from hglib.util import b |
51 | 4 |
5 class test_summary(common.basetest): | |
6 def test_empty(self): | |
143
4359cabcb0cc
hglib: move string literals in the test code to util.b() (issue4520)
Brett Cannon <brett@python.org>
parents:
88
diff
changeset
|
7 d = {b('parent') : [(-1, b('000000000000'), b('tip'), None)], |
4359cabcb0cc
hglib: move string literals in the test code to util.b() (issue4520)
Brett Cannon <brett@python.org>
parents:
88
diff
changeset
|
8 b('branch') : b('default'), |
4359cabcb0cc
hglib: move string literals in the test code to util.b() (issue4520)
Brett Cannon <brett@python.org>
parents:
88
diff
changeset
|
9 b('commit') : True, |
4359cabcb0cc
hglib: move string literals in the test code to util.b() (issue4520)
Brett Cannon <brett@python.org>
parents:
88
diff
changeset
|
10 b('update') : 0} |
51 | 11 |
12 self.assertEquals(self.client.summary(), d) | |
13 | |
14 def test_basic(self): | |
15 self.append('a', 'a') | |
143
4359cabcb0cc
hglib: move string literals in the test code to util.b() (issue4520)
Brett Cannon <brett@python.org>
parents:
88
diff
changeset
|
16 rev, node = self.client.commit(b('first'), addremove=True) |
51 | 17 |
143
4359cabcb0cc
hglib: move string literals in the test code to util.b() (issue4520)
Brett Cannon <brett@python.org>
parents:
88
diff
changeset
|
18 d = {b('parent') : [(0, node[:12], b('tip'), b('first'))], |
4359cabcb0cc
hglib: move string literals in the test code to util.b() (issue4520)
Brett Cannon <brett@python.org>
parents:
88
diff
changeset
|
19 b('branch') : b('default'), |
4359cabcb0cc
hglib: move string literals in the test code to util.b() (issue4520)
Brett Cannon <brett@python.org>
parents:
88
diff
changeset
|
20 b('commit') : True, |
4359cabcb0cc
hglib: move string literals in the test code to util.b() (issue4520)
Brett Cannon <brett@python.org>
parents:
88
diff
changeset
|
21 b('update') : 0} |
51 | 22 |
23 self.assertEquals(self.client.summary(), d) | |
24 | |
25 def test_commit_dirty(self): | |
26 self.append('a', 'a') | |
143
4359cabcb0cc
hglib: move string literals in the test code to util.b() (issue4520)
Brett Cannon <brett@python.org>
parents:
88
diff
changeset
|
27 rev, node = self.client.commit(b('first'), addremove=True) |
51 | 28 self.append('a', 'a') |
29 | |
143
4359cabcb0cc
hglib: move string literals in the test code to util.b() (issue4520)
Brett Cannon <brett@python.org>
parents:
88
diff
changeset
|
30 d = {b('parent') : [(0, node[:12], b('tip'), b('first'))], |
4359cabcb0cc
hglib: move string literals in the test code to util.b() (issue4520)
Brett Cannon <brett@python.org>
parents:
88
diff
changeset
|
31 b('branch') : b('default'), |
4359cabcb0cc
hglib: move string literals in the test code to util.b() (issue4520)
Brett Cannon <brett@python.org>
parents:
88
diff
changeset
|
32 b('commit') : False, |
4359cabcb0cc
hglib: move string literals in the test code to util.b() (issue4520)
Brett Cannon <brett@python.org>
parents:
88
diff
changeset
|
33 b('update') : 0} |
51 | 34 |
35 self.assertEquals(self.client.summary(), d) | |
36 | |
37 def test_update(self): | |
38 self.append('a', 'a') | |
143
4359cabcb0cc
hglib: move string literals in the test code to util.b() (issue4520)
Brett Cannon <brett@python.org>
parents:
88
diff
changeset
|
39 rev, node = self.client.commit(b('first'), addremove=True) |
51 | 40 self.append('a', 'a') |
143
4359cabcb0cc
hglib: move string literals in the test code to util.b() (issue4520)
Brett Cannon <brett@python.org>
parents:
88
diff
changeset
|
41 self.client.commit(b('second')) |
51 | 42 self.client.update(0) |
43 | |
143
4359cabcb0cc
hglib: move string literals in the test code to util.b() (issue4520)
Brett Cannon <brett@python.org>
parents:
88
diff
changeset
|
44 d = {b('parent') : [(0, node[:12], None, b('first'))], |
4359cabcb0cc
hglib: move string literals in the test code to util.b() (issue4520)
Brett Cannon <brett@python.org>
parents:
88
diff
changeset
|
45 b('branch') : b('default'), |
4359cabcb0cc
hglib: move string literals in the test code to util.b() (issue4520)
Brett Cannon <brett@python.org>
parents:
88
diff
changeset
|
46 b('commit') : True, |
4359cabcb0cc
hglib: move string literals in the test code to util.b() (issue4520)
Brett Cannon <brett@python.org>
parents:
88
diff
changeset
|
47 b('update') : 1} |
51 | 48 |
49 self.assertEquals(self.client.summary(), d) | |
50 | |
51 def test_remote(self): | |
52 self.append('a', 'a') | |
143
4359cabcb0cc
hglib: move string literals in the test code to util.b() (issue4520)
Brett Cannon <brett@python.org>
parents:
88
diff
changeset
|
53 rev, node = self.client.commit(b('first'), addremove=True) |
51 | 54 |
143
4359cabcb0cc
hglib: move string literals in the test code to util.b() (issue4520)
Brett Cannon <brett@python.org>
parents:
88
diff
changeset
|
55 self.client.clone(dest=b('other')) |
51 | 56 other = hglib.open('other') |
57 | |
143
4359cabcb0cc
hglib: move string literals in the test code to util.b() (issue4520)
Brett Cannon <brett@python.org>
parents:
88
diff
changeset
|
58 d = {b('parent') : [(0, node[:12], b('tip'), b('first'))], |
4359cabcb0cc
hglib: move string literals in the test code to util.b() (issue4520)
Brett Cannon <brett@python.org>
parents:
88
diff
changeset
|
59 b('branch') : b('default'), |
4359cabcb0cc
hglib: move string literals in the test code to util.b() (issue4520)
Brett Cannon <brett@python.org>
parents:
88
diff
changeset
|
60 b('commit') : True, |
4359cabcb0cc
hglib: move string literals in the test code to util.b() (issue4520)
Brett Cannon <brett@python.org>
parents:
88
diff
changeset
|
61 b('update') : 0, |
4359cabcb0cc
hglib: move string literals in the test code to util.b() (issue4520)
Brett Cannon <brett@python.org>
parents:
88
diff
changeset
|
62 b('remote') : (0, 0, 0, 0)} |
51 | 63 |
64 self.assertEquals(other.summary(remote=True), d) | |
65 | |
66 self.append('a', 'a') | |
143
4359cabcb0cc
hglib: move string literals in the test code to util.b() (issue4520)
Brett Cannon <brett@python.org>
parents:
88
diff
changeset
|
67 self.client.commit(b('second')) |
51 | 68 |
143
4359cabcb0cc
hglib: move string literals in the test code to util.b() (issue4520)
Brett Cannon <brett@python.org>
parents:
88
diff
changeset
|
69 d[b('remote')] = (1, 0, 0, 0) |
51 | 70 self.assertEquals(other.summary(remote=True), d) |
71 | |
143
4359cabcb0cc
hglib: move string literals in the test code to util.b() (issue4520)
Brett Cannon <brett@python.org>
parents:
88
diff
changeset
|
72 self.client.bookmark(b('bm')) |
4359cabcb0cc
hglib: move string literals in the test code to util.b() (issue4520)
Brett Cannon <brett@python.org>
parents:
88
diff
changeset
|
73 d[b('remote')] = (1, 1, 0, 0) |
51 | 74 self.assertEquals(other.summary(remote=True), d) |
75 | |
143
4359cabcb0cc
hglib: move string literals in the test code to util.b() (issue4520)
Brett Cannon <brett@python.org>
parents:
88
diff
changeset
|
76 other.bookmark(b('bmother')) |
4359cabcb0cc
hglib: move string literals in the test code to util.b() (issue4520)
Brett Cannon <brett@python.org>
parents:
88
diff
changeset
|
77 d[b('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
|
78 if self.client.version < (2, 0, 0): |
143
4359cabcb0cc
hglib: move string literals in the test code to util.b() (issue4520)
Brett Cannon <brett@python.org>
parents:
88
diff
changeset
|
79 d[b('parent')] = [(0, node[:12], b('tip bmother'), b('first'))] |
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
|
80 else: |
143
4359cabcb0cc
hglib: move string literals in the test code to util.b() (issue4520)
Brett Cannon <brett@python.org>
parents:
88
diff
changeset
|
81 d[b('bookmarks')] = b('*bmother') |
51 | 82 self.assertEquals(other.summary(remote=True), d) |
83 | |
84 self.append('other/a', 'a') | |
143
4359cabcb0cc
hglib: move string literals in the test code to util.b() (issue4520)
Brett Cannon <brett@python.org>
parents:
88
diff
changeset
|
85 rev, node = other.commit(b('second in other')) |
51 | 86 |
143
4359cabcb0cc
hglib: move string literals in the test code to util.b() (issue4520)
Brett Cannon <brett@python.org>
parents:
88
diff
changeset
|
87 d[b('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
|
88 if self.client.version < (2, 0, 0): |
143
4359cabcb0cc
hglib: move string literals in the test code to util.b() (issue4520)
Brett Cannon <brett@python.org>
parents:
88
diff
changeset
|
89 tags = b('tip bmother') |
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
|
90 else: |
143
4359cabcb0cc
hglib: move string literals in the test code to util.b() (issue4520)
Brett Cannon <brett@python.org>
parents:
88
diff
changeset
|
91 tags = b('tip') |
4359cabcb0cc
hglib: move string literals in the test code to util.b() (issue4520)
Brett Cannon <brett@python.org>
parents:
88
diff
changeset
|
92 d[b('parent')] = [(1, node[:12], tags, b('second in other'))] |
51 | 93 |
94 self.assertEquals(other.summary(remote=True), d) | |
95 | |
96 def test_two_parents(self): | |
97 self.append('a', 'a') | |
143
4359cabcb0cc
hglib: move string literals in the test code to util.b() (issue4520)
Brett Cannon <brett@python.org>
parents:
88
diff
changeset
|
98 rev0, node = self.client.commit(b('first'), addremove=True) |
51 | 99 |
100 self.append('a', 'a') | |
143
4359cabcb0cc
hglib: move string literals in the test code to util.b() (issue4520)
Brett Cannon <brett@python.org>
parents:
88
diff
changeset
|
101 rev1, node1 = self.client.commit(b('second')) |
51 | 102 |
103 self.client.update(rev0) | |
104 self.append('b', 'a') | |
143
4359cabcb0cc
hglib: move string literals in the test code to util.b() (issue4520)
Brett Cannon <brett@python.org>
parents:
88
diff
changeset
|
105 rev2, node2 = self.client.commit(b('third'), addremove=True) |
51 | 106 |
107 self.client.merge(rev1) | |
108 | |
143
4359cabcb0cc
hglib: move string literals in the test code to util.b() (issue4520)
Brett Cannon <brett@python.org>
parents:
88
diff
changeset
|
109 d = {b('parent') : [(2, node2[:12], b('tip'), b('third')), |
4359cabcb0cc
hglib: move string literals in the test code to util.b() (issue4520)
Brett Cannon <brett@python.org>
parents:
88
diff
changeset
|
110 (1, node1[:12], None, b('second'))], |
4359cabcb0cc
hglib: move string literals in the test code to util.b() (issue4520)
Brett Cannon <brett@python.org>
parents:
88
diff
changeset
|
111 b('branch') : b('default'), |
4359cabcb0cc
hglib: move string literals in the test code to util.b() (issue4520)
Brett Cannon <brett@python.org>
parents:
88
diff
changeset
|
112 b('commit') : False, |
4359cabcb0cc
hglib: move string literals in the test code to util.b() (issue4520)
Brett Cannon <brett@python.org>
parents:
88
diff
changeset
|
113 b('update') : 0} |
51 | 114 |
115 self.assertEquals(self.client.summary(), d) |