def DownloadGerritHook(force):
    'Download and install Gerrit commit-msg hook.\n\n  Args:\n    force: True to update hooks. False to install hooks if not present.\n  '
    if (not settings.GetIsGerrit()):
        return
    src = 'https://gerrit-review.googlesource.com/tools/hooks/commit-msg'
    dst = os.path.join(settings.GetRoot(), '.git', 'hooks', 'commit-msg')
    if (not os.access(dst, os.X_OK)):
        if os.path.exists(dst):
            if (not force):
                return
        try:
            urlretrieve(src, dst)
            if (not hasSheBang(dst)):
                DieWithError(('Not a script: %s\nYou need to download from\n%s\ninto .git/hooks/commit-msg and chmod +x .git/hooks/commit-msg' % (dst, src)))
            os.chmod(dst, ((stat.S_IRUSR | stat.S_IWUSR) | stat.S_IXUSR))
        except Exception:
            if os.path.exists(dst):
                os.remove(dst)
            DieWithError(('\nFailed to download hooks.\nYou need to download from\n%s\ninto .git/hooks/commit-msg and chmod +x .git/hooks/commit-msg' % src))
Download and install Gerrit commit-msg hook.

Args:
  force: True to update hooks. False to install hooks if not present.
def DownloadGerritHook(force):
    'Download and install Gerrit commit-msg hook.\n\n  Args:\n    force: True to update hooks. False to install hooks if not present.\n  '
    if (not settings.GetIsGerrit()):
        return
    src = 'https://gerrit-review.googlesource.com/tools/hooks/commit-msg'
    dst = os.path.join(settings.GetRoot(), '.git', 'hooks', 'commit-msg')
    if (not os.access(dst, os.X_OK)):
        if os.path.exists(dst):
            if (not force):
                return
        try:
            urlretrieve(src, dst)
            if (not hasSheBang(dst)):
                DieWithError(('Not a script: %s\nYou need to download from\n%s\ninto .git/hooks/commit-msg and chmod +x .git/hooks/commit-msg' % (dst, src)))
            os.chmod(dst, ((stat.S_IRUSR | stat.S_IWUSR) | stat.S_IXUSR))
        except Exception:
            if os.path.exists(dst):
                os.remove(dst)
            DieWithError(('\nFailed to download hooks.\nYou need to download from\n%s\ninto .git/hooks/commit-msg and chmod +x .git/hooks/commit-msg' % src))