Metadata-Version: 2.4
Name: jsubmod
Version: 0.0.11
Summary: Sync git repositories defined in a remote JSON file as submodules.
Author: Quincy.Loong
Requires-Python: >=3.9
Description-Content-Type: text/markdown

# jsubmod

Sync repositories from a remote JSON file into the current Git repository as submodules.

## Local config

Create a file named `jsubmod.json` in the Git repository where you want to manage submodules:


The tool reads `project_cfg.json` from the remote repository by using `git archive`.

## Remote config format

The remote JSON file can contain `repository` and `files` lists:


Entries in `files` are downloaded by `jsubmod init` with `git archive`:


If `commit` is `latest`, `jsubmod` updates the submodule to the latest commit on the configured branch. Otherwise it checks out the specified commit hash. In both cases, the configured branch is checked out locally and tracks `origin/<branch>`; a pinned older commit will therefore appear behind its upstream branch. After syncing, the parent repository automatically commits any submodule pointer or `.gitmodules` changes.

## Usage

Initialize the remote configuration file in the current repository:

```bash
jsubmod init
```

This reads the `remote` section from the local `jsubmod.json`, downloads and parses the configured JSON `file` with `git archive`, then downloads every entry in its `files` list and synchronizes its `repository` list into the current repository. An alternative local config path can be supplied as `jsubmod init path/to/config.json`.

Run synchronization with:

```bash
python -m pip install -e .
jsubmod
```

During synchronization, a submodule with uncommitted changes or local commits ahead of its tracked remote branch is reported and skipped. A submodule that is only behind its remote branch is updated automatically.
