def fstat_cl(line):
    """
    Extracts integer changelist from an fstat line, unless it starts
    with '#' or is empty, in which case the returned changelist is 0.

    WARNING: Can not detect 5-col/7-col format and will just return
             line as is.

    Returns a tuple: changelist, line
    """
    line = line.rstrip()
    if not line or line[0] == '#':
        return 0, line
    cl, _ = line.split(',', 1)
    return int(cl), line