Show More
@@ -6,16 +6,8 b'' | |||
|
6 | 6 | # GNU General Public License version 2 or any later version. |
|
7 | 7 | |
|
8 | 8 | import util, error |
|
9 | ||
|
10 | 9 | from mercurial import store |
|
11 | 10 | |
|
12 | class StreamException(Exception): | |
|
13 | def __init__(self, code): | |
|
14 | Exception.__init__(self) | |
|
15 | self.code = code | |
|
16 | def __str__(self): | |
|
17 | return '%i\n' % self.code | |
|
18 | ||
|
19 | 11 | # if server supports streaming clone, it advertises "stream" |
|
20 | 12 | # capability with value that is version+flags of repo it is serving. |
|
21 | 13 | # client only streams if it can read that repo format. |
@@ -40,7 +32,8 b' def stream_out(repo):' | |||
|
40 | 32 | writes to file-like object, must support write() and optional flush().''' |
|
41 | 33 | |
|
42 | 34 | if not allowed(repo.ui): |
|
43 | raise StreamException(1) | |
|
35 | yield '1\n' # error: 1 | |
|
36 | return | |
|
44 | 37 | |
|
45 | 38 | entries = [] |
|
46 | 39 | total_bytes = 0 |
@@ -55,9 +48,10 b' def stream_out(repo):' | |||
|
55 | 48 | finally: |
|
56 | 49 | lock.release() |
|
57 | 50 | except error.LockError: |
|
58 | raise StreamException(2) | |
|
51 | yield '2\n' # error: 2 | |
|
52 | return | |
|
59 | 53 | |
|
60 | yield '0\n' | |
|
54 | yield '0\n' # success | |
|
61 | 55 | repo.ui.debug('%d files, %d bytes to transfer\n' % |
|
62 | 56 | (len(entries), total_bytes)) |
|
63 | 57 | yield '%d %d\n' % (len(entries), total_bytes) |
General Comments 0
You need to be logged in to leave comments.
Login now