# HG changeset patch # User Mads Kiilerich # Date 2016-03-19 15:27:54 # Node ID 78e4e558fa74aa4489609953328cbcecf1a8a428 # Parent 7a4e1749cb071ae08b09fe5db592d53accc6816d 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. diff --git a/hgext/largefiles/lfutil.py b/hgext/largefiles/lfutil.py --- a/hgext/largefiles/lfutil.py +++ b/hgext/largefiles/lfutil.py @@ -55,10 +55,7 @@ def usercachepath(ui, hash): 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 @@ def _usercachedir(ui): 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 copytostoreabsolute(repo, file, hash 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'''