Skip to main content

Software Heritage Mercurial Loader

Project description

swh-loader-mercurial

Configuration file

In usual location for a loader, {/etc/softwareheritage/ | ~/.swh/ | ~/.config/swh/}loader/hg.yml:

storage:
  cls: remote
  args:
    url: http://localhost:5002/

Basic use

The main entry point to import a Mercurial repository is the main function defined in the swh.loader.mercurial.cli module:

python3 -m swh.loader.mercurial.cli

If the Python package has been installed via pip, you should be able to type:

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.

For example:

user@host:~$ swh-loader-hg https://www.mercurial-scm.org/repo/hello
[...]

From Python

From python3's toplevel:

Remote

project = 'hello'
# remote repository
origin_url = 'https://www.mercurial-scm.org/repo/%s' % project
# local clone
directory = '/home/storage/hg/repo/%s' % project

import logging
logging.basicConfig(level=logging.DEBUG)

from swh.loader.mercurial.tasks import LoadMercurial

t = LoadMercurial()
t.run(origin_url=origin_url, directory=directory, visit_date='2016-05-03T15:16:32+00:00')

local directory

Only origin, contents, and directories are filled so far.

Remaining objects are empty (revision, release, occurrence).

project = '756015-ipv6'
directory = '/home/storage/hg/repo/%s' % project
origin_url = 'https://%s.googlecode.com' % project

import logging
logging.basicConfig(level=logging.DEBUG)

from swh.loader.mercurial.tasks import LoadMercurial

t = LoadMercurial()
t.run(origin_url=origin_url, directory=directory, visit_date='2016-05-03T15:16:32+00:00')

local archive

project = '756015-ipv6-source-archive.zip'
archive_path = '/home/storage/hg/repo/%s' % project
origin_url = 'https://%s-archive.googlecode.com' % project

import logging
logging.basicConfig(level=logging.DEBUG)

from swh.loader.mercurial.tasks import LoadArchiveMercurial

t = LoadArchiveMercurial()
t.run(origin_url=origin_url, archive_path=archive_path, visit_date='2016-05-03T15:16:32+00:00')

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

swh.loader.mercurial-0.0.15.tar.gz (46.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

swh.loader.mercurial-0.0.15-py3-none-any.whl (62.5 kB view details)

Uploaded Python 3

File details

Details for the file swh.loader.mercurial-0.0.15.tar.gz.

File metadata

  • Download URL: swh.loader.mercurial-0.0.15.tar.gz
  • Upload date:
  • Size: 46.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.20.1 setuptools/40.6.2 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.5.3

File hashes

Hashes for swh.loader.mercurial-0.0.15.tar.gz
Algorithm Hash digest
SHA256 03611ff6818841667be6016b7e0b4f958509bd1526e140d0d1a1b83ccedc063d
MD5 da1f826030f78b5cc950afd11e335ce8
BLAKE2b-256 8425d04e0496d21850c8d32c41720a4f884796f4ae63166be191d89cdf06054d

See more details on using hashes here.

File details

Details for the file swh.loader.mercurial-0.0.15-py3-none-any.whl.

File metadata

  • Download URL: swh.loader.mercurial-0.0.15-py3-none-any.whl
  • Upload date:
  • Size: 62.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.20.1 setuptools/40.6.2 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.5.3

File hashes

Hashes for swh.loader.mercurial-0.0.15-py3-none-any.whl
Algorithm Hash digest
SHA256 8c474c47dbda40290a8c536f92c70a34181b55aacc4d6105f4d0822589d48338
MD5 3b69022a11e63589394994d9e5cf8538
BLAKE2b-256 28e96b70068c99bcd2a4e0826bff185f4207d261c180fce79b946cf4beed8df0

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page