hgext/infinitepush/__init__.py
changeset 37190 de4c2f3af97f
parent 37189 03ff17a4bf53
child 37191 b377b7dfe682
equal deleted inserted replaced
37189:03ff17a4bf53 37190:de4c2f3af97f
   128     util,
   128     util,
   129     wireproto,
   129     wireproto,
   130 )
   130 )
   131 
   131 
   132 from . import (
   132 from . import (
   133     backupcommands,
       
   134     bundleparts,
   133     bundleparts,
   135     common,
   134     common,
   136     infinitepushcommands,
   135     infinitepushcommands,
   137 )
   136 )
   138 
   137 
   175 configitem('infinitepush', 'branchpattern',
   174 configitem('infinitepush', 'branchpattern',
   176     default='',
   175     default='',
   177 )
   176 )
   178 configitem('infinitepush', 'metadatafilelimit',
   177 configitem('infinitepush', 'metadatafilelimit',
   179     default=100,
   178     default=100,
   180 )
       
   181 configitem('infinitepushbackup', 'autobackup',
       
   182     default=False,
       
   183 )
   179 )
   184 configitem('experimental', 'server-bundlestore-bookmark',
   180 configitem('experimental', 'server-bundlestore-bookmark',
   185     default='',
   181     default='',
   186 )
   182 )
   187 configitem('experimental', 'server-bundlestore-create',
   183 configitem('experimental', 'server-bundlestore-create',
   201 configscratchpush = 'infinitepush-scratchpush'
   197 configscratchpush = 'infinitepush-scratchpush'
   202 confignonforwardmove = 'non-forward-move'
   198 confignonforwardmove = 'non-forward-move'
   203 
   199 
   204 scratchbranchparttype = bundleparts.scratchbranchparttype
   200 scratchbranchparttype = bundleparts.scratchbranchparttype
   205 cmdtable = infinitepushcommands.cmdtable
   201 cmdtable = infinitepushcommands.cmdtable
   206 revsetpredicate = backupcommands.revsetpredicate
   202 revsetpredicate = registrar.revsetpredicate()
   207 templatekeyword = backupcommands.templatekeyword
   203 templatekeyword = registrar.templatekeyword()
   208 _scratchbranchmatcher = lambda x: False
   204 _scratchbranchmatcher = lambda x: False
   209 _maybehash = re.compile(r'^[a-f0-9]+$').search
   205 _maybehash = re.compile(r'^[a-f0-9]+$').search
   210 
   206 
   211 def _buildexternalbundlestore(ui):
   207 def _buildexternalbundlestore(ui):
   212     put_args = ui.configlist('infinitepush', 'put_args', [])
   208     put_args = ui.configlist('infinitepush', 'put_args', [])
   297     order.remove('infinitepush')
   293     order.remove('infinitepush')
   298     order.append('infinitepush')
   294     order.append('infinitepush')
   299     extensions._order = order
   295     extensions._order = order
   300 
   296 
   301 def extsetup(ui):
   297 def extsetup(ui):
   302     # Allow writing backup files outside the normal lock
       
   303     localrepo.localrepository._wlockfreeprefix.update([
       
   304         backupcommands._backupstatefile,
       
   305         backupcommands._backupgenerationfile,
       
   306         backupcommands._backuplatestinfofile,
       
   307     ])
       
   308 
       
   309     commonsetup(ui)
   298     commonsetup(ui)
   310     if _isserver(ui):
   299     if _isserver(ui):
   311         serverextsetup(ui)
   300         serverextsetup(ui)
   312     else:
   301     else:
   313         clientextsetup(ui)
   302         clientextsetup(ui)
   390     index = partorder.index('changeset')
   379     index = partorder.index('changeset')
   391     if pushrebaseparttype in partorder:
   380     if pushrebaseparttype in partorder:
   392         index = min(index, partorder.index(pushrebaseparttype))
   381         index = min(index, partorder.index(pushrebaseparttype))
   393     partorder.insert(
   382     partorder.insert(
   394         index, partorder.pop(partorder.index(scratchbranchparttype)))
   383         index, partorder.pop(partorder.index(scratchbranchparttype)))
   395 
       
   396     def wrapsmartlog(loaded):
       
   397         if not loaded:
       
   398             return
       
   399         smartlogmod = extensions.find('smartlog')
       
   400         extensions.wrapcommand(smartlogmod.cmdtable, 'smartlog', _smartlog)
       
   401     extensions.afterloaded('smartlog', wrapsmartlog)
       
   402     backupcommands.extsetup(ui)
       
   403 
       
   404 def _smartlog(orig, ui, repo, **opts):
       
   405     res = orig(ui, repo, **opts)
       
   406     backupcommands.smartlogsummary(ui, repo)
       
   407     return res
       
   408 
   384 
   409 def _showbookmarks(ui, bookmarks, **opts):
   385 def _showbookmarks(ui, bookmarks, **opts):
   410     # Copy-paste from commands.py
   386     # Copy-paste from commands.py
   411     fm = ui.formatter('bookmarks', opts)
   387     fm = ui.formatter('bookmarks', opts)
   412     for bmark, n in sorted(bookmarks.iteritems()):
   388     for bmark, n in sorted(bookmarks.iteritems()):