def _GerritCommitMsgHookCheck(self, offer_removal):
    hook = os.path.join(settings.GetRoot(), '.git', 'hooks', 'commit-msg')
    if (not os.path.exists(hook)):
        return
    data = gclient_utils.FileRead(hook)
    if (not (('From Gerrit Code Review' in data) and ('add_ChangeId()' in data))):
        return
    print('Warning: you have Gerrit commit-msg hook installed.\nIt is not neccessary for uploading with git cl in squash mode, and may interfere with it in subtle ways.\nWe recommend you remove the commit-msg hook.')
    if offer_removal:
        reply = ask_for_data('Do you want to remove it now? [Yes/No]')
        if reply.lower().startswith('y'):
            gclient_utils.rm_file_or_tree(hook)
            print('Gerrit commit-msg hook removed.')
        else:
            print('OK, will keep Gerrit commit-msg hook in place.')
def _GerritCommitMsgHookCheck(self, offer_removal):
    hook = os.path.join(settings.GetRoot(), '.git', 'hooks', 'commit-msg')
    if (not os.path.exists(hook)):
        return
    data = gclient_utils.FileRead(hook)
    if (not (('From Gerrit Code Review' in data) and ('add_ChangeId()' in data))):
        return
    print('Warning: you have Gerrit commit-msg hook installed.\nIt is not neccessary for uploading with git cl in squash mode, and may interfere with it in subtle ways.\nWe recommend you remove the commit-msg hook.')
    if offer_removal:
        reply = ask_for_data('Do you want to remove it now? [Yes/No]')
        if reply.lower().startswith('y'):
            gclient_utils.rm_file_or_tree(hook)
            print('Gerrit commit-msg hook removed.')
        else:
            print('OK, will keep Gerrit commit-msg hook in place.')