forked from importers/git-importer
Add the capability to export the package data as test fixture
This commit is contained in:
@@ -8,6 +8,7 @@ import sys
|
||||
|
||||
import osc.core
|
||||
|
||||
from lib.exporter import Exporter
|
||||
from lib.importer import Importer
|
||||
|
||||
URL_OBS = "https://api.opensuse.org"
|
||||
@@ -88,6 +89,11 @@ def main():
|
||||
action="store_true",
|
||||
help="Import revisions into database only",
|
||||
)
|
||||
parser.add_argument(
|
||||
"--export",
|
||||
action="store_true",
|
||||
help="Export database fields for the given package as JSON",
|
||||
)
|
||||
|
||||
args = parser.parse_args()
|
||||
|
||||
@@ -103,6 +109,10 @@ def main():
|
||||
requests_log.setLevel(logging.DEBUG)
|
||||
requests_log.propagate = True
|
||||
|
||||
if args.export:
|
||||
Exporter(args.package).run()
|
||||
return
|
||||
|
||||
if not args.repodir:
|
||||
args.repodir = pathlib.Path(args.package)
|
||||
|
||||
@@ -117,6 +127,7 @@ def main():
|
||||
importer = Importer(
|
||||
PROJECTS, args.package, args.repodir, args.search_ancestor, args.rebase_devel
|
||||
)
|
||||
|
||||
if args.db:
|
||||
importer.import_into_db()
|
||||
return
|
||||
|
Reference in New Issue
Block a user