Automatically deleting pyc files when corresponding py is moved (Mercurial)

前端 未结 7 1371
庸人自扰
庸人自扰 2021-02-13 04:00

(I foresaw this problem might happen 3 months ago, and was told to be diligent to avoid it. Yesterday, I was bitten by it, hard, and now that it has cost me real money, I am kee

7条回答
  •  清酒与你
    2021-02-13 04:25

    How about using an update hook on the server side? Put this in the repository's .hg directory's hgrc file:

    [hooks]
    update = find . -name '*.pyc' | xargs rm
    

    That will delete all .pyc files whenever you update on the server. If you're worried about the cost of rebuilding all the .pyc files you could always get just a little more clever in the hook and delete only the .pyc's for which there is no .py, but that's probably overkill.

提交回复
热议问题