Mercurial > hg
comparison hgext/largefiles/remotestore.py @ 46907:ffd3e823a7e5
urlutil: extract `url` related code from `util` into the new module
The new module is well fitting for this new code. And this will be useful to
make the gathered code collaborate more later.
Differential Revision: https://phab.mercurial-scm.org/D10374
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Mon, 12 Apr 2021 03:01:04 +0200 |
parents | 89a2afe31e82 |
children | 6000f5b25c9b |
comparison
equal
deleted
inserted
replaced
46906:33524c46a092 | 46907:ffd3e823a7e5 |
---|---|
13 error, | 13 error, |
14 pycompat, | 14 pycompat, |
15 util, | 15 util, |
16 ) | 16 ) |
17 | 17 |
18 from mercurial.utils import stringutil | 18 from mercurial.utils import ( |
19 stringutil, | |
20 urlutil, | |
21 ) | |
19 | 22 |
20 from . import ( | 23 from . import ( |
21 basestore, | 24 basestore, |
22 lfutil, | 25 lfutil, |
23 localstore, | 26 localstore, |
38 | 41 |
39 def put(self, source, hash): | 42 def put(self, source, hash): |
40 if self.sendfile(source, hash): | 43 if self.sendfile(source, hash): |
41 raise error.Abort( | 44 raise error.Abort( |
42 _(b'remotestore: could not put %s to remote store %s') | 45 _(b'remotestore: could not put %s to remote store %s') |
43 % (source, util.hidepassword(self.url)) | 46 % (source, urlutil.hidepassword(self.url)) |
44 ) | 47 ) |
45 self.ui.debug( | 48 self.ui.debug( |
46 _(b'remotestore: put %s to remote store %s\n') | 49 _(b'remotestore: put %s to remote store %s\n') |
47 % (source, util.hidepassword(self.url)) | 50 % (source, urlutil.hidepassword(self.url)) |
48 ) | 51 ) |
49 | 52 |
50 def exists(self, hashes): | 53 def exists(self, hashes): |
51 return { | 54 return { |
52 h: s == 0 | 55 h: s == 0 |
78 except urlerr.urlerror as e: | 81 except urlerr.urlerror as e: |
79 # This usually indicates a connection problem, so don't | 82 # This usually indicates a connection problem, so don't |
80 # keep trying with the other files... they will probably | 83 # keep trying with the other files... they will probably |
81 # all fail too. | 84 # all fail too. |
82 raise error.Abort( | 85 raise error.Abort( |
83 b'%s: %s' % (util.hidepassword(self.url), e.reason) | 86 b'%s: %s' % (urlutil.hidepassword(self.url), e.reason) |
84 ) | 87 ) |
85 except IOError as e: | 88 except IOError as e: |
86 raise basestore.StoreError( | 89 raise basestore.StoreError( |
87 filename, hash, self.url, stringutil.forcebytestr(e) | 90 filename, hash, self.url, stringutil.forcebytestr(e) |
88 ) | 91 ) |