def parse_mergeinfo_prop(mergeinfo_str):
    """Parse svn:mergeinfo property and return dictionary
       where branch pathes are keys and values are compact
       representations of merged commits: array of numbers
       and tuples with <first, last> values
    """

    lines = mergeinfo_str.split('\n')
    mergeinfo = {}

    for  line in lines:
        if not line:
            next
        branch_path, merged_part = line.split(':')
        revisions = merged_part.split(',')
        merged = []
        for r in revisions:
            if r.find('-') > 0:
                start, stop = r.split('-')
                merged.append((int(start), int(stop),))
            else:
                if r.endswith('*'):
                    r = r[:-1]
                merged.append(int(r))
        mergeinfo[branch_path] = merged

    return mergeinfo