Show More
@@ -166,8 +166,8 b' def _openstore(repo, remote=None, put=Fa' | |||
|
166 | 166 | ui = repo.ui |
|
167 | 167 | |
|
168 | 168 | if not remote: |
|
169 |
path = getattr(repo, 'lfpullsource', None) or |
|
|
170 | ui.expandpath('default-push', 'default') | |
|
169 | path = (getattr(repo, 'lfpullsource', None) or | |
|
170 | ui.expandpath('default-push', 'default')) | |
|
171 | 171 | |
|
172 | 172 | # ui.expandpath() leaves 'default-push' and 'default' alone if |
|
173 | 173 | # they cannot be expanded: fallback to the empty string, |
@@ -383,9 +383,9 b' def cachelfiles(ui, repo, node):' | |||
|
383 | 383 | # if it exists and its hash matches, it might have been locally |
|
384 | 384 | # modified before updating and the user chose 'local'. in this case, |
|
385 | 385 | # it will not be in any store, so don't look for it. |
|
386 |
if (not os.path.exists(repo.wjoin(lfile)) |
|
|
387 |
|
|
|
388 |
|
|
|
386 | if ((not os.path.exists(repo.wjoin(lfile)) or | |
|
387 | expectedhash != lfutil.hashfile(repo.wjoin(lfile))) and | |
|
388 | not lfutil.findfile(repo, expectedhash)): | |
|
389 | 389 | toget.append((lfile, expectedhash)) |
|
390 | 390 | |
|
391 | 391 | if toget: |
@@ -441,9 +441,9 b' def _updatelfile(repo, lfdirstate, lfile' | |||
|
441 | 441 | if os.path.exists(absstandin+'.orig'): |
|
442 | 442 | shutil.copyfile(abslfile, abslfile+'.orig') |
|
443 | 443 | expecthash = lfutil.readstandin(repo, lfile) |
|
444 |
if expecthash != '' and |
|
|
445 |
|
|
|
446 |
|
|
|
444 | if (expecthash != '' and | |
|
445 | (not os.path.exists(abslfile) or | |
|
446 | expecthash != lfutil.hashfile(abslfile))): | |
|
447 | 447 | if not lfutil.copyfromcache(repo, expecthash, lfile): |
|
448 | 448 | return None # don't try to set the mode or update the dirstate |
|
449 | 449 | ret = 1 |
@@ -468,7 +468,6 b' def _updatelfile(repo, lfdirstate, lfile' | |||
|
468 | 468 | |
|
469 | 469 | # -- hg commands declarations ------------------------------------------------ |
|
470 | 470 | |
|
471 | ||
|
472 | 471 | cmdtable = { |
|
473 | 472 | 'lfconvert': (lfconvert, |
|
474 | 473 | [('s', 'size', '', |
@@ -86,8 +86,8 b' def systemcachepath(ui, hash):' | |||
|
86 | 86 | path = os.path.join(path, hash) |
|
87 | 87 | else: |
|
88 | 88 | if os.name == 'nt': |
|
89 |
|
|
|
90 |
|
|
|
89 | appdata = os.getenv('LOCALAPPDATA', os.getenv('APPDATA')) | |
|
90 | path = os.path.join(appdata, longname, hash) | |
|
91 | 91 | elif os.name == 'posix': |
|
92 | 92 | path = os.path.join(os.getenv('HOME'), '.' + longname, hash) |
|
93 | 93 | else: |
@@ -184,7 +184,8 b' def listlfiles(repo, rev=None, matcher=N' | |||
|
184 | 184 | matcher = getstandinmatcher(repo) |
|
185 | 185 | |
|
186 | 186 | # ignore unknown files in working directory |
|
187 |
return [splitstandin(f) |
|
|
187 | return [splitstandin(f) | |
|
188 | for f in repo[rev].walk(matcher) | |
|
188 | 189 | if rev is not None or repo.dirstate[f] != '?'] |
|
189 | 190 | |
|
190 | 191 | def incache(repo, hash): |
@@ -394,8 +395,9 b' def writehash(hash, filename, executable' | |||
|
394 | 395 | |
|
395 | 396 | def getexecutable(filename): |
|
396 | 397 | mode = os.stat(filename).st_mode |
|
397 |
return (mode & stat.S_IXUSR) and |
|
|
398 |
stat.S_IX |
|
|
398 | return ((mode & stat.S_IXUSR) and | |
|
399 | (mode & stat.S_IXGRP) and | |
|
400 | (mode & stat.S_IXOTH)) | |
|
399 | 401 | |
|
400 | 402 | def getmode(executable): |
|
401 | 403 | if executable: |
@@ -92,8 +92,9 b' def override_add(orig, ui, repo, *pats, ' | |||
|
92 | 92 | continue |
|
93 | 93 | |
|
94 | 94 | if exact or not exists: |
|
95 | if large or (lfsize and os.path.getsize(repo.wjoin(f)) >= \ | |
|
96 | lfsize * 1024 * 1024) or (lfmatcher and lfmatcher(f)): | |
|
95 | abovemin = (lfsize and | |
|
96 | os.path.getsize(repo.wjoin(f)) >= lfsize * 1024 * 1024) | |
|
97 | if large or abovemin or (lfmatcher and lfmatcher(f)): | |
|
97 | 98 | lfnames.append(f) |
|
98 | 99 | if ui.verbose or not exact: |
|
99 | 100 | ui.status(_('adding %s as a largefile\n') % m.rel(f)) |
@@ -117,8 +118,9 b' def override_add(orig, ui, repo, *pats, ' | |||
|
117 | 118 | else: |
|
118 | 119 | lfdirstate.add(f) |
|
119 | 120 | lfdirstate.write() |
|
120 |
bad += [lfutil.splitstandin(f) |
|
|
121 | standins) if f in m.files()] | |
|
121 | bad += [lfutil.splitstandin(f) | |
|
122 | for f in lfutil.repo_add(repo, standins) | |
|
123 | if f in m.files()] | |
|
122 | 124 | finally: |
|
123 | 125 | wlock.release() |
|
124 | 126 | |
@@ -143,8 +145,9 b' def override_remove(orig, ui, repo, *pat' | |||
|
143 | 145 | s = repo.status(match=m, clean=True) |
|
144 | 146 | finally: |
|
145 | 147 | repo.lfstatus = False |
|
146 |
modified, added, deleted, clean = [[f for f in list |
|
|
147 | in manifest] for list in [s[0], s[1], s[3], s[6]]] | |
|
148 | modified, added, deleted, clean = [[f for f in list | |
|
149 | if lfutil.standin(f) in manifest] | |
|
150 | for list in [s[0], s[1], s[3], s[6]]] | |
|
148 | 151 | |
|
149 | 152 | def warn(files, reason): |
|
150 | 153 | for f in files: |
@@ -358,9 +361,10 b' def override_copy(orig, ui, repo, pats, ' | |||
|
358 | 361 | m._files = [lfutil.standin(f) for f in m._files if lfile(f)] |
|
359 | 362 | m._fmap = set(m._files) |
|
360 | 363 | orig_matchfn = m.matchfn |
|
361 |
m.matchfn = lambda f: lfutil.isstandin(f) and |
|
|
362 |
lfile(lfutil.splitstandin(f)) and |
|
|
363 |
orig_matchfn(lfutil.splitstandin(f)) or |
|
|
364 | m.matchfn = lambda f: (lfutil.isstandin(f) and | |
|
365 | lfile(lfutil.splitstandin(f)) and | |
|
366 | orig_matchfn(lfutil.splitstandin(f)) or | |
|
367 | None) | |
|
364 | 368 | return m |
|
365 | 369 | oldmatch = installmatchfn(override_match) |
|
366 | 370 | listpats = [] |
@@ -744,8 +748,8 b' def getoutgoinglfiles(ui, repo, dest=Non' | |||
|
744 | 748 | for f in mc: |
|
745 | 749 | if mc[f] != mp1.get(f, None) or mc[f] != mp2.get(f, None): |
|
746 | 750 | files.add(f) |
|
747 |
toupload = toupload.union( |
|
|
748 | and f in ctx])) | |
|
751 | toupload = toupload.union( | |
|
752 | set([f for f in files if lfutil.isstandin(f) and f in ctx])) | |
|
749 | 753 | return toupload |
|
750 | 754 | |
|
751 | 755 | def override_outgoing(orig, ui, repo, dest=None, **opts): |
@@ -12,9 +12,9 b' from mercurial.i18n import _' | |||
|
12 | 12 | |
|
13 | 13 | import lfutil |
|
14 | 14 | |
|
15 |
LARGEFILES_REQUIRED_MSG = '\nThis repository uses the largefiles extension.' |
|
|
16 |
'\n\nPlease enable it in your Mercurial config ' |
|
|
17 | 'file.\n' | |
|
15 | LARGEFILES_REQUIRED_MSG = ('\nThis repository uses the largefiles extension.' | |
|
16 | '\n\nPlease enable it in your Mercurial config ' | |
|
17 | 'file.\n') | |
|
18 | 18 | |
|
19 | 19 | def putlfile(repo, proto, sha): |
|
20 | 20 | '''Put a largefile into a repository's local cache and into the |
@@ -30,8 +30,8 b' def reposetup(ui, repo):' | |||
|
30 | 30 | method = getattr(repo, name) |
|
31 | 31 | #if not (isinstance(method, types.MethodType) and |
|
32 | 32 | # method.im_func is repo.__class__.commitctx.im_func): |
|
33 |
if isinstance(method, types.FunctionType) and |
|
|
34 | 'wrap': | |
|
33 | if (isinstance(method, types.FunctionType) and | |
|
34 | method.func_name == 'wrap'): | |
|
35 | 35 | ui.warn(_('largefiles: repo method %r appears to have already been' |
|
36 | 36 | ' wrapped by another extension: ' |
|
37 | 37 | 'largefiles may behave incorrectly\n') |
@@ -193,16 +193,18 b' def reposetup(ui, repo):' | |||
|
193 | 193 | lfiles = (modified, added, removed, missing, [], [], clean) |
|
194 | 194 | result = list(result) |
|
195 | 195 | # Unknown files |
|
196 |
result[4] = [f for f in unknown |
|
|
197 | and not lfutil.isstandin(f)] | |
|
196 | result[4] = [f for f in unknown | |
|
197 | if (repo.dirstate[f] == '?' and | |
|
198 | not lfutil.isstandin(f))] | |
|
198 | 199 | # Ignored files must be ignored by both the dirstate and |
|
199 | 200 | # lfdirstate |
|
200 | 201 | result[5] = set(ignored).intersection(set(result[5])) |
|
201 | 202 | # combine normal files and largefiles |
|
202 |
normals = [[fn for fn in filelist |
|
|
203 |
lfutil.isstandin(fn)] |
|
|
204 | result = [sorted(list1 + list2) for (list1, list2) in \ | |
|
205 |
|
|
|
203 | normals = [[fn for fn in filelist | |
|
204 | if not lfutil.isstandin(fn)] | |
|
205 | for filelist in result] | |
|
206 | result = [sorted(list1 + list2) | |
|
207 | for (list1, list2) in zip(normals, lfiles)] | |
|
206 | 208 | else: |
|
207 | 209 | def toname(f): |
|
208 | 210 | if lfutil.isstandin(f): |
@@ -251,8 +253,8 b' def reposetup(ui, repo):' | |||
|
251 | 253 | # Case 1: user calls commit with no specific files or |
|
252 | 254 | # include/exclude patterns: refresh and commit all files that |
|
253 | 255 | # are "dirty". |
|
254 |
if (match is None) or |
|
|
255 | match.files()): | |
|
256 | if ((match is None) or | |
|
257 | (not match.anypats() and not match.files())): | |
|
256 | 258 | # Spend a bit of time here to get a list of files we know |
|
257 | 259 | # are modified so we can compare only against those. |
|
258 | 260 | # It can cost a lot of time (several seconds) |
@@ -345,8 +347,8 b' def reposetup(ui, repo):' | |||
|
345 | 347 | fstandin += os.sep |
|
346 | 348 | |
|
347 | 349 | # prevalidate matching standin directories |
|
348 |
if lfutil.any_(st for st in match._files |
|
|
349 | st.startswith(fstandin)): | |
|
350 | if lfutil.any_(st for st in match._files | |
|
351 | if st.startswith(fstandin)): | |
|
350 | 352 | continue |
|
351 | 353 | actualfiles.append(f) |
|
352 | 354 | match._files = actualfiles |
@@ -369,8 +371,8 b' def reposetup(ui, repo):' | |||
|
369 | 371 | toupload = set() |
|
370 | 372 | o = repo.changelog.nodesbetween(o, revs)[0] |
|
371 | 373 | for n in o: |
|
372 |
parents = [p for p in repo.changelog.parents(n) |
|
|
373 | node.nullid] | |
|
374 | parents = [p for p in repo.changelog.parents(n) | |
|
375 | if p != node.nullid] | |
|
374 | 376 | ctx = repo[n] |
|
375 | 377 | files = set(ctx.files()) |
|
376 | 378 | if len(parents) == 2: |
@@ -388,8 +390,10 b' def reposetup(ui, repo):' | |||
|
388 | 390 | None): |
|
389 | 391 | files.add(f) |
|
390 | 392 | |
|
391 |
toupload = toupload.union( |
|
|
392 | in files if lfutil.isstandin(f) and f in ctx])) | |
|
393 | toupload = toupload.union( | |
|
394 | set([ctx[f].data().strip() | |
|
395 | for f in files | |
|
396 | if lfutil.isstandin(f) and f in ctx])) | |
|
393 | 397 | lfcommands.uploadlfiles(ui, self, remote, toupload) |
|
394 | 398 | return super(lfiles_repo, self).push(remote, force, revs, |
|
395 | 399 | newbranch) |
General Comments 0
You need to be logged in to leave comments.
Login now