# HG changeset patch # User Mads Kiilerich # Date 2013-10-17 08:13:15 # Node ID cce7ab960312e8212b7bc3571043a57237f0de85 # Parent 29f12a7a03eedd844151f2e09963fe7d53753036 largefiles: hide passwords in URLs in ui messages diff --git a/hgext/largefiles/basestore.py b/hgext/largefiles/basestore.py --- a/hgext/largefiles/basestore.py +++ b/hgext/largefiles/basestore.py @@ -26,10 +26,11 @@ class StoreError(Exception): def longmessage(self): return (_("error getting id %s from url %s for file %s: %s\n") % - (self.hash, self.url, self.filename, self.detail)) + (self.hash, util.hidepassword(self.url), self.filename, + self.detail)) def __str__(self): - return "%s: %s" % (self.url, self.detail) + return "%s: %s" % (util.hidepassword(self.url), self.detail) class basestore(object): def __init__(self, ui, repo, url): @@ -69,7 +70,7 @@ class basestore(object): if not available.get(hash): ui.warn(_('%s: largefile %s not available from %s\n') - % (filename, hash, self.url)) + % (filename, hash, util.hidepassword(self.url))) missing.append(filename) continue @@ -214,4 +215,5 @@ def _openstore(repo, remote=None, put=Fa except lfutil.storeprotonotcapable: pass - raise util.Abort(_('%s does not appear to be a largefile store') % path) + raise util.Abort(_('%s does not appear to be a largefile store') % + util.hidepassword(path)) diff --git a/hgext/largefiles/remotestore.py b/hgext/largefiles/remotestore.py --- a/hgext/largefiles/remotestore.py +++ b/hgext/largefiles/remotestore.py @@ -24,9 +24,10 @@ class remotestore(basestore.basestore): if self.sendfile(source, hash): raise util.Abort( _('remotestore: could not put %s to remote store %s') - % (source, self.url)) + % (source, util.hidepassword(self.url))) self.ui.debug( - _('remotestore: put %s to remote store %s\n') % (source, self.url)) + _('remotestore: put %s to remote store %s\n') + % (source, util.hidepassword(self.url))) def exists(self, hashes): return dict((h, s == 0) for (h, s) in self._stat(hashes).iteritems()) @@ -57,7 +58,8 @@ class remotestore(basestore.basestore): # This usually indicates a connection problem, so don't # keep trying with the other files... they will probably # all fail too. - raise util.Abort('%s: %s' % (self.url, e.reason)) + raise util.Abort('%s: %s' % + (util.hidepassword(self.url), e.reason)) except IOError, e: raise basestore.StoreError(filename, hash, self.url, str(e)) diff --git a/tests/test-largefiles-cache.t b/tests/test-largefiles-cache.t --- a/tests/test-largefiles-cache.t +++ b/tests/test-largefiles-cache.t @@ -47,7 +47,7 @@ but there is no cache file for it. So, $ hg update -r0 getting changed largefiles - large: largefile 7f7097b041ccf68cc5561e9600da4655d21c6d18 not available from file:$TESTTMP/mirror (glob) + large: largefile 7f7097b041ccf68cc5561e9600da4655d21c6d18 not available from file://$TESTTMP/mirror (glob) 0 largefiles updated, 0 removed 1 files updated, 0 files merged, 0 files removed, 0 files unresolved $ hg status @@ -64,7 +64,7 @@ Update working directory to tip, again. $ hg update -r0 getting changed largefiles - large: largefile 7f7097b041ccf68cc5561e9600da4655d21c6d18 not available from file:$TESTTMP/mirror (glob) + large: largefile 7f7097b041ccf68cc5561e9600da4655d21c6d18 not available from file://$TESTTMP/mirror (glob) 0 largefiles updated, 0 removed 1 files updated, 0 files merged, 0 files removed, 0 files unresolved $ hg status diff --git a/tests/test-largefiles.t b/tests/test-largefiles.t --- a/tests/test-largefiles.t +++ b/tests/test-largefiles.t @@ -1280,7 +1280,7 @@ Update to revision with missing largefil $ rm ${USERCACHE}/7838695e10da2bb75ac1156565f40a2595fa2fa0 $ hg up -r 6 getting changed largefiles - large3: largefile 7838695e10da2bb75ac1156565f40a2595fa2fa0 not available from file:$TESTTMP/d (glob) + large3: largefile 7838695e10da2bb75ac1156565f40a2595fa2fa0 not available from file://$TESTTMP/d (glob) 1 largefiles updated, 2 removed 4 files updated, 0 files merged, 2 files removed, 0 files unresolved $ rm normal3 @@ -1301,7 +1301,7 @@ Update to revision with missing largefil ! normal3 $ hg up -Cr. getting changed largefiles - large3: largefile 7838695e10da2bb75ac1156565f40a2595fa2fa0 not available from file:$TESTTMP/d (glob) + large3: largefile 7838695e10da2bb75ac1156565f40a2595fa2fa0 not available from file://$TESTTMP/d (glob) 0 largefiles updated, 0 removed 1 files updated, 0 files merged, 0 files removed, 0 files unresolved $ hg st @@ -1323,7 +1323,7 @@ Merge with revision with missing largefi 4 files updated, 0 files merged, 0 files removed, 0 files unresolved (branch merge, don't forget to commit) getting changed largefiles - large3: largefile 7838695e10da2bb75ac1156565f40a2595fa2fa0 not available from file:$TESTTMP/d (glob) + large3: largefile 7838695e10da2bb75ac1156565f40a2595fa2fa0 not available from file://$TESTTMP/d (glob) 1 largefiles updated, 0 removed $ hg rollback -q diff --git a/tests/test-lfconvert.t b/tests/test-lfconvert.t --- a/tests/test-lfconvert.t +++ b/tests/test-lfconvert.t @@ -343,7 +343,7 @@ Ensure the abort message is useful if a $ rm largefiles-repo/.hg/largefiles/* $ hg lfconvert --to-normal issue3519 normalized3519 initializing destination normalized3519 - large: largefile 2e000fa7e85759c7f4c254d4d9c33ef481e459a7 not available from file:$TESTTMP/largefiles-repo (glob) + large: largefile 2e000fa7e85759c7f4c254d4d9c33ef481e459a7 not available from file://$TESTTMP/largefiles-repo (glob) abort: missing largefile 'large' from revision d4892ec57ce212905215fad1d9018f56b99202ad [255]