Mercurial > hg
comparison hgext/largefiles/proto.py @ 28883:032c4c2f802a
pycompat: switch to util.urlreq/util.urlerr for py3 compat
author | timeless <timeless@mozdev.org> |
---|---|
date | Wed, 06 Apr 2016 23:22:12 +0000 |
parents | 33bd95443e7f |
children | 29139be0ccc7 |
comparison
equal
deleted
inserted
replaced
28882:800ec7c048b0 | 28883:032c4c2f802a |
---|---|
2 # | 2 # |
3 # This software may be used and distributed according to the terms of the | 3 # This software may be used and distributed according to the terms of the |
4 # GNU General Public License version 2 or any later version. | 4 # GNU General Public License version 2 or any later version. |
5 | 5 |
6 import os | 6 import os |
7 import urllib2 | |
8 import re | 7 import re |
9 | 8 |
10 from mercurial import error, httppeer, util, wireproto | 9 from mercurial import error, httppeer, util, wireproto |
11 from mercurial.i18n import _ | 10 from mercurial.i18n import _ |
11 | |
12 urlerr = util.urlerr | |
13 urlreq = util.urlreq | |
12 | 14 |
13 import lfutil | 15 import lfutil |
14 | 16 |
15 LARGEFILES_REQUIRED_MSG = ('\nThis repository uses the largefiles extension.' | 17 LARGEFILES_REQUIRED_MSG = ('\nThis repository uses the largefiles extension.' |
16 '\n\nPlease enable it in your Mercurial config ' | 18 '\n\nPlease enable it in your Mercurial config ' |
138 f = wireproto.future() | 140 f = wireproto.future() |
139 result = {'sha': sha} | 141 result = {'sha': sha} |
140 yield result, f | 142 yield result, f |
141 try: | 143 try: |
142 yield int(f.value) | 144 yield int(f.value) |
143 except (ValueError, urllib2.HTTPError): | 145 except (ValueError, urlerr.httperror): |
144 # If the server returns anything but an integer followed by a | 146 # If the server returns anything but an integer followed by a |
145 # newline, newline, it's not speaking our language; if we get | 147 # newline, newline, it's not speaking our language; if we get |
146 # an HTTP error, we can't be sure the largefile is present; | 148 # an HTTP error, we can't be sure the largefile is present; |
147 # either way, consider it missing. | 149 # either way, consider it missing. |
148 yield 2 | 150 yield 2 |