Changeset View
Changeset View
Standalone View
Standalone View
swh/loader/mercurial/cli.py
# Copyright (C) 2018 The Software Heritage developers | # Copyright (C) 2018 The Software Heritage developers | ||||
# See the AUTHORS file at the top-level directory of this distribution | # See the AUTHORS file at the top-level directory of this distribution | ||||
# License: GNU General Public License version 3, or any later version | # License: GNU General Public License version 3, or any later version | ||||
# See top-level LICENSE file for more information | # See top-level LICENSE file for more information | ||||
import datetime | import datetime | ||||
from itertools import chain | |||||
import logging | import logging | ||||
from itertools import chain | |||||
marmoute: seems like some unrelated change. | |||||
Done Inline ActionsWhen you commit change in a file that has not been sorted before isort has been added to precommit, the imports get updated. acezar: When you commit change in a file that has not been sorted before isort has been added to… | |||||
Done Inline ActionsOkay, so it looks like the import should habe been sorted when the pre-commit hook was added, but that is out of scope for this change I guess. marmoute: Okay, so it looks like the import should habe been sorted when the pre-commit hook was added… | |||||
import click | import click | ||||
LOGLEVELS = list( | LOGLEVELS = list( | ||||
chain.from_iterable( | chain.from_iterable( | ||||
(logging._levelToName[lvl], logging._levelToName[lvl].lower()) | (logging._levelToName[lvl], logging._levelToName[lvl].lower()) | ||||
for lvl in sorted(logging._levelToName.keys()) | for lvl in sorted(logging._levelToName.keys()) | ||||
) | ) | ||||
) | ) | ||||
Show All 21 Lines | logging.basicConfig( | ||||
level=(log_level or "DEBUG").upper(), | level=(log_level or "DEBUG").upper(), | ||||
format="%(asctime)s %(process)d %(message)s", | format="%(asctime)s %(process)d %(message)s", | ||||
) | ) | ||||
if not visit_date: | if not visit_date: | ||||
visit_date = datetime.datetime.now(tz=datetime.timezone.utc) | visit_date = datetime.datetime.now(tz=datetime.timezone.utc) | ||||
kwargs = {"visit_date": visit_date, "origin_url": origin_url} | kwargs = {"visit_date": visit_date, "origin_url": origin_url} | ||||
if hg_archive: | if hg_archive: | ||||
from .loader import HgArchiveBundle20Loader as HgLoader | from .loader import HgArchiveLoader as HgLoader | ||||
kwargs["archive_path"] = hg_archive | kwargs["archive_path"] = hg_archive | ||||
else: | else: | ||||
from .loader import HgBundle20Loader as HgLoader | from .loader import HgLoader | ||||
Done Inline Actionssame question about replacing the loader there. marmoute: same question about replacing the loader there. | |||||
Done Inline ActionsSame answer: loader.py acezar: Same answer: loader.py | |||||
kwargs["directory"] = hg_directory | kwargs["directory"] = hg_directory | ||||
return HgLoader().load(**kwargs) | return HgLoader().load(**kwargs) | ||||
if __name__ == "__main__": | if __name__ == "__main__": | ||||
main() | main() |
seems like some unrelated change.