软件传统Mercurial加载器
swh.loader.mercurial的Python项目详细描述
SWH装载机Mercurial
配置文件
在加载程序的通常位置,{/etc/softwarehitage/~/.swh/| ~/.config/swh/}加载程序/hg.yml:
storage:cls:remoteargs:url:http://localhost:5002/
基本用途
导入Mercurial存储库的主要入口点是main
函数
在swh.loader.mercurial.cli
模块中定义:
python3 -m swh.loader.mercurial.cli
如果python包是通过pip
安装的,那么您应该能够
键入:
user@host:~$ swh-loader-hg --help Usage: swh-loader-hg [OPTIONS] ORIGIN_URL Options: -d, --hg-directory TEXT Path to the hg (local) directory to load from. If unset, the hg repo will ben cloned from the given (origin) url -a, --hg-archive TEXT Path to the hg (local) archive file to load from. -D, --visit-date TEXT Visit date (defaults to now) -l, --log-level [NOTSET|DEBUG|INFO|WARNING|ERROR|CRITICAL] Log level --help Show this message and exit.
例如:
user@host:~$ swh-loader-hg https://www.mercurial-scm.org/repo/hello [...]
来自python
来自python3的顶层:
遥控器
project='hello'# remote repositoryorigin_url='https://www.mercurial-scm.org/repo/%s'%project# local clonedirectory='/home/storage/hg/repo/%s'%projectimportlogginglogging.basicConfig(level=logging.DEBUG)fromswh.loader.mercurial.tasksimportLoadMercurialt=LoadMercurial()t.run(origin_url=origin_url,directory=directory,visit_date='2016-05-03T15:16:32+00:00')
本地目录
到目前为止,只填充了源、内容和目录。
其余对象为空(修订、发布、引用)。
project='756015-ipv6'directory='/home/storage/hg/repo/%s'%projectorigin_url='https://%s.googlecode.com'%projectimportlogginglogging.basicConfig(level=logging.DEBUG)fromswh.loader.mercurial.tasksimportLoadMercurialt=LoadMercurial()t.run(origin_url=origin_url,directory=directory,visit_date='2016-05-03T15:16:32+00:00')
本地存档
project='756015-ipv6-source-archive.zip'archive_path='/home/storage/hg/repo/%s'%projectorigin_url='https://%s-archive.googlecode.com'%projectimportlogginglogging.basicConfig(level=logging.DEBUG)fromswh.loader.mercurial.tasksimportLoadArchiveMercurialt=LoadArchiveMercurial()t.run(origin_url=origin_url,archive_path=archive_path,visit_date='2016-05-03T15:16:32+00:00')