A context manager that grabs the lock and releases it when done.

    This blocks until the lock can be acquired.

    Args:
        vcs (easyci.vcs.base.Vcs)
        lock_object (Lock)
        wait (boolean) - whether to wait for the lock or error out

    Raises:
        Timeout

def lock(vcs, lock_object, wait=True):
    """A context manager that grabs the lock and releases it when done.

    This blocks until the lock can be acquired.

    Args:
        vcs (easyci.vcs.base.Vcs)
        lock_object (Lock)
        wait (boolean) - whether to wait for the lock or error out

    Raises:
        Timeout
    """
    if wait:
        timeout = -1
    else:
        timeout = 0
    lock_path = _get_lock_path(vcs, lock_object)
    lock = filelock.FileLock(lock_path)
    with lock.acquire(timeout=timeout):
        yield