changeset 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 29f12a7a03ee
children d51c4d85ec23
files hgext/largefiles/basestore.py hgext/largefiles/remotestore.py tests/test-largefiles-cache.t tests/test-largefiles.t tests/test-lfconvert.t
diffstat 5 files changed, 17 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/largefiles/basestore.py	Thu Oct 24 01:49:56 2013 +0800
+++ b/hgext/largefiles/basestore.py	Thu Oct 17 16:13:15 2013 +0800
@@ -26,10 +26,11 @@
 
     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 @@
 
             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 @@
         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))
--- a/hgext/largefiles/remotestore.py	Thu Oct 24 01:49:56 2013 +0800
+++ b/hgext/largefiles/remotestore.py	Thu Oct 17 16:13:15 2013 +0800
@@ -24,9 +24,10 @@
         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 @@
             # 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))
 
--- a/tests/test-largefiles-cache.t	Thu Oct 24 01:49:56 2013 +0800
+++ b/tests/test-largefiles-cache.t	Thu Oct 17 16:13:15 2013 +0800
@@ -47,7 +47,7 @@
 
   $ 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 @@
 
   $ 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
--- a/tests/test-largefiles.t	Thu Oct 24 01:49:56 2013 +0800
+++ b/tests/test-largefiles.t	Thu Oct 17 16:13:15 2013 +0800
@@ -1280,7 +1280,7 @@
   $ 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 @@
   ! 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 @@
   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
--- a/tests/test-lfconvert.t	Thu Oct 24 01:49:56 2013 +0800
+++ b/tests/test-lfconvert.t	Thu Oct 17 16:13:15 2013 +0800
@@ -343,7 +343,7 @@
   $ 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]