28 lines
915 B
Python
28 lines
915 B
Python
from . import gerrit, forgejo
|
|
import gerrit_linkbot
|
|
|
|
|
|
def main():
|
|
import argparse
|
|
|
|
ap = argparse.ArgumentParser(description='Gerrit link bot')
|
|
ap.add_argument('--fake', action='store_true', help='Fake everything')
|
|
ap.add_argument('--gerrit-per-page', type=int, help='Number of results per page (for backfilling gerrit)')
|
|
ap.add_argument('--poll-interval', type=int, help='How many seconds between polls of Gerrit', default=30)
|
|
|
|
parsed = ap.parse_args()
|
|
|
|
if parsed.fake:
|
|
gerrit_api = gerrit.FakeAPI(gerrit_linkbot.testdata)
|
|
forgejo_api = forgejo.FakeAPI(gerrit_linkbot.testdata)
|
|
else:
|
|
gerrit_api = gerrit.ConcreteAPI()
|
|
forgejo_api = forgejo.ConcreteAPI()
|
|
|
|
service = gerrit_linkbot.Service(gerrit_api, forgejo_api, poll_interval=parsed.poll_interval, gerrit_per_page=parsed.gerrit_per_page)
|
|
service.run()
|
|
|
|
|
|
if __name__ == '__main__':
|
|
main()
|