comparison hgext/largefiles/basestore.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 d55b71393907
comparison
equal deleted inserted replaced
46906:33524c46a092 46907:ffd3e823a7e5
10 from __future__ import absolute_import 10 from __future__ import absolute_import
11 11
12 from mercurial.i18n import _ 12 from mercurial.i18n import _
13 13
14 from mercurial import node, util 14 from mercurial import node, util
15 from mercurial.utils import (
16 urlutil,
17 )
15 18
16 from . import lfutil 19 from . import lfutil
17 20
18 21
19 class StoreError(Exception): 22 class StoreError(Exception):
27 self.detail = detail 30 self.detail = detail
28 31
29 def longmessage(self): 32 def longmessage(self):
30 return _(b"error getting id %s from url %s for file %s: %s\n") % ( 33 return _(b"error getting id %s from url %s for file %s: %s\n") % (
31 self.hash, 34 self.hash,
32 util.hidepassword(self.url), 35 urlutil.hidepassword(self.url),
33 self.filename, 36 self.filename,
34 self.detail, 37 self.detail,
35 ) 38 )
36 39
37 def __str__(self): 40 def __str__(self):
38 return b"%s: %s" % (util.hidepassword(self.url), self.detail) 41 return b"%s: %s" % (urlutil.hidepassword(self.url), self.detail)
39 42
40 43
41 class basestore(object): 44 class basestore(object):
42 def __init__(self, ui, repo, url): 45 def __init__(self, ui, repo, url):
43 self.ui = ui 46 self.ui = ui
77 ui.note(_(b'getting %s:%s\n') % (filename, hash)) 80 ui.note(_(b'getting %s:%s\n') % (filename, hash))
78 81
79 if not available.get(hash): 82 if not available.get(hash):
80 ui.warn( 83 ui.warn(
81 _(b'%s: largefile %s not available from %s\n') 84 _(b'%s: largefile %s not available from %s\n')
82 % (filename, hash, util.hidepassword(self.url)) 85 % (filename, hash, urlutil.hidepassword(self.url))
83 ) 86 )
84 missing.append(filename) 87 missing.append(filename)
85 continue 88 continue
86 89
87 if self._gethash(filename, hash): 90 if self._gethash(filename, hash):