largefiles: cleanup of warnings on errors getting largefiles
authorMads Kiilerich <madski@unity3d.com>
Thu, 13 Dec 2012 19:19:06 +0100
changeset 18155 5206af8894a3
parent 18154 93c697d9c158
child 18156 0e68a3c11295
largefiles: cleanup of warnings on errors getting largefiles Especially the "no default or default-push path set in hgrc" was often very misleading and didn't give any hint where it actually was looking. A long error messages is better than several multi-line messages.
hgext/largefiles/basestore.py
hgext/largefiles/localstore.py
tests/test-largefiles-cache.t
tests/test-largefiles.t
tests/test-lfconvert.t
--- a/hgext/largefiles/basestore.py	Thu Dec 13 19:19:06 2012 +0100
+++ b/hgext/largefiles/basestore.py	Thu Dec 13 19:19:06 2012 +0100
@@ -26,14 +26,8 @@
         self.detail = detail
 
     def longmessage(self):
-        if self.url:
-            return ('%s: %s\n'
-                    '(failed URL: %s)\n'
-                    % (self.filename, self.detail, self.url))
-        else:
-            return ('%s: %s\n'
-                    '(no default or default-push path set in hgrc)\n'
-                    % (self.filename, self.detail))
+        return (_("error getting %s from %s for %s: %s\n") %
+                 (self.hash, self.url, self.filename, self.detail))
 
     def __str__(self):
         return "%s: %s" % (self.url, self.detail)
--- a/hgext/largefiles/localstore.py	Thu Dec 13 19:19:06 2012 +0100
+++ b/hgext/largefiles/localstore.py	Thu Dec 13 19:19:06 2012 +0100
@@ -22,9 +22,8 @@
     the user cache.'''
 
     def __init__(self, ui, repo, remote):
-        url = os.path.join(remote.local().path, '.hg', lfutil.longname)
-        super(localstore, self).__init__(ui, repo, util.expandpath(url))
         self.remote = remote.local()
+        super(localstore, self).__init__(ui, repo, self.remote.url())
 
     def put(self, source, hash):
         util.makedirs(os.path.dirname(lfutil.storepath(self.remote, hash)))
@@ -46,7 +45,7 @@
         elif lfutil.inusercache(self.ui, hash):
             path = lfutil.usercachepath(self.ui, hash)
         else:
-            raise basestore.StoreError(filename, hash, '',
+            raise basestore.StoreError(filename, hash, self.url,
                 _("can't get file locally"))
         fd = open(path, 'rb')
         try:
--- a/tests/test-largefiles-cache.t	Thu Dec 13 19:19:06 2012 +0100
+++ b/tests/test-largefiles-cache.t	Thu Dec 13 19:19:06 2012 +0100
@@ -47,8 +47,7 @@
   $ hg update
   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
   getting changed largefiles
-  large: can't get file locally
-  (no default or default-push path set in hgrc)
+  error getting 7f7097b041ccf68cc5561e9600da4655d21c6d18 from file:$TESTTMP/mirror for large: can't get file locally
   0 largefiles updated, 0 removed
   $ hg status
   ! large
@@ -65,8 +64,7 @@
   $ hg update
   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
   getting changed largefiles
-  large: can't get file locally
-  (no default or default-push path set in hgrc)
+  error getting 7f7097b041ccf68cc5561e9600da4655d21c6d18 from file:$TESTTMP/mirror for large: can't get file locally
   0 largefiles updated, 0 removed
   $ hg status
   ! large
--- a/tests/test-largefiles.t	Thu Dec 13 19:19:06 2012 +0100
+++ b/tests/test-largefiles.t	Thu Dec 13 19:19:06 2012 +0100
@@ -916,24 +916,15 @@
   M sub/normal4
   M sub2/large6
   saved backup bundle to $TESTTMP/d/.hg/strip-backup/f574fb32bb45-backup.hg (glob)
-  large3: can't get file locally
-  (no default or default-push path set in hgrc)
-  sub/large4: can't get file locally
-  (no default or default-push path set in hgrc)
-  large1: can't get file locally
-  (no default or default-push path set in hgrc)
-  sub/large2: can't get file locally
-  (no default or default-push path set in hgrc)
-  sub/large2: can't get file locally
-  (no default or default-push path set in hgrc)
-  large1: can't get file locally
-  (no default or default-push path set in hgrc)
-  sub/large2: can't get file locally
-  (no default or default-push path set in hgrc)
-  large1: can't get file locally
-  (no default or default-push path set in hgrc)
-  sub/large2: can't get file locally
-  (no default or default-push path set in hgrc)
+  error getting eb7338044dc27f9bc59b8dd5a246b065ead7a9c4 from file:$TESTTMP/b for large3: can't get file locally
+  error getting eb7338044dc27f9bc59b8dd5a246b065ead7a9c4 from file:$TESTTMP/b for sub/large4: can't get file locally
+  error getting eb7338044dc27f9bc59b8dd5a246b065ead7a9c4 from file:$TESTTMP/b for large1: can't get file locally
+  error getting eb7338044dc27f9bc59b8dd5a246b065ead7a9c4 from file:$TESTTMP/b for sub/large2: can't get file locally
+  error getting eb7338044dc27f9bc59b8dd5a246b065ead7a9c4 from file:$TESTTMP/b for sub/large2: can't get file locally
+  error getting 5f78770c0e77ba4287ad6ef3071c9bf9c379742f from file:$TESTTMP/b for large1: can't get file locally
+  error getting eb7338044dc27f9bc59b8dd5a246b065ead7a9c4 from file:$TESTTMP/b for sub/large2: can't get file locally
+  error getting 4669e532d5b2c093a78eca010077e708a071bb64 from file:$TESTTMP/b for large1: can't get file locally
+  error getting 1deebade43c8c498a3c8daddac0244dc55d1331d from file:$TESTTMP/b for sub/large2: can't get file locally
   0 additional largefiles cached
   9 largefiles failed to download
   nothing to rebase
--- a/tests/test-lfconvert.t	Thu Dec 13 19:19:06 2012 +0100
+++ b/tests/test-lfconvert.t	Thu Dec 13 19:19:06 2012 +0100
@@ -349,8 +349,7 @@
   $ rm largefiles-repo/.hg/largefiles/*
   $ hg lfconvert --to-normal issue3519 normalized3519
   initializing destination normalized3519
-  large: can't get file locally
-  (no default or default-push path set in hgrc)
+  error getting 2e000fa7e85759c7f4c254d4d9c33ef481e459a7 from file:$TESTTMP/largefiles-repo for large: can't get file locally
   abort: missing largefile 'large' from revision d4892ec57ce212905215fad1d9018f56b99202ad
   [255]