largefiles: drop partial support for not having a user cache
971c55ce03b8 introduced support for not having a "global" user cache.
In the rare cases where the environment didn't provide the location of the
current home directory, the usercachepath function could return None.
That functionality has since bitrotten and several code paths did not correctly
check for usercachepath returning None:
$ HOME= XDG_CACHE_HOME= hg up --config extensions.largefiles=
getting changed largefiles
abort: unknown largefiles usercache location
Dropping the partial support for it is thus not really a backward compatibility
breaking change.
Thus: consistently fail early if the usercache location is unknown.
It is relevant to be able to control where the largefiles are stored and how
they propagate, but that should probably be done differently. The dysfunctional
code just gets in the way.
--- a/hgext/largefiles/lfutil.py Sat Mar 19 08:23:55 2016 -0700
+++ b/hgext/largefiles/lfutil.py Sat Mar 19 08:27:54 2016 -0700
@@ -55,10 +55,7 @@
with the given hash.
This cache is used for sharing of largefiles across repositories - both
to preserve download bandwidth and storage space.'''
- path = _usercachedir(ui)
- if path:
- return os.path.join(path, hash)
- return None
+ return os.path.join(_usercachedir(ui), hash)
def _usercachedir(ui):
'''Return the location of the "global" largefiles cache.'''
@@ -82,11 +79,11 @@
return os.path.join(home, '.cache', longname)
else:
raise error.Abort(_('unknown operating system: %s\n') % os.name)
- return None
+ raise error.Abort(_('unknown %s usercache location\n') % longname)
def inusercache(ui, hash):
path = usercachepath(ui, hash)
- return path and os.path.exists(path)
+ return os.path.exists(path)
def findfile(repo, hash):
path, exists = findstorepath(repo, hash)
@@ -261,8 +258,7 @@
def linktousercache(repo, hash):
path = usercachepath(repo.ui, hash)
- if path:
- link(storepath(repo, hash), path)
+ link(storepath(repo, hash), path)
def getstandinmatcher(repo, rmatcher=None):
'''Return a match object that applies rmatcher to the standin directory'''