comparison hgext/largefiles/remotestore.py @ 19950:cce7ab960312 stable

largefiles: hide passwords in URLs in ui messages
author Mads Kiilerich <madski@unity3d.com>
date Thu, 17 Oct 2013 16:13:15 +0800
parents 72214af683a2
children a61ed1c2d7a7
comparison
equal deleted inserted replaced
19949:29f12a7a03ee 19950:cce7ab960312
22 22
23 def put(self, source, hash): 23 def put(self, source, hash):
24 if self.sendfile(source, hash): 24 if self.sendfile(source, hash):
25 raise util.Abort( 25 raise util.Abort(
26 _('remotestore: could not put %s to remote store %s') 26 _('remotestore: could not put %s to remote store %s')
27 % (source, self.url)) 27 % (source, util.hidepassword(self.url)))
28 self.ui.debug( 28 self.ui.debug(
29 _('remotestore: put %s to remote store %s\n') % (source, self.url)) 29 _('remotestore: put %s to remote store %s\n')
30 % (source, util.hidepassword(self.url)))
30 31
31 def exists(self, hashes): 32 def exists(self, hashes):
32 return dict((h, s == 0) for (h, s) in self._stat(hashes).iteritems()) 33 return dict((h, s == 0) for (h, s) in self._stat(hashes).iteritems())
33 34
34 def sendfile(self, filename, hash): 35 def sendfile(self, filename, hash):
55 raise basestore.StoreError(filename, hash, self.url, str(e)) 56 raise basestore.StoreError(filename, hash, self.url, str(e))
56 except urllib2.URLError, e: 57 except urllib2.URLError, e:
57 # This usually indicates a connection problem, so don't 58 # This usually indicates a connection problem, so don't
58 # keep trying with the other files... they will probably 59 # keep trying with the other files... they will probably
59 # all fail too. 60 # all fail too.
60 raise util.Abort('%s: %s' % (self.url, e.reason)) 61 raise util.Abort('%s: %s' %
62 (util.hidepassword(self.url), e.reason))
61 except IOError, e: 63 except IOError, e:
62 raise basestore.StoreError(filename, hash, self.url, str(e)) 64 raise basestore.StoreError(filename, hash, self.url, str(e))
63 65
64 return lfutil.copyandhash(chunks, tmpfile) 66 return lfutil.copyandhash(chunks, tmpfile)
65 67