Mercurial > hg
changeset 28575:78e4e558fa74
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.
author | Mads Kiilerich <madski@unity3d.com> |
---|---|
date | Sat, 19 Mar 2016 08:27:54 -0700 |
parents | 7a4e1749cb07 |
children | 33bd95443e7f |
files | hgext/largefiles/lfutil.py |
diffstat | 1 files changed, 4 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- 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'''