Exemple #1
0
            'committer': match.group(1),
            'mail': match.group(2),
            'time': commit.commit_time,
            'message': commit.message,
            })
    
    return commits

if __name__ == '__main__':
    import sys
    from json_batch import update_batch

    if len(sys.argv) < 2:
        print "Please specify a path"
        sys.exit(1)
    else:
        paths = sys.argv[1:]

        commits = {}

        for path in paths:
            commits.update(import_dir(path))

        if not commits:
            print "ERROR: No results!"
        else:
            update_batch(commits, "raw_dvcs.json")

            print "Found repositories: " + ', '.join(sorted(commits.keys()))

Exemple #2
0
    return batch


if __name__ == "__main__":
    batch_fn = "raw_github_commits.json"

    if len(sys.argv) < 2:
        print "Please specify at least one repository (user/repository/branch)"
        sys.exit(1)
    elif len(sys.argv) < 3:
        user = sys.argv[1]

        batch = fetch_user(user)

        update_batch(batch, batch_fn)
    else:
        user = sys.argv[1]
        repo = sys.argv[2]
        branch = sys.argv[3] if len(sys.argv) >= 4 else "master"

        commits = fetch_repo(user, repo, branch)

        if not commits:
            print "ERROR: No results!"
        else:
            repo_id = "/".join((user, repo, branch))
            save_batch(repo, commits, batch_fn)

            print "Amount of commits:  %i" % len(commits)
            print