hgext/largefiles/__init__.py
changeset 43077 687b865b95ad
parent 43076 2372284d9457
child 45545 e5e1285b6f6f
equal deleted inserted replaced
43076:2372284d9457 43077:687b865b95ad
   126 
   126 
   127 # Note for extension authors: ONLY specify testedwith = 'ships-with-hg-core' for
   127 # Note for extension authors: ONLY specify testedwith = 'ships-with-hg-core' for
   128 # extensions which SHIP WITH MERCURIAL. Non-mainline extensions should
   128 # extensions which SHIP WITH MERCURIAL. Non-mainline extensions should
   129 # be specifying the version(s) of Mercurial they are tested with, or
   129 # be specifying the version(s) of Mercurial they are tested with, or
   130 # leave the attribute unspecified.
   130 # leave the attribute unspecified.
   131 testedwith = 'ships-with-hg-core'
   131 testedwith = b'ships-with-hg-core'
   132 
   132 
   133 eh = exthelper.exthelper()
   133 eh = exthelper.exthelper()
   134 eh.merge(lfcommands.eh)
   134 eh.merge(lfcommands.eh)
   135 eh.merge(overrides.eh)
   135 eh.merge(overrides.eh)
   136 eh.merge(proto.eh)
   136 eh.merge(proto.eh)
   137 
   137 
   138 eh.configitem(
   138 eh.configitem(
   139     'largefiles', 'minsize', default=eh.configitem.dynamicdefault,
   139     b'largefiles', b'minsize', default=eh.configitem.dynamicdefault,
   140 )
   140 )
   141 eh.configitem(
   141 eh.configitem(
   142     'largefiles', 'patterns', default=list,
   142     b'largefiles', b'patterns', default=list,
   143 )
   143 )
   144 eh.configitem(
   144 eh.configitem(
   145     'largefiles', 'usercache', default=None,
   145     b'largefiles', b'usercache', default=None,
   146 )
   146 )
   147 
   147 
   148 cmdtable = eh.cmdtable
   148 cmdtable = eh.cmdtable
   149 configtable = eh.configtable
   149 configtable = eh.configtable
   150 extsetup = eh.finalextsetup
   150 extsetup = eh.finalextsetup
   152 uisetup = eh.finaluisetup
   152 uisetup = eh.finaluisetup
   153 
   153 
   154 
   154 
   155 def featuresetup(ui, supported):
   155 def featuresetup(ui, supported):
   156     # don't die on seeing a repo with the largefiles requirement
   156     # don't die on seeing a repo with the largefiles requirement
   157     supported |= {'largefiles'}
   157     supported |= {b'largefiles'}
   158 
   158 
   159 
   159 
   160 @eh.uisetup
   160 @eh.uisetup
   161 def _uisetup(ui):
   161 def _uisetup(ui):
   162     localrepo.featuresetupfuncs.add(featuresetup)
   162     localrepo.featuresetupfuncs.add(featuresetup)
   163     hg.wirepeersetupfuncs.append(proto.wirereposetup)
   163     hg.wirepeersetupfuncs.append(proto.wirereposetup)
   164 
   164 
   165     cmdutil.outgoinghooks.add('largefiles', overrides.outgoinghook)
   165     cmdutil.outgoinghooks.add(b'largefiles', overrides.outgoinghook)
   166     cmdutil.summaryremotehooks.add('largefiles', overrides.summaryremotehook)
   166     cmdutil.summaryremotehooks.add(b'largefiles', overrides.summaryremotehook)
   167 
   167 
   168     # create the new wireproto commands ...
   168     # create the new wireproto commands ...
   169     wireprotov1server.wireprotocommand('putlfile', 'sha', permission='push')(
   169     wireprotov1server.wireprotocommand(b'putlfile', b'sha', permission=b'push')(
   170         proto.putlfile
   170         proto.putlfile
   171     )
   171     )
   172     wireprotov1server.wireprotocommand('getlfile', 'sha', permission='pull')(
   172     wireprotov1server.wireprotocommand(b'getlfile', b'sha', permission=b'pull')(
   173         proto.getlfile
   173         proto.getlfile
   174     )
   174     )
   175     wireprotov1server.wireprotocommand('statlfile', 'sha', permission='pull')(
   175     wireprotov1server.wireprotocommand(
   176         proto.statlfile
   176         b'statlfile', b'sha', permission=b'pull'
   177     )
   177     )(proto.statlfile)
   178     wireprotov1server.wireprotocommand('lheads', '', permission='pull')(
   178     wireprotov1server.wireprotocommand(b'lheads', b'', permission=b'pull')(
   179         wireprotov1server.heads
   179         wireprotov1server.heads
   180     )
   180     )
   181 
   181 
   182     extensions.wrapfunction(
   182     extensions.wrapfunction(
   183         wireprotov1server.commands['heads'], 'func', proto.heads
   183         wireprotov1server.commands[b'heads'], b'func', proto.heads
   184     )
   184     )
   185     # TODO also wrap wireproto.commandsv2 once heads is implemented there.
   185     # TODO also wrap wireproto.commandsv2 once heads is implemented there.
   186 
   186 
   187     # can't do this in reposetup because it needs to have happened before
   187     # can't do this in reposetup because it needs to have happened before
   188     # wirerepo.__init__ is called
   188     # wirerepo.__init__ is called
   191     sshpeer.sshv1peer._callstream = proto.sshrepocallstream
   191     sshpeer.sshv1peer._callstream = proto.sshrepocallstream
   192     httppeer.httppeer._callstream = proto.httprepocallstream
   192     httppeer.httppeer._callstream = proto.httprepocallstream
   193 
   193 
   194     # override some extensions' stuff as well
   194     # override some extensions' stuff as well
   195     for name, module in extensions.extensions():
   195     for name, module in extensions.extensions():
   196         if name == 'rebase':
   196         if name == b'rebase':
   197             # TODO: teach exthelper to handle this
   197             # TODO: teach exthelper to handle this
   198             extensions.wrapfunction(module, 'rebase', overrides.overriderebase)
   198             extensions.wrapfunction(module, b'rebase', overrides.overriderebase)
   199 
   199 
   200 
   200 
   201 revsetpredicate = eh.revsetpredicate
   201 revsetpredicate = eh.revsetpredicate