Mercurial > public > mercurial-scm > python-hglib
annotate tests/test-outgoing-incoming.py @ 179:c4c0efb37187
protocol: add the abilty to trace the protocol between the client and server
This is useful when debugging issues with driving hg via hglib
where output and error messages can be lost.
Call setprotocoltrace with the name of a trace function or None.
If the trace function is None no tracing is done.
The trace function is called with the direction, the channel-identified
and its data.
author | Barry A. Scott <barry@barrys-emacs.org> |
---|---|
date | Tue, 18 Oct 2016 17:45:17 +0100 |
parents | c1b966866ed7 |
children |
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 |
7
eac8be119d81
tests: rearrange tests and use nosetests
Idan Kamara <idankk86@gmail.com>
parents:
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:
27
diff
changeset
|
3 from hglib.util import b |
7
eac8be119d81
tests: rearrange tests and use nosetests
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
4 |
eac8be119d81
tests: rearrange tests and use nosetests
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
5 class test_outgoing_incoming(common.basetest): |
26
b4e5c8745ef3
client: add missing options to outgoing
Idan Kamara <idankk86@gmail.com>
parents:
15
diff
changeset
|
6 def test_no_path(self): |
b4e5c8745ef3
client: add missing options to outgoing
Idan Kamara <idankk86@gmail.com>
parents:
15
diff
changeset
|
7 self.assertRaises(hglib.error.CommandError, self.client.incoming) |
b4e5c8745ef3
client: add missing options to outgoing
Idan Kamara <idankk86@gmail.com>
parents:
15
diff
changeset
|
8 |
b4e5c8745ef3
client: add missing options to outgoing
Idan Kamara <idankk86@gmail.com>
parents:
15
diff
changeset
|
9 def test_empty(self): |
143
4359cabcb0cc
hglib: move string literals in the test code to util.b() (issue4520)
Brett Cannon <brett@python.org>
parents:
27
diff
changeset
|
10 self.client.clone(dest=b('other')) |
4359cabcb0cc
hglib: move string literals in the test code to util.b() (issue4520)
Brett Cannon <brett@python.org>
parents:
27
diff
changeset
|
11 self.other = hglib.open(b('other')) |
26
b4e5c8745ef3
client: add missing options to outgoing
Idan Kamara <idankk86@gmail.com>
parents:
15
diff
changeset
|
12 |
b4e5c8745ef3
client: add missing options to outgoing
Idan Kamara <idankk86@gmail.com>
parents:
15
diff
changeset
|
13 self.assertEquals(self.other.incoming(), []) |
b4e5c8745ef3
client: add missing options to outgoing
Idan Kamara <idankk86@gmail.com>
parents:
15
diff
changeset
|
14 self.assertEquals(self.other.outgoing(), []) |
b4e5c8745ef3
client: add missing options to outgoing
Idan Kamara <idankk86@gmail.com>
parents:
15
diff
changeset
|
15 |
7
eac8be119d81
tests: rearrange tests and use nosetests
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
16 def test_basic(self): |
eac8be119d81
tests: rearrange tests and use nosetests
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
17 self.append('a', 'a') |
143
4359cabcb0cc
hglib: move string literals in the test code to util.b() (issue4520)
Brett Cannon <brett@python.org>
parents:
27
diff
changeset
|
18 self.client.commit(b('first'), addremove=True) |
7
eac8be119d81
tests: rearrange tests and use nosetests
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
19 self.append('a', 'a') |
143
4359cabcb0cc
hglib: move string literals in the test code to util.b() (issue4520)
Brett Cannon <brett@python.org>
parents:
27
diff
changeset
|
20 self.client.commit(b('second')) |
7
eac8be119d81
tests: rearrange tests and use nosetests
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
21 |
143
4359cabcb0cc
hglib: move string literals in the test code to util.b() (issue4520)
Brett Cannon <brett@python.org>
parents:
27
diff
changeset
|
22 self.client.clone(dest=b('other')) |
4359cabcb0cc
hglib: move string literals in the test code to util.b() (issue4520)
Brett Cannon <brett@python.org>
parents:
27
diff
changeset
|
23 other = hglib.open(b('other')) |
7
eac8be119d81
tests: rearrange tests and use nosetests
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
24 |
26
b4e5c8745ef3
client: add missing options to outgoing
Idan Kamara <idankk86@gmail.com>
parents:
15
diff
changeset
|
25 self.assertEquals(self.client.log(), other.log()) |
143
4359cabcb0cc
hglib: move string literals in the test code to util.b() (issue4520)
Brett Cannon <brett@python.org>
parents:
27
diff
changeset
|
26 self.assertEquals(self.client.outgoing(path=b('other')), |
4359cabcb0cc
hglib: move string literals in the test code to util.b() (issue4520)
Brett Cannon <brett@python.org>
parents:
27
diff
changeset
|
27 other.incoming()) |
7
eac8be119d81
tests: rearrange tests and use nosetests
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
28 |
eac8be119d81
tests: rearrange tests and use nosetests
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
29 self.append('a', 'a') |
143
4359cabcb0cc
hglib: move string literals in the test code to util.b() (issue4520)
Brett Cannon <brett@python.org>
parents:
27
diff
changeset
|
30 rev, node = self.client.commit(b('third')) |
4359cabcb0cc
hglib: move string literals in the test code to util.b() (issue4520)
Brett Cannon <brett@python.org>
parents:
27
diff
changeset
|
31 out = self.client.outgoing(path=b('other')) |
7
eac8be119d81
tests: rearrange tests and use nosetests
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
32 |
eac8be119d81
tests: rearrange tests and use nosetests
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
33 self.assertEquals(len(out), 1) |
15
f1af31960414
client: change return value of commit() to (rev, node)
Idan Kamara <idankk86@gmail.com>
parents:
7
diff
changeset
|
34 self.assertEquals(out[0].node, node) |
7
eac8be119d81
tests: rearrange tests and use nosetests
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
35 |
26
b4e5c8745ef3
client: add missing options to outgoing
Idan Kamara <idankk86@gmail.com>
parents:
15
diff
changeset
|
36 self.assertEquals(out, other.incoming()) |
27
46908f4b87d5
client: add bookmarks support to incoming and outgoing
Idan Kamara <idankk86@gmail.com>
parents:
26
diff
changeset
|
37 |
46908f4b87d5
client: add bookmarks support to incoming and outgoing
Idan Kamara <idankk86@gmail.com>
parents:
26
diff
changeset
|
38 def test_bookmarks(self): |
46908f4b87d5
client: add bookmarks support to incoming and outgoing
Idan Kamara <idankk86@gmail.com>
parents:
26
diff
changeset
|
39 self.append('a', 'a') |
143
4359cabcb0cc
hglib: move string literals in the test code to util.b() (issue4520)
Brett Cannon <brett@python.org>
parents:
27
diff
changeset
|
40 self.client.commit(b('first'), addremove=True) |
27
46908f4b87d5
client: add bookmarks support to incoming and outgoing
Idan Kamara <idankk86@gmail.com>
parents:
26
diff
changeset
|
41 self.append('a', 'a') |
143
4359cabcb0cc
hglib: move string literals in the test code to util.b() (issue4520)
Brett Cannon <brett@python.org>
parents:
27
diff
changeset
|
42 self.client.commit(b('second')) |
27
46908f4b87d5
client: add bookmarks support to incoming and outgoing
Idan Kamara <idankk86@gmail.com>
parents:
26
diff
changeset
|
43 |
143
4359cabcb0cc
hglib: move string literals in the test code to util.b() (issue4520)
Brett Cannon <brett@python.org>
parents:
27
diff
changeset
|
44 self.client.clone(dest=b('other')) |
4359cabcb0cc
hglib: move string literals in the test code to util.b() (issue4520)
Brett Cannon <brett@python.org>
parents:
27
diff
changeset
|
45 other = hglib.open(b('other')) |
27
46908f4b87d5
client: add bookmarks support to incoming and outgoing
Idan Kamara <idankk86@gmail.com>
parents:
26
diff
changeset
|
46 |
143
4359cabcb0cc
hglib: move string literals in the test code to util.b() (issue4520)
Brett Cannon <brett@python.org>
parents:
27
diff
changeset
|
47 self.client.bookmark(b('bm1'), 1) |
27
46908f4b87d5
client: add bookmarks support to incoming and outgoing
Idan Kamara <idankk86@gmail.com>
parents:
26
diff
changeset
|
48 |
46908f4b87d5
client: add bookmarks support to incoming and outgoing
Idan Kamara <idankk86@gmail.com>
parents:
26
diff
changeset
|
49 self.assertEquals(other.incoming(bookmarks=True), |
143
4359cabcb0cc
hglib: move string literals in the test code to util.b() (issue4520)
Brett Cannon <brett@python.org>
parents:
27
diff
changeset
|
50 [(b('bm1'), self.client.tip().node[:12])]) |
27
46908f4b87d5
client: add bookmarks support to incoming and outgoing
Idan Kamara <idankk86@gmail.com>
parents:
26
diff
changeset
|
51 |
143
4359cabcb0cc
hglib: move string literals in the test code to util.b() (issue4520)
Brett Cannon <brett@python.org>
parents:
27
diff
changeset
|
52 self.assertEquals(self.client.outgoing(path=b('other'), bookmarks=True), |
4359cabcb0cc
hglib: move string literals in the test code to util.b() (issue4520)
Brett Cannon <brett@python.org>
parents:
27
diff
changeset
|
53 [(b('bm1'), self.client.tip().node[:12])]) |