Skip to main content

mr group import

Upload a group export tar, parse it into an import plan, and optionally apply it. Takes the path to a tar file (produced by mr group export or the /v1/groups/export API) as its single positional argument.

The command runs a two-phase job pipeline: first a parse job uploads the tar, validates the manifest schema version, and produces an ImportPlan (counts, mappings, conflicts, dangling refs). Then — unless --dry-run is set — an apply job actually creates the groups and related entities.

Use --dry-run to inspect the plan without mutating state. Use --plan-output <file> to save the parsed plan JSON. Use --parent-group <id> to graft imported top-level groups under an existing parent. Use --on-resource-conflict=skip|duplicate and --guid-collision-policy=merge|skip|replace to steer conflict resolution. For full manual control over every mapping/dangling/shell decision, pass --decisions <json-file> produced from a prior dry-run.

When the server plan reports resources without bytes in the tar, --acknowledge-missing-hashes is required to proceed.

Usage

mr group import <tarfile>

Positional arguments:

  • <tarfile>

Examples

Dry-run an import and print the plan

mr group import /tmp/trip-2026.tar --dry-run

Import

mr group import /tmp/trip-2026.tar --parent-group 17

Dry-run to JSON file for review

mr group import /tmp/trip-2026.tar --dry-run --plan-output /tmp/plan.json

Flags

FlagTypeDefaultDescription
--dry-runboolfalseParse and print the plan without applying
--plan-outputstring``Write the plan JSON to a file
--poll-intervalduration1sPolling interval
--timeoutduration30m0sMax total wait time
--parent-groupuint0Parent group ID for imported top-level groups
--on-resource-conflictstringskipResource collision policy: "skip" or "duplicate"
--guid-collision-policystring``GUID collision policy: "merge", "skip", or "replace" (default: server default = "merge")
--auto-mapbooltrueAutomatically accept plan mapping suggestions
--acknowledge-missing-hashesboolfalseProceed even when some resources have no bytes
--decisionsstring``Path to a decisions JSON file (overrides other flags)

Inherited global flags

FlagTypeDefaultDescription
--jsonboolfalseOutput raw JSON
--no-headerboolfalseOmit table headers
--pageint1Page number for list commands (default page size: 50)
--quietboolfalseOnly output IDs
--serverstringhttp://localhost:8181mahresources server URL (env: MAHRESOURCES_URL)

Output

ImportPlan (dry-run) or ImportApplyResult object with CreatedGroups, CreatedResources, SkippedByHash, CreatedNotes, CreatedGroupIDs arrays, etc.

Exit Codes

0 on success; 1 on any error

See Also