hooks: add predefined hook to run fsync

Reviewed By: DurhamG

Differential Revision: D22993217

fbshipit-source-id: 2cfb6b26479cd7dad02419fb76fa5d3ca5dd66db
This commit is contained in:
Jun Wu 2020-08-31 17:32:44 -07:00 committed by Facebook GitHub Bot
parent a01693df0e
commit 6e2a90ddb5

21
eden/scm/edenscm/hooks.py Normal file
View File

@ -0,0 +1,21 @@
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This software may be used and distributed according to the terms of the
# GNU General Public License version 2.
"""predefined hooks"""
from .mercurial import util
def backgroundfsync(ui, repo, hooktype, **kwargs):
"""run fsync in background
Example config::
[hooks]
postwritecommand.fsync = python:edenscm.hooks.backgroundfsync
"""
if not repo:
return
util.spawndeetached(util.gethgcmd() + ["debugfsync"], cwd=repo.svfs.join(""))