Mercurial > python-hglib
annotate tests/test-merge.py @ 152:0808bb03add5
util: don't try to use itertools.izip under Python 3 (issue4520)
In Python 3, itertools.izip became builtins.zip.
author | Brett Cannon <brett@python.org> |
---|---|
date | Fri, 20 Mar 2015 16:32:53 -0400 |
parents | c1b966866ed7 |
children | 8c4d24b58c23 |
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 | 4 |
5 class test_merge(common.basetest): | |
6 def setUp(self): | |
7 common.basetest.setUp(self) | |
8 | |
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 | 11 |
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 | 14 |
15 def test_basic(self): | |
16 self.client.update(self.node0) | |
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 | 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 | 22 --- a/a |
23 +++ b/a | |
24 @@ -1,1 +1,1 @@ | |
25 -a | |
26 \ No newline at end of file | |
27 +aa | |
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 | 30 |
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)) |