Mercurial > hg
comparison hgext/largefiles/proto.py @ 21084:70252bdfd39c
largefiles: import whole modules instead of importing parts of them
Be more friendly to demandimport.
author | Mads Kiilerich <madski@unity3d.com> |
---|---|
date | Tue, 08 Apr 2014 00:48:36 +0200 |
parents | 29f12a7a03ee |
children | bee00e0c2e45 |
comparison
equal
deleted
inserted
replaced
21083:20b0c49c032c | 21084:70252bdfd39c |
---|---|
6 import os | 6 import os |
7 import urllib2 | 7 import urllib2 |
8 import re | 8 import re |
9 | 9 |
10 from mercurial import error, httppeer, util, wireproto | 10 from mercurial import error, httppeer, util, wireproto |
11 from mercurial.wireproto import batchable, future | |
12 from mercurial.i18n import _ | 11 from mercurial.i18n import _ |
13 | 12 |
14 import lfutil | 13 import lfutil |
15 | 14 |
16 LARGEFILES_REQUIRED_MSG = ('\nThis repository uses the largefiles extension.' | 15 LARGEFILES_REQUIRED_MSG = ('\nThis repository uses the largefiles extension.' |
133 chunk = stream.read(1) | 132 chunk = stream.read(1) |
134 if chunk: | 133 if chunk: |
135 self._abort(error.ResponseError(_("unexpected response:"), | 134 self._abort(error.ResponseError(_("unexpected response:"), |
136 chunk)) | 135 chunk)) |
137 | 136 |
138 @batchable | 137 @wireproto.batchable |
139 def statlfile(self, sha): | 138 def statlfile(self, sha): |
140 f = future() | 139 f = wireproto.future() |
141 result = {'sha': sha} | 140 result = {'sha': sha} |
142 yield result, f | 141 yield result, f |
143 try: | 142 try: |
144 yield int(f.value) | 143 yield int(f.value) |
145 except (ValueError, urllib2.HTTPError): | 144 except (ValueError, urllib2.HTTPError): |