Beispiel #1
0
def test_round_trip():
    for msg_fname in (MSG1, MSG2, MSG2H, MSG8):
        with open(msg_fname, 'rt') as fobj:
            message = fobj.read()
        info = read_info(msg_fname)
        info_plus = msg2info(message)
        info_plus.update(dict(message=message, path=msg_fname))
        assert_equal(info, info_plus)
        assert_equal(info2str(info), message)
Beispiel #2
0
def read_expand_info(message_fname):
    info = read_info(message_fname)
    info['old_hash'] = sha1(info['message']).hexdigest()
    dir_list_path = pjoin(dirname(message_fname), DIR_LIST_FNAME)
    info['directory hash'] = hash_for(dir_list_path)
    if 'parents' in info:
        info['fixed_parents'] = [False] * len(info['parents'])
    else:
        info['fixed_parents'] = []
    return info
Beispiel #3
0
def read_expand_info(message_fname):
    info = read_info(message_fname)
    info['old_hash'] = sha1(info['message']).hexdigest()
    dir_list_path = pjoin(dirname(message_fname), DIR_LIST_FNAME)
    info['directory hash'] = hash_for(dir_list_path)
    if 'parents' in info:
        info['fixed_parents'] = [False] * len(info['parents'])
    else:
        info['fixed_parents'] = []
    return info
Beispiel #4
0
def main():
    """ Show graph for snapshots """
    args = get_parser().parse_args()
    root_dir = args.root_dir
    globber = pjoin(root_dir, '*', COMMIT_MSG_FNAME)
    nodes = []
    for message_fname in glob(globber):
        info = read_info(message_fname)
        sha = sha1(info['message'].encode('latin1')).hexdigest()
        node_class = AUTHOR2NODE_CLASS[info['author']]
        node = node_class(name=sha,
                          label='\n'.join((sha, info['notes'])),
                          link_to=info['parents'])
        nodes.append(node)
    print(Graph('nobel_prize', nodes))
Beispiel #5
0
def main():
    """ Show graph for snapshots """
    args = get_parser().parse_args()
    root_dir = args.root_dir
    globber = pjoin(root_dir, '*', COMMIT_MSG_FNAME)
    nodes = []
    for message_fname in glob(globber):
        info = read_info(message_fname)
        sha = sha1(info['message']).hexdigest()
        node_class = AUTHOR2NODE_CLASS[info['author']]
        node = node_class(name=sha,
                          label='\n'.join((sha, info['notes'])),
                          link_to=info['parents'])
        nodes.append(node)
    print(Graph('nobel_prize', nodes))