annotate tests/test-resolve.py @ 180:ff6efc1ab9e4

protocol: allow hglib user to get call backs for prompts, output and errors setcbout(cbout), setcberr(cberr) and setcbprompt(cbprompt) are used to set the call back function used by the hgclient class. cb stands for call back. cbout is a function that will be called with the stdout data of the command as it runs. cbout is called with output as it is made available, which can be as partial lines or multiple lines. cberr is a function that will be called with the stderr data of the command as it runs. cberr is called with output as it is made available, which can be as partial lines or multiple lines. Command that make remote connects can prompt for username and password for HTTP/HTTPS connections. cbprompt is called when hgclient need a response to a prompt from the server. It receives the max number of bytes to return and the contents of stdout received so far. The last text sent to either cbout or cberr will contain the prompt text itself.
author Barry A. Scott <barry@barrys-emacs.org>
date Fri, 28 Oct 2016 11:33:20 +0100
parents c1b966866ed7
children
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: 134
diff changeset
3 from hglib.util import b
63
939d1d763bb1 client: add resolve command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
4
939d1d763bb1 client: add resolve command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
5 class test_resolve(common.basetest):
939d1d763bb1 client: add resolve command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
6 def setUp(self):
939d1d763bb1 client: add resolve command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
7 common.basetest.setUp(self)
939d1d763bb1 client: add resolve command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
8
939d1d763bb1 client: add resolve command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
9 self.append('a', 'a')
939d1d763bb1 client: add resolve command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
10 self.append('b', 'b')
143
4359cabcb0cc hglib: move string literals in the test code to util.b() (issue4520)
Brett Cannon <brett@python.org>
parents: 134
diff changeset
11 rev, self.node0 = self.client.commit(b('first'), addremove=True)
63
939d1d763bb1 client: add resolve command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
12
939d1d763bb1 client: add resolve command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
13 self.append('a', 'a')
939d1d763bb1 client: add resolve command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
14 self.append('b', 'b')
143
4359cabcb0cc hglib: move string literals in the test code to util.b() (issue4520)
Brett Cannon <brett@python.org>
parents: 134
diff changeset
15 rev, self.node1 = self.client.commit(b('second'))
63
939d1d763bb1 client: add resolve command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
16
939d1d763bb1 client: add resolve command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
17 def test_basic(self):
939d1d763bb1 client: add resolve command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
18 self.client.update(self.node0)
939d1d763bb1 client: add resolve command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
19 self.append('a', 'b')
939d1d763bb1 client: add resolve command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
20 self.append('b', 'a')
143
4359cabcb0cc hglib: move string literals in the test code to util.b() (issue4520)
Brett Cannon <brett@python.org>
parents: 134
diff changeset
21 rev, self.node3 = self.client.commit(b('third'))
63
939d1d763bb1 client: add resolve command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
22
134
1b47146a4a2c style: fix long lines
Matt Mackall <mpm@selenic.com>
parents: 63
diff changeset
23 self.assertRaises(hglib.error.CommandError, self.client.merge,
1b47146a4a2c style: fix long lines
Matt Mackall <mpm@selenic.com>
parents: 63
diff changeset
24 self.node1)
1b47146a4a2c style: fix long lines
Matt Mackall <mpm@selenic.com>
parents: 63
diff changeset
25 self.assertRaises(hglib.error.CommandError,
1b47146a4a2c style: fix long lines
Matt Mackall <mpm@selenic.com>
parents: 63
diff changeset
26 self.client.resolve, all=True)
63
939d1d763bb1 client: add resolve command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
27
143
4359cabcb0cc hglib: move string literals in the test code to util.b() (issue4520)
Brett Cannon <brett@python.org>
parents: 134
diff changeset
28 self.assertEquals([(b('U'), b('a')), (b('U'), b('b'))],
63
939d1d763bb1 client: add resolve command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
29 self.client.resolve(listfiles=True))
939d1d763bb1 client: add resolve command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
30
143
4359cabcb0cc hglib: move string literals in the test code to util.b() (issue4520)
Brett Cannon <brett@python.org>
parents: 134
diff changeset
31 self.client.resolve(b('a'), mark=True)
4359cabcb0cc hglib: move string literals in the test code to util.b() (issue4520)
Brett Cannon <brett@python.org>
parents: 134
diff changeset
32 self.assertEquals([(b('R'), b('a')), (b('U'), b('b'))],
63
939d1d763bb1 client: add resolve command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
33 self.client.resolve(listfiles=True))