import os 
import csv 
import datetime

from pyrepohistory import repo_lifecycle

file_location = "/data/users/mgaughan/mw-repo-lifecycles/commit_data/"
repo_location = "/data/users/mgaughan/mw-repo-lifecycles/repo_artifacts/"

cst = datetime.timezone(datetime.timedelta(hours=-6))

repos = {
        "extensions_visualeditor" : {
            "url": "https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor",
            "from_date": datetime.datetime(2010, 1, 1, 00, 00, 00, tzinfo=cst),
            "to_date": datetime.datetime(2024, 12, 31, 00, 00, 00, tzinfo=cst)
            },
}
'''
        "parsoid" : {
            "url": "https://gerrit.wikimedia.org/r/pywikibot/core",
            "from_date": datetime.datetime(2010, 1, 1, 00, 00, 00, tzinfo=cst),
            "to_date": datetime.datetime(2024, 12, 31, 00, 00, 00, tzinfo=cst)
            }
        }
'''

for repo in repos.keys():
    print(repos[repo])
    print(repos[repo]['url'])
    print(repos[repo]["from_date"])
    print(repos[repo]["to_date"])
    repo_info = repos[repo]
    repo_lifecycle(repo_info['url'], repo_location + repo + "/tmp", repo_info["from_date"], repo_info["to_date"], to_save=False, csv_loc_prefix=file_location)

