Mercurial > hg
view tests/lockdelay.py @ 32864:f57f1f37290d
pycompat: move multiline comments above a function to function doc
pycompat.py is unorganized and looks ugly. Next few patches will try to make it
look more cleaner so that adding more code is easy and reading code also.
This patch moves the multiline comments above functions to function docs. While
moving, I improved the comments and make them better suitable for func doc.
While I was here I drop a unrequired and misplaced comment.
author | Pulkit Goyal <7895pulkit@gmail.com> |
---|---|
date | Fri, 16 Jun 2017 02:48:17 +0530 |
parents | a76d5ba7ac43 |
children | 2372284d9457 |
line wrap: on
line source
# Dummy extension that adds a delay after acquiring a lock. # # This extension can be used to test race conditions between lock acquisition. from __future__ import absolute_import import os import time def reposetup(ui, repo): class delayedlockrepo(repo.__class__): def lock(self): delay = float(os.environ.get('HGPRELOCKDELAY', '0.0')) if delay: time.sleep(delay) res = super(delayedlockrepo, self).lock() delay = float(os.environ.get('HGPOSTLOCKDELAY', '0.0')) if delay: time.sleep(delay) return res repo.__class__ = delayedlockrepo