diff --git a/debian/control b/debian/control index 8917b97..ef300ac 100644 --- a/debian/control +++ b/debian/control @@ -1,37 +1,38 @@ Source: swh-loader-mercurial Maintainer: Software Heritage developers Section: python Priority: optional Build-Depends: debhelper (>= 9), dh-python (>= 2), python3-all, + python3-click, python3-dateutil, python3-nose, python3-setuptools, python3-vcversioner, python3-retrying, python3-hglib, patool, python3-swh.core (>= 0.0.36~), python3-swh.model (>= 0.0.27~), python3-swh.storage (>= 0.0.95~), python3-swh.scheduler (>= 0.0.19~), python3-swh.loader.core (>= 0.0.33~), python-sqlitedict Standards-Version: 3.9.6 Homepage: https://forge.softwareheritage.org/source/swh-loader-mercurial/ Package: python3-swh.loader.mercurial Architecture: all Depends: python3-swh.core (>= 0.0.36~), python3-swh.loader.core (>= 0.0.33~), python3-swh.model (>= 0.0.27~), python3-swh.storage (>= 0.0.95~), python3-swh.scheduler (>= 0.0.19~), patool, python-sqlitedict, python3-hglib, ${misc:Depends}, ${python3:Depends} Description: Software Heritage Mercurial Loader Module in charge of loading hg/mercurial repositories into swh storage. diff --git a/requirements.txt b/requirements.txt index 1a1c18f..3e8c649 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,9 +1,10 @@ # Add here external Python modules dependencies, one per line. Module names # should match https://pypi.python.org/pypi names. For the full spec or # dependency lines, see https://pip.readthedocs.org/en/1.1/requirements.html +click patool python-dateutil python-hglib retrying sqlitedict vcversioner diff --git a/swh/loader/mercurial/cli.py b/swh/loader/mercurial/cli.py index ae4e3f7..0d32e19 100644 --- a/swh/loader/mercurial/cli.py +++ b/swh/loader/mercurial/cli.py @@ -1,48 +1,51 @@ # Copyright (C) 2018 The Software Heritage developers # See the AUTHORS file at the top-level directory of this distribution # License: GNU General Public License version 3, or any later version # See top-level LICENSE file for more information -import datetime import click +import datetime import logging -LOGLEVELS = [logging._levelToName[lvl] - for lvl in sorted(logging._levelToName.keys())] +from itertools import chain + +LOGLEVELS = list(chain.from_iterable((logging._levelToName[lvl], + logging._levelToName[lvl].lower()) + for lvl in sorted(logging._levelToName.keys()))) @click.command() @click.argument('origin-url') @click.option('--hg-directory', '-d', help=('Path to the hg (local) directory to load from. ' 'If unset, the hg repo will be cloned from the ' 'given (origin) url.')) @click.option('--hg-archive', '-a', help=('Path to the hg archive file to load from.')) @click.option('--visit-date', '-D', help='Visit date (defaults to now).') @click.option('--log-level', '-l', - type=click.Choice(LOGLEVELS, case_sensitive=False), + type=click.Choice(LOGLEVELS), help='Log level.') def main(origin_url, hg_directory=None, hg_archive=None, visit_date=None, log_level=None): logging.basicConfig( level=(log_level or 'DEBUG').upper(), format='%(asctime)s %(process)d %(message)s') if not visit_date: visit_date = datetime.datetime.now(tz=datetime.timezone.utc) kwargs = {'visit_date': visit_date, 'origin_url': origin_url} if hg_archive: from .loader import HgArchiveBundle20Loader as HgLoader kwargs['archive_path'] = hg_archive else: from .loader import HgBundle20Loader as HgLoader kwargs['directory'] = hg_directory return HgLoader().load(**kwargs) if __name__ == '__main__': main()