Show More
@@ -91,22 +91,28 def usercachepath(ui, hash): | |||||
91 | else: |
|
91 | else: | |
92 | if os.name == 'nt': |
|
92 | if os.name == 'nt': | |
93 | appdata = os.getenv('LOCALAPPDATA', os.getenv('APPDATA')) |
|
93 | appdata = os.getenv('LOCALAPPDATA', os.getenv('APPDATA')) | |
94 | path = os.path.join(appdata, longname, hash) |
|
94 | if appdata: | |
|
95 | path = os.path.join(appdata, longname, hash) | |||
95 | elif platform.system() == 'Darwin': |
|
96 | elif platform.system() == 'Darwin': | |
96 |
|
|
97 | home = os.getenv('HOME') | |
97 | longname, hash) |
|
98 | if home: | |
|
99 | path = os.path.join(home, 'Library', 'Caches', | |||
|
100 | longname, hash) | |||
98 | elif os.name == 'posix': |
|
101 | elif os.name == 'posix': | |
99 | path = os.getenv('XDG_CACHE_HOME') |
|
102 | path = os.getenv('XDG_CACHE_HOME') | |
100 | if path: |
|
103 | if path: | |
101 | path = os.path.join(path, longname, hash) |
|
104 | path = os.path.join(path, longname, hash) | |
102 | else: |
|
105 | else: | |
103 |
|
|
106 | home = os.getenv('HOME') | |
|
107 | if home: | |||
|
108 | path = os.path.join(home, '.cache', longname, hash) | |||
104 | else: |
|
109 | else: | |
105 | raise util.Abort(_('unknown operating system: %s\n') % os.name) |
|
110 | raise util.Abort(_('unknown operating system: %s\n') % os.name) | |
106 | return path |
|
111 | return path | |
107 |
|
112 | |||
108 | def inusercache(ui, hash): |
|
113 | def inusercache(ui, hash): | |
109 |
|
|
114 | path = usercachepath(ui, hash) | |
|
115 | return path and os.path.exists(path) | |||
110 |
|
116 | |||
111 | def findfile(repo, hash): |
|
117 | def findfile(repo, hash): | |
112 | if instore(repo, hash): |
|
118 | if instore(repo, hash): | |
@@ -239,8 +245,10 def copytostoreabsolute(repo, file, hash | |||||
239 | linktousercache(repo, hash) |
|
245 | linktousercache(repo, hash) | |
240 |
|
246 | |||
241 | def linktousercache(repo, hash): |
|
247 | def linktousercache(repo, hash): | |
242 |
|
|
248 | path = usercachepath(repo.ui, hash) | |
243 | link(storepath(repo, hash), usercachepath(repo.ui, hash)) |
|
249 | if path: | |
|
250 | util.makedirs(os.path.dirname(path)) | |||
|
251 | link(storepath(repo, hash), path) | |||
244 |
|
252 | |||
245 | def getstandinmatcher(repo, pats=[], opts={}): |
|
253 | def getstandinmatcher(repo, pats=[], opts={}): | |
246 | '''Return a match object that applies pats to the standin directory''' |
|
254 | '''Return a match object that applies pats to the standin directory''' |
General Comments 0
You need to be logged in to leave comments.
Login now