def parse_changesets(text):
    """
    Returns dictionary with *start*, *main* and *end* ids.

    Examples::

        >>> parse_changesets('aaabbb')
        {'start': None, 'main': 'aaabbb', 'end': None}
        >>> parse_changesets('aaabbb..cccddd')
        {'start': 'aaabbb', 'main': None, 'end': 'cccddd'}

    """
    text = text.strip()
    CID_RE = r'[a-zA-Z0-9]+'
    if not '..' in text:
        m = re.match(r'^(?P<cid>%s)$' % CID_RE, text)
        if m:
            return {
                'start': None,
                'main': text,
                'end': None,
            }
    else:
        RE = r'^(?P<start>%s)?\.{2,3}(?P<end>%s)?$' % (CID_RE, CID_RE)
        m = re.match(RE, text)
        if m:
            result = m.groupdict()
            result['main'] = None
            return result
    raise ValueError("IDs not recognized")
def parse_changesets ( text ) : text = text . strip ( ) CID_RE = r'[a-zA-Z0-9]+' if not '..' in text : m = re . match ( r'^(?P<cid>%s)$' % CID_RE , text ) if m : return { 'start' : None , 'main' : text , 'end' : None , } else : RE = r'^(?P<start>%s)?\.{2,3}(?P<end>%s)?$' % ( CID_RE , CID_RE ) m = re . match ( RE , text ) if m : result = m . groupdict ( ) result [ 'main' ] = None return result raise ValueError ( "IDs not recognized" )
Returns dictionary with *start*, *main* and *end* ids.

    Examples::

        >>> parse_changesets('aaabbb')
        {'start': None, 'main': 'aaabbb', 'end': None}
        >>> parse_changesets('aaabbb..cccddd')
        {'start': 'aaabbb', 'main': None, 'end': 'cccddd'}