diff options
-rwxr-xr-x | bin/just-import-git.py | 10 | ||||
-rw-r--r-- | share/man/just-import-git.1.md | 3 |
2 files changed, 12 insertions, 1 deletions
diff --git a/bin/just-import-git.py b/bin/just-import-git.py index c362469a..7416bb7b 100755 --- a/bin/just-import-git.py +++ b/bin/just-import-git.py @@ -227,7 +227,7 @@ def name_imports(to_import: List[str], def rewrite_repo(repo_spec: Json, *, remote: Dict[str, Any], - assign: Json) -> Json: + assign: Json, absent: bool) -> Json: new_spec: Json = {} repo = repo_spec.get("repository", {}) if isinstance(repo, str): @@ -242,6 +242,8 @@ def rewrite_repo(repo_spec: Json, *, remote: Dict[str, Any], existing_repos: List[str] = repo.get("repositories", []) new_repos = [assign[k] for k in existing_repos] repo = dict(repo, **{"repositories": new_repos}) + if absent and isinstance(repo, dict): + repo["pragma"] = dict(repo.get("pragma", {}), **{"absent": True}) new_spec["repository"] = repo for key in ["target_root", "rule_root", "expression_root"]: if key in repo_spec: @@ -319,6 +321,7 @@ def handle_import(args: Namespace) -> Json: foreign_repos[repo], remote=remote, assign=total_assign, + absent=args.absent, ) base_config["repositories"] = base_repos shutil.rmtree(to_cleanup) @@ -352,6 +355,11 @@ def main(): " single-repository one", ) parser.add_argument( + "--absent", + action="store_true", + help="Import repository and all its dependencies as absent." + ) + parser.add_argument( "--as", dest="import_as", help="Name prefix to import the foreign repository as", diff --git a/share/man/just-import-git.1.md b/share/man/just-import-git.1.md index b3eca023..83eb2e6e 100644 --- a/share/man/just-import-git.1.md +++ b/share/man/just-import-git.1.md @@ -82,6 +82,9 @@ for a single repository. Useful, if the repository to be imported does not have a repository configuration or should be imported without dependencies. +**`--absent`** +Add the pragma `{"absent": true}` to all imported repositories. + **`--mirror`** *`URL`* Provides an alternative fetch location for the imported repository. Specifying this option multiple times will accumulate URLs in the order |