hgext/remotefilelog/repack.py
changeset 42842 2c74337e6483
parent 42497 df1419c5756a
child 42943 5fadf6103790
equal deleted inserted replaced
42841:ce6797ef6eab 42842:2c74337e6483
    32 osutil = policy.importmod(r'osutil')
    32 osutil = policy.importmod(r'osutil')
    33 
    33 
    34 class RepackAlreadyRunning(error.Abort):
    34 class RepackAlreadyRunning(error.Abort):
    35     pass
    35     pass
    36 
    36 
    37 def backgroundrepack(repo, incremental=True, packsonly=False):
    37 def backgroundrepack(repo, incremental=True, packsonly=False,
       
    38                      ensurestart=False):
    38     cmd = [procutil.hgexecutable(), '-R', repo.origroot, 'repack']
    39     cmd = [procutil.hgexecutable(), '-R', repo.origroot, 'repack']
    39     msg = _("(running background repack)\n")
    40     msg = _("(running background repack)\n")
    40     if incremental:
    41     if incremental:
    41         cmd.append('--incremental')
    42         cmd.append('--incremental')
    42         msg = _("(running background incremental repack)\n")
    43         msg = _("(running background incremental repack)\n")
    43     if packsonly:
    44     if packsonly:
    44         cmd.append('--packsonly')
    45         cmd.append('--packsonly')
    45     repo.ui.warn(msg)
    46     repo.ui.warn(msg)
    46     # We know this command will find a binary, so don't block on it starting.
    47     # We know this command will find a binary, so don't block on it starting.
    47     procutil.runbgcommand(cmd, encoding.environ, ensurestart=False)
    48     procutil.runbgcommand(cmd, encoding.environ, ensurestart=ensurestart)
    48 
    49 
    49 def fullrepack(repo, options=None):
    50 def fullrepack(repo, options=None):
    50     """If ``packsonly`` is True, stores creating only loose objects are skipped.
    51     """If ``packsonly`` is True, stores creating only loose objects are skipped.
    51     """
    52     """
    52     if util.safehasattr(repo, 'shareddatastores'):
    53     if util.safehasattr(repo, 'shareddatastores'):