I've created a tool that takes a downstream repository and imports it
into the monorepo such that trees appear under a given subdirectory in
This is useful for downstream users who have repositories that make
heavy use of LLVM libraries and logically operate as extensions of the
By default, downstream repo commits are rewritten such that the *only*
blobs in their trees are from the downstream repo. Thus checking out
such commits will populate the workare with *only* the subdirectory
containing the imported repository artifacts. A post-import merge with
an upstream monorepo commit will unify the trees and result in checkouts
that populate the workarea with monorepo and downstream repo artifacts.
There are some experimental options to rewrite downstream repo trees
alongside an existing monorepo tree but they are not well-tested.
There is no effort to interleave commits from the downstream repo with
commits from other imported downstream repos, or downstream branches of
the monorepo. That would be a separate tool, I think, and would require
some fundamental reworking of fast_filter_branch.py that I didn't want
to tackle at this point. If such downstream repos and/or branches have
commits ordered via submodule updates in some "umbrella" repository,
then zip-downstream-fork.py can be used to import and interleave them:
Hopefully others will find these tools useful.