##// END OF EJS Templates
wireproto: in batch queries, support queries with immediate responses...
Valentin Gatien-Baron -
r41085:55e8da48 default
parent child Browse files
Show More
@@ -0,0 +1,46 b''
1 Checking how hg behaves when one side of a pull/push doesn't support
2 some capability (because it's running an older hg version, usually).
3
4 $ hg init repo1
5 $ cd repo1
6 $ echo a > a; hg add -q a; hg commit -q -m a
7 $ hg bookmark a
8 $ hg clone -q . ../repo2
9 $ cd ../repo2
10
11 $ touch $TESTTMP/disable-lookup.py
12 $ disable_cap() {
13 > rm -f $TESTTMP/disable-lookup.pyc # pyc caching is buggy
14 > cat <<EOF > $TESTTMP/disable-lookup.py
15 > from mercurial import extensions, wireprotov1server
16 > def wcapabilities(orig, *args, **kwargs):
17 > cap = orig(*args, **kwargs)
18 > cap.remove('$1')
19 > return cap
20 > extensions.wrapfunction(wireprotov1server, '_capabilities', wcapabilities)
21 > EOF
22 > }
23 $ cat >> ../repo1/.hg/hgrc <<EOF
24 > [extensions]
25 > disable-lookup = $TESTTMP/disable-lookup.py
26 > EOF
27 $ cat >> .hg/hgrc <<EOF
28 > [ui]
29 > ssh = "$PYTHON" "$TESTDIR/dummyssh"
30 > EOF
31
32 $ hg pull ssh://user@dummy/repo1 -r tip -B a
33 pulling from ssh://user@dummy/repo1
34 no changes found
35
36 $ disable_cap lookup
37 $ hg pull ssh://user@dummy/repo1 -r tip -B a
38 pulling from ssh://user@dummy/repo1
39 abort: other repository doesn't support revision lookup, so a rev cannot be specified.
40 [255]
41
42 $ disable_cap pushkey
43 $ hg pull ssh://user@dummy/repo1 -r tip -B a
44 pulling from ssh://user@dummy/repo1
45 abort: remote bookmark a not found!
46 [255]
@@ -240,13 +240,16 b' class peerexecutor(object):'
240
240
241 # Encoded arguments and future holding remote result.
241 # Encoded arguments and future holding remote result.
242 try:
242 try:
243 encodedargs, fremote = next(batchable)
243 encargsorres, fremote = next(batchable)
244 except Exception:
244 except Exception:
245 pycompat.future_set_exception_info(f, sys.exc_info()[1:])
245 pycompat.future_set_exception_info(f, sys.exc_info()[1:])
246 return
246 return
247
247
248 requests.append((command, encodedargs))
248 if not fremote:
249 states.append((command, f, batchable, fremote))
249 f.set_result(encargsorres)
250 else:
251 requests.append((command, encargsorres))
252 states.append((command, f, batchable, fremote))
250
253
251 if not requests:
254 if not requests:
252 return
255 return
General Comments 0
You need to be logged in to leave comments. Login now