Show More
@@ -39,8 +39,8 b' def lfconvert(ui, src, dest, *pats, **op' | |||||
39 | try: |
|
39 | try: | |
40 | size = int(size) |
|
40 | size = int(size) | |
41 | except ValueError: |
|
41 | except ValueError: | |
42 |
raise util.Abort(_('largefiles.size must be integer, was %s\n') |
|
42 | raise util.Abort(_('largefiles.size must be integer, was %s\n') | |
43 | size) |
|
43 | % size) | |
44 | except TypeError: |
|
44 | except TypeError: | |
45 | raise util.Abort(_('size must be specified')) |
|
45 | raise util.Abort(_('size must be specified')) | |
46 |
|
46 | |||
@@ -232,7 +232,8 b' def _lfconvert_addchangeset(rsrc, rdst, ' | |||||
232 | if 'l' in fctx.flags(): |
|
232 | if 'l' in fctx.flags(): | |
233 | if renamedlfile: |
|
233 | if renamedlfile: | |
234 | raise util.Abort( |
|
234 | raise util.Abort( | |
235 |
_('Renamed/copied largefile %s becomes symlink') |
|
235 | _('Renamed/copied largefile %s becomes symlink') | |
|
236 | % f) | |||
236 | islfile = False |
|
237 | islfile = False | |
237 | if islfile: |
|
238 | if islfile: | |
238 | lfiles.add(f) |
|
239 | lfiles.add(f) | |
@@ -341,10 +342,12 b' def uploadlfiles(ui, rsrc, rdst, files):' | |||||
341 | at = 0 |
|
342 | at = 0 | |
342 | files = filter(lambda h: not store.exists(h), files) |
|
343 | files = filter(lambda h: not store.exists(h), files) | |
343 | for hash in files: |
|
344 | for hash in files: | |
344 |
ui.progress(_('uploading largefiles'), at, unit='largefile', |
|
345 | ui.progress(_('uploading largefiles'), at, unit='largefile', | |
|
346 | total=len(files)) | |||
345 | source = lfutil.findfile(rsrc, hash) |
|
347 | source = lfutil.findfile(rsrc, hash) | |
346 | if not source: |
|
348 | if not source: | |
347 |
raise util.Abort(_('Missing largefile %s needs to be uploaded') |
|
349 | raise util.Abort(_('Missing largefile %s needs to be uploaded') | |
|
350 | % hash) | |||
348 | # XXX check for errors here |
|
351 | # XXX check for errors here | |
349 | store.put(source, hash) |
|
352 | store.put(source, hash) | |
350 | at += 1 |
|
353 | at += 1 | |
@@ -475,8 +478,8 b' def _updatelfile(repo, lfdirstate, lfile' | |||||
475 | cmdtable = { |
|
478 | cmdtable = { | |
476 | 'lfconvert': (lfconvert, |
|
479 | 'lfconvert': (lfconvert, | |
477 | [('s', 'size', 0, 'All files over this size (in megabytes) ' |
|
480 | [('s', 'size', 0, 'All files over this size (in megabytes) ' | |
478 |
'will be considered largefiles. This can also be specified |
|
481 | 'will be considered largefiles. This can also be specified ' | |
479 | 'your hgrc as [largefiles].size.'), |
|
482 | 'in your hgrc as [largefiles].size.'), | |
480 | ('','tonormal',False, |
|
483 | ('','tonormal',False, | |
481 | 'Convert from a largefiles repo to a normal repo')], |
|
484 | 'Convert from a largefiles repo to a normal repo')], | |
482 | _('hg lfconvert SOURCE DEST [FILE ...]')), |
|
485 | _('hg lfconvert SOURCE DEST [FILE ...]')), |
@@ -488,8 +488,8 b' def unixpath(path):' | |||||
488 | return os.path.normpath(path).replace(os.sep, '/') |
|
488 | return os.path.normpath(path).replace(os.sep, '/') | |
489 |
|
489 | |||
490 | def islfilesrepo(repo): |
|
490 | def islfilesrepo(repo): | |
491 |
return 'largefiles' in repo.requirements and |
|
491 | return ('largefiles' in repo.requirements and | |
492 | repo.store.datafiles()) |
|
492 | any_(shortname + '/' in f[0] for f in repo.store.datafiles()) | |
493 |
|
493 | |||
494 | def any_(gen): |
|
494 | def any_(gen): | |
495 | for x in gen: |
|
495 | for x in gen: |
@@ -87,7 +87,8 b' def override_add(orig, ui, repo, *pats, ' | |||||
87 | try: |
|
87 | try: | |
88 | lfsize = int(lfsize) |
|
88 | lfsize = int(lfsize) | |
89 | except ValueError: |
|
89 | except ValueError: | |
90 |
raise util.Abort(_('largefiles: size must be an integer, was %s\n') |
|
90 | raise util.Abort(_('largefiles: size must be an integer, was %s\n') | |
|
91 | % lfsize) | |||
91 |
|
92 | |||
92 | lfmatcher = None |
|
93 | lfmatcher = None | |
93 | if os.path.exists(repo.wjoin(lfutil.shortname)): |
|
94 | if os.path.exists(repo.wjoin(lfutil.shortname)): | |
@@ -530,7 +531,8 b' def override_revert(orig, ui, repo, *pat' | |||||
530 | finally: |
|
531 | finally: | |
531 | restorematchfn() |
|
532 | restorematchfn() | |
532 | lfileslist = getattr(repo, '_lfilestoupdate', []) |
|
533 | lfileslist = getattr(repo, '_lfilestoupdate', []) | |
533 |
lfcommands.updatelfiles(ui, repo, filelist=lfileslist, |
|
534 | lfcommands.updatelfiles(ui, repo, filelist=lfileslist, | |
|
535 | printmessage=False) | |||
534 | # Empty out the lfiles list so we start fresh next time |
|
536 | # Empty out the lfiles list so we start fresh next time | |
535 | repo._lfilestoupdate = [] |
|
537 | repo._lfilestoupdate = [] | |
536 | for lfile in modified: |
|
538 | for lfile in modified: |
@@ -105,7 +105,8 b' def wirereposetup(ui, repo):' | |||||
105 | try: |
|
105 | try: | |
106 | length = int(length) |
|
106 | length = int(length) | |
107 | except ValueError: |
|
107 | except ValueError: | |
108 |
self._abort(error.ResponseError(_("unexpected response:"), |
|
108 | self._abort(error.ResponseError(_("unexpected response:"), | |
|
109 | length)) | |||
109 | return (length, stream) |
|
110 | return (length, stream) | |
110 |
|
111 | |||
111 | def statlfile(self, sha): |
|
112 | def statlfile(self, sha): |
@@ -58,8 +58,8 b' def reposetup(ui, repo):' | |||||
58 | class lfiles_ctx(ctx.__class__): |
|
58 | class lfiles_ctx(ctx.__class__): | |
59 | def files(self): |
|
59 | def files(self): | |
60 | filenames = super(lfiles_ctx, self).files() |
|
60 | filenames = super(lfiles_ctx, self).files() | |
61 |
return [re.sub('^\\'+lfutil.shortname+'/', '', |
|
61 | return [re.sub('^\\'+lfutil.shortname+'/', '', | |
62 | in filenames] |
|
62 | filename) for filename in filenames] | |
63 | def manifest(self): |
|
63 | def manifest(self): | |
64 | man1 = super(lfiles_ctx, self).manifest() |
|
64 | man1 = super(lfiles_ctx, self).manifest() | |
65 | man1.__class__ = lfiles_manifestdict |
|
65 | man1.__class__ = lfiles_manifestdict |
@@ -20,7 +20,8 b' def uisetup(ui):' | |||||
20 | # Disable auto-status for some commands which assume that all |
|
20 | # Disable auto-status for some commands which assume that all | |
21 | # files in the result are under Mercurial's control |
|
21 | # files in the result are under Mercurial's control | |
22 |
|
22 | |||
23 |
entry = extensions.wrapcommand(commands.table, 'add', |
|
23 | entry = extensions.wrapcommand(commands.table, 'add', | |
|
24 | overrides.override_add) | |||
24 | addopt = [('', 'large', None, _('add as largefile')), |
|
25 | addopt = [('', 'large', None, _('add as largefile')), | |
25 | ('', 'lfsize', '', _('add all files above this size (in megabytes)' |
|
26 | ('', 'lfsize', '', _('add all files above this size (in megabytes)' | |
26 | 'as largefiles (default: 10)'))] |
|
27 | 'as largefiles (default: 10)'))] | |
@@ -28,14 +29,19 b' def uisetup(ui):' | |||||
28 |
|
29 | |||
29 | entry = extensions.wrapcommand(commands.table, 'addremove', |
|
30 | entry = extensions.wrapcommand(commands.table, 'addremove', | |
30 | overrides.override_addremove) |
|
31 | overrides.override_addremove) | |
31 |
entry = extensions.wrapcommand(commands.table, 'remove', |
|
32 | entry = extensions.wrapcommand(commands.table, 'remove', | |
32 | entry = extensions.wrapcommand(commands.table, 'forget', overrides.override_forget) |
|
33 | overrides.override_remove) | |
33 |
entry = extensions.wrapcommand(commands.table, ' |
|
34 | entry = extensions.wrapcommand(commands.table, 'forget', | |
34 | entry = extensions.wrapcommand(commands.table, 'log', overrides.override_log) |
|
35 | overrides.override_forget) | |
|
36 | entry = extensions.wrapcommand(commands.table, 'status', | |||
|
37 | overrides.override_status) | |||
|
38 | entry = extensions.wrapcommand(commands.table, 'log', | |||
|
39 | overrides.override_log) | |||
35 | entry = extensions.wrapcommand(commands.table, 'rollback', |
|
40 | entry = extensions.wrapcommand(commands.table, 'rollback', | |
36 | overrides.override_rollback) |
|
41 | overrides.override_rollback) | |
|
42 | entry = extensions.wrapcommand(commands.table, 'verify', | |||
|
43 | overrides.override_verify) | |||
37 |
|
44 | |||
38 | entry = extensions.wrapcommand(commands.table, 'verify', overrides.override_verify) |
|
|||
39 | verifyopt = [('', 'large', None, _('verify largefiles')), |
|
45 | verifyopt = [('', 'large', None, _('verify largefiles')), | |
40 | ('', 'lfa', None, |
|
46 | ('', 'lfa', None, | |
41 | _('verify all revisions of largefiles not just current')), |
|
47 | _('verify all revisions of largefiles not just current')), | |
@@ -47,19 +53,26 b' def uisetup(ui):' | |||||
47 | overrides.override_outgoing) |
|
53 | overrides.override_outgoing) | |
48 | outgoingopt = [('', 'large', None, _('display outgoing largefiles'))] |
|
54 | outgoingopt = [('', 'large', None, _('display outgoing largefiles'))] | |
49 | entry[1].extend(outgoingopt) |
|
55 | entry[1].extend(outgoingopt) | |
50 |
entry = extensions.wrapcommand(commands.table, 'summary', |
|
56 | entry = extensions.wrapcommand(commands.table, 'summary', | |
|
57 | overrides.override_summary) | |||
51 | summaryopt = [('', 'large', None, _('display outgoing largefiles'))] |
|
58 | summaryopt = [('', 'large', None, _('display outgoing largefiles'))] | |
52 | entry[1].extend(summaryopt) |
|
59 | entry[1].extend(summaryopt) | |
53 |
|
60 | |||
54 |
entry = extensions.wrapcommand(commands.table, 'update', |
|
61 | entry = extensions.wrapcommand(commands.table, 'update', | |
55 | entry = extensions.wrapcommand(commands.table, 'pull', overrides.override_pull) |
|
62 | overrides.override_update) | |
56 | entry = extensions.wrapfunction(filemerge, 'filemerge', overrides.override_filemerge) |
|
63 | entry = extensions.wrapcommand(commands.table, 'pull', | |
57 | entry = extensions.wrapfunction(cmdutil, 'copy', overrides.override_copy) |
|
64 | overrides.override_pull) | |
|
65 | entry = extensions.wrapfunction(filemerge, 'filemerge', | |||
|
66 | overrides.override_filemerge) | |||
|
67 | entry = extensions.wrapfunction(cmdutil, 'copy', | |||
|
68 | overrides.override_copy) | |||
58 |
|
69 | |||
59 | # Backout calls revert so we need to override both the command and the |
|
70 | # Backout calls revert so we need to override both the command and the | |
60 | # function |
|
71 | # function | |
61 |
entry = extensions.wrapcommand(commands.table, 'revert', |
|
72 | entry = extensions.wrapcommand(commands.table, 'revert', | |
62 | entry = extensions.wrapfunction(commands, 'revert', overrides.override_revert) |
|
73 | overrides.override_revert) | |
|
74 | entry = extensions.wrapfunction(commands, 'revert', | |||
|
75 | overrides.override_revert) | |||
63 |
|
76 | |||
64 | # clone uses hg._update instead of hg.update even though they are the |
|
77 | # clone uses hg._update instead of hg.update even though they are the | |
65 | # same function... so wrap both of them) |
|
78 | # same function... so wrap both of them) |
General Comments 0
You need to be logged in to leave comments.
Login now