Show More
@@ -92,16 +92,30 b' def _usercachedir(ui, name=longname):' | |||||
92 | path = ui.configpath(name, b'usercache') |
|
92 | path = ui.configpath(name, b'usercache') | |
93 | if path: |
|
93 | if path: | |
94 | return path |
|
94 | return path | |
|
95 | ||||
|
96 | hint = None | |||
|
97 | ||||
95 | if pycompat.iswindows: |
|
98 | if pycompat.iswindows: | |
96 | appdata = encoding.environ.get( |
|
99 | appdata = encoding.environ.get( | |
97 | b'LOCALAPPDATA', encoding.environ.get(b'APPDATA') |
|
100 | b'LOCALAPPDATA', encoding.environ.get(b'APPDATA') | |
98 | ) |
|
101 | ) | |
99 | if appdata: |
|
102 | if appdata: | |
100 | return os.path.join(appdata, name) |
|
103 | return os.path.join(appdata, name) | |
|
104 | ||||
|
105 | hint = _(b"define %s or %s in the environment, or set %s.usercache") % ( | |||
|
106 | b"LOCALAPPDATA", | |||
|
107 | b"APPDATA", | |||
|
108 | name, | |||
|
109 | ) | |||
101 | elif pycompat.isdarwin: |
|
110 | elif pycompat.isdarwin: | |
102 | home = encoding.environ.get(b'HOME') |
|
111 | home = encoding.environ.get(b'HOME') | |
103 | if home: |
|
112 | if home: | |
104 | return os.path.join(home, b'Library', b'Caches', name) |
|
113 | return os.path.join(home, b'Library', b'Caches', name) | |
|
114 | ||||
|
115 | hint = _(b"define %s in the environment, or set %s.usercache") % ( | |||
|
116 | b"HOME", | |||
|
117 | name, | |||
|
118 | ) | |||
105 | elif pycompat.isposix: |
|
119 | elif pycompat.isposix: | |
106 | path = encoding.environ.get(b'XDG_CACHE_HOME') |
|
120 | path = encoding.environ.get(b'XDG_CACHE_HOME') | |
107 | if path: |
|
121 | if path: | |
@@ -109,11 +123,18 b' def _usercachedir(ui, name=longname):' | |||||
109 | home = encoding.environ.get(b'HOME') |
|
123 | home = encoding.environ.get(b'HOME') | |
110 | if home: |
|
124 | if home: | |
111 | return os.path.join(home, b'.cache', name) |
|
125 | return os.path.join(home, b'.cache', name) | |
|
126 | ||||
|
127 | hint = _(b"define %s or %s in the environment, or set %s.usercache") % ( | |||
|
128 | b"XDG_CACHE_HOME", | |||
|
129 | b"HOME", | |||
|
130 | name, | |||
|
131 | ) | |||
112 | else: |
|
132 | else: | |
113 | raise error.Abort( |
|
133 | raise error.Abort( | |
114 | _(b'unknown operating system: %s\n') % pycompat.osname |
|
134 | _(b'unknown operating system: %s\n') % pycompat.osname | |
115 | ) |
|
135 | ) | |
116 | raise error.Abort(_(b'unknown %s usercache location') % name) |
|
136 | ||
|
137 | raise error.Abort(_(b'unknown %s usercache location') % name, hint=hint) | |||
117 |
|
138 | |||
118 |
|
139 | |||
119 | def inusercache(ui, hash): |
|
140 | def inusercache(ui, hash): |
@@ -95,3 +95,32 b' Apply bundles' | |||||
95 | OK |
|
95 | OK | |
96 | ---- Applying src-lfs.bundle to dst-lfs ---- |
|
96 | ---- Applying src-lfs.bundle to dst-lfs ---- | |
97 | OK |
|
97 | OK | |
|
98 | ||||
|
99 | Hint if the cache location cannot be inferred from the environment | |||
|
100 | ||||
|
101 | #if windows | |||
|
102 | $ unset LOCALAPPDATA | |||
|
103 | $ unset APPDATA | |||
|
104 | $ HGRCPATH= hg config lfs --debug | |||
|
105 | abort: unknown lfs usercache location | |||
|
106 | (define LOCALAPPDATA or APPDATA in the environment, or set lfs.usercache) | |||
|
107 | [255] | |||
|
108 | #endif | |||
|
109 | ||||
|
110 | #if osx | |||
|
111 | $ unset HOME | |||
|
112 | $ HGRCPATH= hg config lfs --debug | |||
|
113 | abort: unknown lfs usercache location | |||
|
114 | (define HOME in the environment, or set lfs.usercache) | |||
|
115 | [255] | |||
|
116 | #endif | |||
|
117 | ||||
|
118 | #if no-windows no-osx | |||
|
119 | $ unset XDG_CACHE_HOME | |||
|
120 | $ unset HOME | |||
|
121 | $ HGRCPATH= hg config lfs --debug | |||
|
122 | abort: unknown lfs usercache location | |||
|
123 | (define XDG_CACHE_HOME or HOME in the environment, or set lfs.usercache) | |||
|
124 | [255] | |||
|
125 | #endif | |||
|
126 |
General Comments 0
You need to be logged in to leave comments.
Login now