##// END OF EJS Templates
filectx: add an overlayfilectx class...
filectx: add an overlayfilectx class The end goal is to make it possible to avoid potential expensive fctx.data() when unnecessary. While memctx is useful for creating new file contexts, there are many cases where we could reuse an existing raw file revision (amend, histedit, rebase, process a revision constructed by a remote peer, etc). The overlayfilectx class is made to support such reuse cases. Together with a later patch, hash calculation and expensive flag processor could be avoided.

File last commit:

r32180:1b27e179 stable
r32239:07da778f default
Show More
uisetup.py
204 lines | 8.7 KiB | text/x-python | PythonLexer
various
hgext: add largefiles extension...
r15168 # Copyright 2009-2010 Gregory P. Ward
# Copyright 2009-2010 Intelerad Medical Systems Incorporated
# Copyright 2010-2011 Fog Creek Software
# Copyright 2010-2011 Unity Technologies
#
# This software may be used and distributed according to the terms of the
# GNU General Public License version 2 or any later version.
'''setup for largefiles extension: uisetup'''
liscju
py3: make largefiles/uisetup.py use absolute_import
r29315 from __future__ import absolute_import
various
hgext: add largefiles extension...
r15168
from mercurial.i18n import _
liscju
py3: make largefiles/uisetup.py use absolute_import
r29315
from mercurial.hgweb import (
hgweb_mod,
webcommands,
)
various
hgext: add largefiles extension...
r15168
liscju
py3: make largefiles/uisetup.py use absolute_import
r29315 from mercurial import (
archival,
cmdutil,
commands,
copies,
exchange,
extensions,
filemerge,
hg,
httppeer,
merge,
scmutil,
sshpeer,
subrepo,
wireproto,
)
from . import (
overrides,
proto,
)
various
hgext: add largefiles extension...
r15168
def uisetup(ui):
# Disable auto-status for some commands which assume that all
# files in the result are under Mercurial's control
Matt Mackall
largefiles: fix over-long lines
r15170 entry = extensions.wrapcommand(commands.table, 'add',
Na'Tosha Bard
largefiles: remove use of underscores that breaks coding convention
r16247 overrides.overrideadd)
various
hgext: add largefiles extension...
r15168 addopt = [('', 'large', None, _('add as largefile')),
Na'Tosha Bard
largefiles: add --normal option to hg add (issue3061)
r15944 ('', 'normal', None, _('add as normal file')),
Martin Geisler
largefiles: fix indentation
r15627 ('', 'lfsize', '', _('add all files above this size '
'(in megabytes) as largefiles '
'(default: 10)'))]
various
hgext: add largefiles extension...
r15168 entry[1].extend(addopt)
Matt Harbison
largefiles: handle commit -A properly, after a --large commit (issue3542)...
r17658 # The scmutil function is called both by the (trivial) addremove command,
# and in the process of handling commit -A (issue3542)
entry = extensions.wrapfunction(scmutil, 'addremove',
overrides.scmutiladdremove)
Matt Harbison
largefiles: enable subrepo support for add...
r23886 extensions.wrapfunction(cmdutil, 'add', overrides.cmdutiladd)
Matt Harbison
largefiles: enable subrepo support for remove...
r23782 extensions.wrapfunction(cmdutil, 'remove', overrides.cmdutilremove)
Matt Harbison
largefiles: enable subrepo support for forget
r23837 extensions.wrapfunction(cmdutil, 'forget', overrides.cmdutilforget)
Matt Harbison
largefiles: fix status -S reporting of subrepos (issue3231)...
r16515
Matt Harbison
largefiles: report the source of copied/moved largefiles in status -C...
r24230 extensions.wrapfunction(copies, 'pathcopies', overrides.copiespathcopies)
Matt Harbison
largefiles: fix status -S reporting of subrepos (issue3231)...
r16515 # Subrepos call status function
Matt Mackall
largefiles: fix over-long lines
r15170 entry = extensions.wrapcommand(commands.table, 'status',
Na'Tosha Bard
largefiles: remove use of underscores that breaks coding convention
r16247 overrides.overridestatus)
Mads Kiilerich
largefiles: import whole modules instead of importing parts of them...
r21084 entry = extensions.wrapfunction(subrepo.hgsubrepo, 'status',
Matt Harbison
largefiles: fix status -S reporting of subrepos (issue3231)...
r16515 overrides.overridestatusfn)
Matt Mackall
largefiles: fix over-long lines
r15170 entry = extensions.wrapcommand(commands.table, 'log',
Na'Tosha Bard
largefiles: remove use of underscores that breaks coding convention
r16247 overrides.overridelog)
various
hgext: add largefiles extension...
r15168 entry = extensions.wrapcommand(commands.table, 'rollback',
Na'Tosha Bard
largefiles: remove use of underscores that breaks coding convention
r16247 overrides.overriderollback)
Matt Mackall
largefiles: fix over-long lines
r15170 entry = extensions.wrapcommand(commands.table, 'verify',
Na'Tosha Bard
largefiles: remove use of underscores that breaks coding convention
r16247 overrides.overrideverify)
various
hgext: add largefiles extension...
r15168
Mads Kiilerich
largefiles: make verify --lfa and --lfc work without --large...
r18547 verifyopt = [('', 'large', None,
_('verify that all largefiles in current revision exists')),
various
hgext: add largefiles extension...
r15168 ('', 'lfa', None,
Mads Kiilerich
largefiles: make verify --lfa and --lfc work without --large...
r18547 _('verify largefiles in all revisions, not just current')),
various
hgext: add largefiles extension...
r15168 ('', 'lfc', None,
Mads Kiilerich
largefiles: make verify --lfa and --lfc work without --large...
r18547 _('verify local largefile contents, not just existence'))]
various
hgext: add largefiles extension...
r15168 entry[1].extend(verifyopt)
Mads Kiilerich
largefiles: introduce basic debugstate --large functionality...
r18144 entry = extensions.wrapcommand(commands.table, 'debugstate',
overrides.overridedebugstate)
debugstateopt = [('', 'large', None, _('display largefiles dirstate'))]
entry[1].extend(debugstateopt)
FUJIWARA Katsunori
largefiles: use "outgoinghooks" to avoid redundant outgoing check...
r21052 outgoing = lambda orgfunc, *arg, **kwargs: orgfunc(*arg, **kwargs)
entry = extensions.wrapcommand(commands.table, 'outgoing', outgoing)
various
hgext: add largefiles extension...
r15168 outgoingopt = [('', 'large', None, _('display outgoing largefiles'))]
entry[1].extend(outgoingopt)
FUJIWARA Katsunori
largefiles: use "outgoinghooks" to avoid redundant outgoing check...
r21052 cmdutil.outgoinghooks.add('largefiles', overrides.outgoinghook)
Matt Mackall
largefiles: fix over-long lines
r15170 entry = extensions.wrapcommand(commands.table, 'summary',
Na'Tosha Bard
largefiles: remove use of underscores that breaks coding convention
r16247 overrides.overridesummary)
various
hgext: add largefiles extension...
r15168 summaryopt = [('', 'large', None, _('display outgoing largefiles'))]
entry[1].extend(summaryopt)
FUJIWARA Katsunori
largefiles: use "summaryremotehooks" to avoid redundant outgoing check...
r21048 cmdutil.summaryremotehooks.add('largefiles', overrides.summaryremotehook)
various
hgext: add largefiles extension...
r15168
Matt Mackall
largefiles: fix over-long lines
r15170 entry = extensions.wrapcommand(commands.table, 'pull',
Na'Tosha Bard
largefiles: remove use of underscores that breaks coding convention
r16247 overrides.overridepull)
Na'Tosha Bard
largefiles: add --all-largefiles flag to pull
r16692 pullopt = [('', 'all-largefiles', None,
Mads Kiilerich
largefiles: deprecate --all-largefiles for pull...
r18982 _('download all pulled versions of largefiles (DEPRECATED)')),
Mads Kiilerich
largefiles: introduce pull --lfrev option...
r18978 ('', 'lfrev', [],
_('download largefiles for these revisions'), _('REV'))]
Na'Tosha Bard
largefiles: add --all-largefiles flag to pull
r16692 entry[1].extend(pullopt)
Mads Kiilerich
largefiles: introduce pulled() revset expression for use in --lfrev...
r18979
Mads Kiilerich
largefiles: introduce push --lfrev to control which revisions are pushed...
r28878 entry = extensions.wrapcommand(commands.table, 'push',
overrides.overridepush)
pushopt = [('', 'lfrev', [],
_('upload largefiles for these revisions'), _('REV'))]
entry[1].extend(pushopt)
entry = extensions.wrapfunction(exchange, 'pushoperation',
overrides.exchangepushoperation)
Na'Tosha Bard
largefiles: add --all-largefiles flag to clone (issue3188)
r16644 entry = extensions.wrapcommand(commands.table, 'clone',
overrides.overrideclone)
cloneopt = [('', 'all-largefiles', None,
_('download all versions of all largefiles'))]
Matt Harbison
largefiles: delegate to the wrapped clone command...
r17601 entry[1].extend(cloneopt)
entry = extensions.wrapfunction(hg, 'clone', overrides.hgclone)
Matt Harbison
largefiles: set the extension as enabled locally after a share requiring it...
r31892 entry = extensions.wrapfunction(hg, 'postshare', overrides.hgpostshare)
Na'Tosha Bard
largefiles: add --all-largefiles flag to clone (issue3188)
r16644
Na'Tosha Bard
largefiles: fix cat for largefiles (issue3352)...
r16439 entry = extensions.wrapcommand(commands.table, 'cat',
overrides.overridecat)
Matt Mackall
merge: refactor unknown file conflict checking...
r16093 entry = extensions.wrapfunction(merge, '_checkunknownfile',
Na'Tosha Bard
largefiles: remove use of underscores that breaks coding convention
r16247 overrides.overridecheckunknownfile)
Mads Kiilerich
largefiles: override calculateupdates instead of manifestmerge...
r20638 entry = extensions.wrapfunction(merge, 'calculateupdates',
overrides.overridecalculateupdates)
FUJIWARA Katsunori
largefiles: keep largefiles from colliding with normal one during linear merge...
r22196 entry = extensions.wrapfunction(merge, 'recordupdates',
overrides.mergerecordupdates)
FUJIWARA Katsunori
largefiles: update largefiles even if rebase is aborted by conflict...
r22288 entry = extensions.wrapfunction(merge, 'update',
overrides.mergeupdate)
Siddharth Agarwal
filemerge: add a wrapper around the filemerge function...
r26605 entry = extensions.wrapfunction(filemerge, '_filemerge',
Na'Tosha Bard
largefiles: remove use of underscores that breaks coding convention
r16247 overrides.overridefilemerge)
Matt Mackall
largefiles: fix over-long lines
r15170 entry = extensions.wrapfunction(cmdutil, 'copy',
Na'Tosha Bard
largefiles: remove use of underscores that breaks coding convention
r16247 overrides.overridecopy)
various
hgext: add largefiles extension...
r15168
Matt Harbison
largefiles: notice dirty large files in a subrepo...
r16516 # Summary calls dirty on the subrepos
Mads Kiilerich
largefiles: import whole modules instead of importing parts of them...
r21084 entry = extensions.wrapfunction(subrepo.hgsubrepo, 'dirty',
Matt Harbison
largefiles: notice dirty large files in a subrepo...
r16516 overrides.overridedirty)
Martin von Zweigbergk
largefiles: override cmdutil.revert() instead of comands.revert()...
r24436 entry = extensions.wrapfunction(cmdutil, 'revert',
Na'Tosha Bard
largefiles: remove use of underscores that breaks coding convention
r16247 overrides.overriderevert)
various
hgext: add largefiles extension...
r15168
Matt Harbison
largefiles: allow the archiving of largefiles to be disabled...
r25811 extensions.wrapcommand(commands.table, 'archive',
overrides.overridearchivecmd)
Na'Tosha Bard
largefiles: remove use of underscores that breaks coding convention
r16247 extensions.wrapfunction(archival, 'archive', overrides.overridearchive)
Mads Kiilerich
largefiles: import whole modules instead of importing parts of them...
r21084 extensions.wrapfunction(subrepo.hgsubrepo, 'archive',
overrides.hgsubrepoarchive)
Matt Harbison
largefiles: restore archiving largefiles with hgweb (issue4859)...
r26417 extensions.wrapfunction(webcommands, 'archive',
overrides.hgwebarchive)
Greg Ward
largefiles: drop more unnecessary compatibility checks
r15349 extensions.wrapfunction(cmdutil, 'bailifchanged',
Na'Tosha Bard
largefiles: remove use of underscores that breaks coding convention
r16247 overrides.overridebailifchanged)
various
hgext: add largefiles extension...
r15168
Matt Harbison
largefiles: report the missing file count after a commit that does nothing...
r27944 extensions.wrapfunction(cmdutil, 'postcommitstatus',
overrides.postcommitstatus)
FUJIWARA Katsunori
largefiles: update largefiles even if transplant is aborted by conflict...
r22289 extensions.wrapfunction(scmutil, 'marktouched',
overrides.scmutilmarktouched)
various
hgext: add largefiles extension...
r15168 # create the new wireproto commands ...
wireproto.commands['putlfile'] = (proto.putlfile, 'sha')
wireproto.commands['getlfile'] = (proto.getlfile, 'sha')
wireproto.commands['statlfile'] = (proto.statlfile, 'sha')
# ... and wrap some existing ones
wireproto.commands['capabilities'] = (proto.capabilities, '')
wireproto.commands['heads'] = (proto.heads, '')
wireproto.commands['lheads'] = (wireproto.heads, '')
Greg Ward
largefiles: more work on cleaning up comments...
r15254 # make putlfile behave the same as push and {get,stat}lfile behave
# the same as pull w.r.t. permissions checks
various
hgext: add largefiles extension...
r15168 hgweb_mod.perms['putlfile'] = 'push'
hgweb_mod.perms['getlfile'] = 'pull'
hgweb_mod.perms['statlfile'] = 'pull'
Martin Geisler
largefiles: hide .hglf/ prefix for largefiles in hgweb...
r16449 extensions.wrapfunction(webcommands, 'decodepath', overrides.decodepath)
various
hgext: add largefiles extension...
r15168 # the hello wireproto command uses wireproto.capabilities, so it won't see
# our largefiles capability unless we replace the actual function as well.
Na'Tosha Bard
largefiles: remove use of underscores that breaks coding convention
r16247 proto.capabilitiesorig = wireproto.capabilities
various
hgext: add largefiles extension...
r15168 wireproto.capabilities = proto.capabilities
# can't do this in reposetup because it needs to have happened before
# wirerepo.__init__ is called
Peter Arrenbrecht
peer: introduce real peer classes...
r17192 proto.ssholdcallstream = sshpeer.sshpeer._callstream
proto.httpoldcallstream = httppeer.httppeer._callstream
sshpeer.sshpeer._callstream = proto.sshrepocallstream
httppeer.httppeer._callstream = proto.httprepocallstream
various
hgext: add largefiles extension...
r15168
# override some extensions' stuff as well
for name, module in extensions.extensions():
if name == 'purge':
extensions.wrapcommand(getattr(module, 'cmdtable'), 'purge',
Na'Tosha Bard
largefiles: remove use of underscores that breaks coding convention
r16247 overrides.overridepurge)
various
hgext: add largefiles extension...
r15168 if name == 'rebase':
extensions.wrapcommand(getattr(module, 'cmdtable'), 'rebase',
Na'Tosha Bard
largefiles: remove use of underscores that breaks coding convention
r16247 overrides.overriderebase)
FUJIWARA Katsunori
largefiles: wrap "rebase.rebase" for functions using it directly...
r23182 extensions.wrapfunction(module, 'rebase',
overrides.overriderebase)
Na'Tosha Bard
largefiles: fix bad bug where transplanting a changeset with a largefile will result in an old largefile being comitted later on
r15383 if name == 'transplant':
extensions.wrapcommand(getattr(module, 'cmdtable'), 'transplant',
Na'Tosha Bard
largefiles: remove use of underscores that breaks coding convention
r16247 overrides.overridetransplant)