eden/mononoke/docs/3.3-tools-and-utilities.md
This document describes the command-line tools and utilities available for operating and maintaining Mononoke. These tools provide operational capabilities for administrators, debugging interfaces for developers, and utilities for data operations.
Mononoke provides a collection of command-line tools for various operational tasks. These tools are distinct from servers (which handle client requests) and jobs (which run as long-lived background processes). Tools are invoked on-demand by operators or administrators to perform specific tasks such as importing repositories, verifying data integrity, or performing maintenance operations.
The primary administrative interface is the admin tool, which provides a comprehensive set of subcommands for most operational tasks. Additional specialized tools handle specific operations like repository import, data verification, and storage maintenance.
Understanding the distinction between these three types of applications is important for navigating the codebase and choosing the appropriate component for a task:
Tools (in tools/)
admin, blobimport, aliasverifyJobs (in jobs/)
walker, blobstore_healer, statistics_collectorServers (various top-level directories)
This document focuses on tools—the command-line utilities used for operational and administrative tasks.
Location: tools/admin/
Binary: fbcode//eden/mononoke/tools/admin:admin
The admin tool is the primary command-line interface for Mononoke operators. It provides a unified interface for inspecting and modifying repository state, managing derived data, performing data operations, and debugging issues.
The admin tool is organized into subcommands, each handling a specific aspect of repository administration. The tool includes over 140 command files implementing various operations.
Major subcommand categories:
Repository Operations
bookmarks - Bookmark (branch) management and inspectionchangelog - Changeset log operationscommit - Commit inspection and operationsfetch - Fetch files and changesetsDerived Data
derived-data - Derived data management, derivation, and inspectionderivation-queue - Derivation queue operationsblame - Blame data inspectioncase-conflict - Case conflict detectionStorage Operations
blobstore - Blobstore inspection and operationsraw-blobstore - Direct blobstore accessephemeral-store - Ephemeral storage managementfilestore - File storage operationsCommit Graph
commit-graph - Commit graph operations and inspectionCross-Repository Operations
cross-repo - Cross-repository sync operationscross-repo-config - Cross-repo configuration managementmegarepo - Megarepo (monorepo) operationsGit-Specific Operations
git-bundle - Git bundle operationsgit-symref - Git symbolic reference managementgit-content-ref - Git content reference operationsgit-objects - Git object inspectiongit-cgdm-updater - Git commit graph delta manifest updatesgit-cgdm-components - Git CGDM component inspectionOther Operations
mutable-counters - Mutable counter managementmutable-renames - Mutable rename trackingphases - Commit phase managementredaction - Content redaction operationslocking - Repository lockingasync-requests - Asynchronous request managementcas-store - Content-addressed storage operationsrepo-info - Repository informationlist-repos - List configured repositoriesconvert - Conversion utilitiesslow-bookmark-mover - Controlled bookmark movementThe admin tool is the recommended interface for most operational tasks. Operators should use this tool rather than directly manipulating storage or database state.
Location: tools/testtool/
Binary: fbcode//eden/mononoke/tools/testtool:testtool
The testtool provides utilities for testing and debugging Mononoke in non-production environments. This tool cannot be run against production repositories—it validates the environment and refuses to execute if production configuration is detected.
The testtool is used during development and testing to perform operations that would be inappropriate for production environments. It provides debugging capabilities and test utilities not available in the admin tool.
Location: tools/blobimport/
Binary: fbcode//eden/mononoke/tools/blobimport:blobimport
Blobimport imports Mercurial repositories into Mononoke's blobstore format. The tool reads Mercurial revlog data and converts it to Bonsai changesets and associated data structures.
The import process:
Blobimport supports various options for controlling the import process, including parent order fixes, bookmark policies, and derived data derivation.
Location: git/gitimport/
Binary: fbcode//eden/mononoke/git/gitimport:gitimport
Gitimport imports Git repositories into Mononoke. The tool reads Git objects and converts them to Bonsai changesets while preserving Git-specific metadata.
The import process:
Gitimport supports incremental imports, allowing repositories to be updated with new commits after the initial import.
Location: tools/repo_import/
Binary: fbcode//eden/mononoke/tools/repo_import:repo_import
The repo_import tool handles repository import with additional capabilities beyond basic blobimport or gitimport. It supports:
This tool is used for complex import scenarios where simple blobimport or gitimport is insufficient.
Location: tools/streaming_clone/
Binary: fbcode//eden/mononoke/tools/streaming_clone:streaming_clone
The streaming_clone tool manages streaming clone chunks for Mercurial clients. Streaming clone allows clients to quickly obtain a repository's changelog by downloading pre-generated chunks rather than fetching individual changesets.
The tool provides subcommands to:
Streaming clone chunks are stored in Mononoke's mutable blobstore and served to compatible Mercurial clients.
Location: tools/aliasverify/
Binary: fbcode//eden/mononoke/tools/aliasverify:aliasverify
Aliasverify validates content-addressed aliases in the blobstore. File contents in Mononoke are identified by multiple hash algorithms (SHA-1, SHA-256, Blake2, Blake3, Git SHA-1). The tool verifies that:
The tool can operate in several modes:
Aliasverify is used to detect and repair missing or corrupted alias data.
Location: tools/bonsai_verify/
Binary: fbcode//eden/mononoke/tools/bonsai_verify:bonsai_verify
Bonsai_verify validates the consistency between Bonsai changesets and derived Mercurial data. The tool:
The tool can verify specific changesets, process ranges, or validate entire repository histories. It reports discrepancies between Bonsai and Mercurial representations, which indicate data corruption or conversion errors.
Location: tools/check_git_wc/
Binary: fbcode//eden/mononoke/tools/check_git_wc:check_git_wc
This tool validates that a Bonsai changeset produces the same working copy as a Git commit. It:
The tool is used to verify the correctness of Git ↔ Bonsai conversions and ensure that Mononoke produces working copies identical to native Git.
Location: tools/packer/
Binary: fbcode//eden/mononoke/tools/packer:packer
The packer tool manages packblob operations. Packblob is a blobstore decorator that compresses multiple small blobs into larger packed blobs, reducing storage overhead and improving retrieval efficiency.
The tool accepts a set of blob keys and:
The packer supports parallel packing operations and can run in dry-run mode to estimate compression benefits without modifying storage. See blobstore/packblob/README.md for details on the packblob format.
Location: tools/sqlblob_gc/
Binary: fbcode//eden/mononoke/tools/sqlblob_gc:sqlblob_gc
The sqlblob_gc tool performs garbage collection on SQLblob storage. SQLblob stores blob data in SQL databases (MySQL or SQLite), and over time, unreferenced blobs may accumulate.
The tool provides subcommands to:
This tool is specifically for SQLblob storage and is not applicable to other blobstore types like Manifold or S3.
Location: tools/backfill_mapping/
Binary: fbcode//eden/mononoke/tools/backfill_mapping:backfill_mapping
The backfill_mapping tool populates VCS mapping tables for commits that lack complete mappings. VCS mappings associate Bonsai changesets with their Git or SVN equivalents.
The tool reads a file containing Mercurial changeset IDs and:
This tool is used to repair incomplete mapping data or populate mappings after enabling Git or SVN support for an existing repository.
Location: tools/executor/
Binary: fbcode//eden/mononoke/tools/executor:executor
The executor tool provides a framework for running tasks across multiple repositories or shards. It handles:
The executor is used as a framework by other tools that need to operate on multiple repositories concurrently.
Location: tools/import/
The import directory contains shared libraries and utilities used by various import tools (blobimport, gitimport, repo_import). These are not standalone tools but provide common functionality for repository imports.
For routine operations: Use the admin tool. Most common administrative tasks have corresponding admin subcommands.
For importing repositories:
blobimportgitimportrepo_importFor data verification:
aliasverifybonsai_verifycheck_git_wcwalker (see Jobs and Background Workers)For storage maintenance:
packersqlblob_gcblobstore_healer job handles this automaticallyFor debugging and testing: Use testtool in non-production environments, or use specific admin subcommands in production.
All Mononoke tools follow consistent implementation patterns:
Framework: Tools use cmdlib/mononoke_app/ as the standard application framework, providing:
Repository Access: Tools use the facet pattern to access repository capabilities. A tool declares which facets it requires, and the framework provides a composed repository object.
Execution: Tools are single-execution programs—they perform their task and exit. Long-running operations should be implemented as jobs rather than tools.
Safety: Tools that modify repository state typically include dry-run modes, validation checks, and logging to prevent accidental data corruption.
Several tools have corresponding background jobs that perform similar operations continuously:
aliasverify tool verifies specific changesets; continuous verification runs as a scheduled taskblobstore_healer job performs continuous healing; tools can trigger one-off repairswalker job validates repositories continuously; admin tool provides one-off validation commandsThe distinction is that tools are invoked on-demand for specific operations, while jobs run continuously for ongoing maintenance.
All tools provide command-line help via --help flags. The admin tool's subcommands each have individual help text describing their options and usage.
Component-specific documentation:
tests/integration/ demonstrate tool usagetools/admin/src/commands/ shows available operationsMononoke's tools provide operational capabilities for repository management, data import, verification, and maintenance. The admin tool serves as the primary administrative interface, offering a unified command-line API for most common tasks. Specialized tools handle specific operations like repository import, data verification, and storage maintenance.
Tools are distinct from servers (which handle client requests) and jobs (which run continuously). Understanding this distinction helps operators choose the appropriate tool for each task and understand how the components fit into Mononoke's overall architecture.
For background maintenance operations, see Jobs and Background Workers. For server components, see Servers and Services.