annotate tests/test-merge.py @ 159:16496e0f3c09

util: update doctests to work with bytes (issue4520)
author Brett Cannon <brett@python.org>
date Fri, 27 Mar 2015 12:57:58 -0400
parents c1b966866ed7
children 8c4d24b58c23
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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
c1b966866ed7 hglib: make all imports absolute (issue4520)
Brett Cannon <brett@python.org>
parents: 143
diff changeset
2 import hglib
143
4359cabcb0cc hglib: move string literals in the test code to util.b() (issue4520)
Brett Cannon <brett@python.org>
parents: 46
diff changeset
3 from hglib.util import b
45
191855a9d813 client: add merge command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
4
191855a9d813 client: add merge command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
5 class test_merge(common.basetest):
191855a9d813 client: add merge command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
6 def setUp(self):
191855a9d813 client: add merge command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
7 common.basetest.setUp(self)
191855a9d813 client: add merge command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
8
191855a9d813 client: add merge command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
9 self.append('a', 'a')
143
4359cabcb0cc hglib: move string literals in the test code to util.b() (issue4520)
Brett Cannon <brett@python.org>
parents: 46
diff changeset
10 rev, self.node0 = self.client.commit(b('first'), addremove=True)
45
191855a9d813 client: add merge command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
11
191855a9d813 client: add merge command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
12 self.append('a', 'a')
143
4359cabcb0cc hglib: move string literals in the test code to util.b() (issue4520)
Brett Cannon <brett@python.org>
parents: 46
diff changeset
13 rev, self.node1 = self.client.commit(b('change'))
45
191855a9d813 client: add merge command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
14
191855a9d813 client: add merge command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
15 def test_basic(self):
191855a9d813 client: add merge command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
16 self.client.update(self.node0)
191855a9d813 client: add merge command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
17 self.append('b', 'a')
143
4359cabcb0cc hglib: move string literals in the test code to util.b() (issue4520)
Brett Cannon <brett@python.org>
parents: 46
diff changeset
18 rev, node2 = self.client.commit(b('new file'), addremove=True)
45
191855a9d813 client: add merge command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
19 self.client.merge(self.node1)
143
4359cabcb0cc hglib: move string literals in the test code to util.b() (issue4520)
Brett Cannon <brett@python.org>
parents: 46
diff changeset
20 rev, node = self.client.commit(b('merge'))
4359cabcb0cc hglib: move string literals in the test code to util.b() (issue4520)
Brett Cannon <brett@python.org>
parents: 46
diff changeset
21 diff = b("diff -r ") + node2[:12] + b(" -r ") + node[:12] + b(""" a
45
191855a9d813 client: add merge command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
22 --- a/a
191855a9d813 client: add merge command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
23 +++ b/a
191855a9d813 client: add merge command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
24 @@ -1,1 +1,1 @@
191855a9d813 client: add merge command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
25 -a
191855a9d813 client: add merge command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
26 \ No newline at end of file
191855a9d813 client: add merge command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
27 +aa
191855a9d813 client: add merge command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
28 \ No newline at end of file
143
4359cabcb0cc hglib: move string literals in the test code to util.b() (issue4520)
Brett Cannon <brett@python.org>
parents: 46
diff changeset
29 """)
45
191855a9d813 client: add merge command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
30
191855a9d813 client: add merge command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
31 self.assertEquals(diff, self.client.diff(change=node, nodates=True))
46
ebcc5d7dd528 client: introduce merge handlers
Idan Kamara <idankk86@gmail.com>
parents: 45
diff changeset
32
ebcc5d7dd528 client: introduce merge handlers
Idan Kamara <idankk86@gmail.com>
parents: 45
diff changeset
33 def test_merge_prompt_abort(self):
ebcc5d7dd528 client: introduce merge handlers
Idan Kamara <idankk86@gmail.com>
parents: 45
diff changeset
34 self.client.update(self.node0)
143
4359cabcb0cc hglib: move string literals in the test code to util.b() (issue4520)
Brett Cannon <brett@python.org>
parents: 46
diff changeset
35 self.client.remove(b('a'))
4359cabcb0cc hglib: move string literals in the test code to util.b() (issue4520)
Brett Cannon <brett@python.org>
parents: 46
diff changeset
36 self.client.commit(b('remove'))
46
ebcc5d7dd528 client: introduce merge handlers
Idan Kamara <idankk86@gmail.com>
parents: 45
diff changeset
37
ebcc5d7dd528 client: introduce merge handlers
Idan Kamara <idankk86@gmail.com>
parents: 45
diff changeset
38 self.assertRaises(hglib.error.CommandError, self.client.merge)
ebcc5d7dd528 client: introduce merge handlers
Idan Kamara <idankk86@gmail.com>
parents: 45
diff changeset
39
ebcc5d7dd528 client: introduce merge handlers
Idan Kamara <idankk86@gmail.com>
parents: 45
diff changeset
40 def test_merge_prompt_noninteractive(self):
ebcc5d7dd528 client: introduce merge handlers
Idan Kamara <idankk86@gmail.com>
parents: 45
diff changeset
41 self.client.update(self.node0)
143
4359cabcb0cc hglib: move string literals in the test code to util.b() (issue4520)
Brett Cannon <brett@python.org>
parents: 46
diff changeset
42 self.client.remove(b('a'))
4359cabcb0cc hglib: move string literals in the test code to util.b() (issue4520)
Brett Cannon <brett@python.org>
parents: 46
diff changeset
43 rev, node = self.client.commit(b('remove'))
46
ebcc5d7dd528 client: introduce merge handlers
Idan Kamara <idankk86@gmail.com>
parents: 45
diff changeset
44
ebcc5d7dd528 client: introduce merge handlers
Idan Kamara <idankk86@gmail.com>
parents: 45
diff changeset
45 self.client.merge(cb=hglib.merge.handlers.noninteractive)
ebcc5d7dd528 client: introduce merge handlers
Idan Kamara <idankk86@gmail.com>
parents: 45
diff changeset
46
143
4359cabcb0cc hglib: move string literals in the test code to util.b() (issue4520)
Brett Cannon <brett@python.org>
parents: 46
diff changeset
47 diff = b("diff -r ") + node[:12] + b(""" a
46
ebcc5d7dd528 client: introduce merge handlers
Idan Kamara <idankk86@gmail.com>
parents: 45
diff changeset
48 --- /dev/null
ebcc5d7dd528 client: introduce merge handlers
Idan Kamara <idankk86@gmail.com>
parents: 45
diff changeset
49 +++ b/a
ebcc5d7dd528 client: introduce merge handlers
Idan Kamara <idankk86@gmail.com>
parents: 45
diff changeset
50 @@ -0,0 +1,1 @@
ebcc5d7dd528 client: introduce merge handlers
Idan Kamara <idankk86@gmail.com>
parents: 45
diff changeset
51 +aa
ebcc5d7dd528 client: introduce merge handlers
Idan Kamara <idankk86@gmail.com>
parents: 45
diff changeset
52 \ No newline at end of file
143
4359cabcb0cc hglib: move string literals in the test code to util.b() (issue4520)
Brett Cannon <brett@python.org>
parents: 46
diff changeset
53 """)
46
ebcc5d7dd528 client: introduce merge handlers
Idan Kamara <idankk86@gmail.com>
parents: 45
diff changeset
54 self.assertEquals(diff, self.client.diff(nodates=True))
ebcc5d7dd528 client: introduce merge handlers
Idan Kamara <idankk86@gmail.com>
parents: 45
diff changeset
55
ebcc5d7dd528 client: introduce merge handlers
Idan Kamara <idankk86@gmail.com>
parents: 45
diff changeset
56 def test_merge_prompt_cb(self):
ebcc5d7dd528 client: introduce merge handlers
Idan Kamara <idankk86@gmail.com>
parents: 45
diff changeset
57 self.client.update(self.node0)
143
4359cabcb0cc hglib: move string literals in the test code to util.b() (issue4520)
Brett Cannon <brett@python.org>
parents: 46
diff changeset
58 self.client.remove(b('a'))
4359cabcb0cc hglib: move string literals in the test code to util.b() (issue4520)
Brett Cannon <brett@python.org>
parents: 46
diff changeset
59 rev, node = self.client.commit(b('remove'))
46
ebcc5d7dd528 client: introduce merge handlers
Idan Kamara <idankk86@gmail.com>
parents: 45
diff changeset
60
ebcc5d7dd528 client: introduce merge handlers
Idan Kamara <idankk86@gmail.com>
parents: 45
diff changeset
61 def cb(output):
143
4359cabcb0cc hglib: move string literals in the test code to util.b() (issue4520)
Brett Cannon <brett@python.org>
parents: 46
diff changeset
62 return b('c')
46
ebcc5d7dd528 client: introduce merge handlers
Idan Kamara <idankk86@gmail.com>
parents: 45
diff changeset
63
ebcc5d7dd528 client: introduce merge handlers
Idan Kamara <idankk86@gmail.com>
parents: 45
diff changeset
64 self.client.merge(cb=cb)
ebcc5d7dd528 client: introduce merge handlers
Idan Kamara <idankk86@gmail.com>
parents: 45
diff changeset
65
143
4359cabcb0cc hglib: move string literals in the test code to util.b() (issue4520)
Brett Cannon <brett@python.org>
parents: 46
diff changeset
66 diff = b("diff -r ") + node[:12] + b(""" a
46
ebcc5d7dd528 client: introduce merge handlers
Idan Kamara <idankk86@gmail.com>
parents: 45
diff changeset
67 --- /dev/null
ebcc5d7dd528 client: introduce merge handlers
Idan Kamara <idankk86@gmail.com>
parents: 45
diff changeset
68 +++ b/a
ebcc5d7dd528 client: introduce merge handlers
Idan Kamara <idankk86@gmail.com>
parents: 45
diff changeset
69 @@ -0,0 +1,1 @@
ebcc5d7dd528 client: introduce merge handlers
Idan Kamara <idankk86@gmail.com>
parents: 45
diff changeset
70 +aa
ebcc5d7dd528 client: introduce merge handlers
Idan Kamara <idankk86@gmail.com>
parents: 45
diff changeset
71 \ No newline at end of file
143
4359cabcb0cc hglib: move string literals in the test code to util.b() (issue4520)
Brett Cannon <brett@python.org>
parents: 46
diff changeset
72 """)
46
ebcc5d7dd528 client: introduce merge handlers
Idan Kamara <idankk86@gmail.com>
parents: 45
diff changeset
73 self.assertEquals(diff, self.client.diff(nodates=True))