def FindCodereviewSettingsFile(filename='codereview.settings'):
    "Finds the given file starting in the cwd and going up.\n\n  Only looks up to the top of the repository unless an\n  'inherit-review-settings-ok' file exists in the root of the repository.\n  "
    inherit_ok_file = 'inherit-review-settings-ok'
    cwd = os.getcwd()
    root = settings.GetRoot()
    if os.path.isfile(os.path.join(root, inherit_ok_file)):
        root = '/'
    while True:
        if (filename in os.listdir(cwd)):
            if os.path.isfile(os.path.join(cwd, filename)):
                return open(os.path.join(cwd, filename))
        if (cwd == root):
            break
        cwd = os.path.dirname(cwd)
Finds the given file starting in the cwd and going up.

Only looks up to the top of the repository unless an
'inherit-review-settings-ok' file exists in the root of the repository.
def FindCodereviewSettingsFile(filename='codereview.settings'):
    "Finds the given file starting in the cwd and going up.\n\n  Only looks up to the top of the repository unless an\n  'inherit-review-settings-ok' file exists in the root of the repository.\n  "
    inherit_ok_file = 'inherit-review-settings-ok'
    cwd = os.getcwd()
    root = settings.GetRoot()
    if os.path.isfile(os.path.join(root, inherit_ok_file)):
        root = '/'
    while True:
        if (filename in os.listdir(cwd)):
            if os.path.isfile(os.path.join(cwd, filename)):
                return open(os.path.join(cwd, filename))
        if (cwd == root):
            break
        cwd = os.path.dirname(cwd)