Last active
May 21, 2022 14:41
-
-
Save johnnychen94/3f260750b74e46b52ed0c5a62534140e to your computer and use it in GitHub Desktop.
build the monorepo Images
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# setup: | |
# - install git-filter-repo: https://github.com/newren/git-filter-repo/ | |
repos = readlines("repos") | |
exclude_files = abspath("path_excludes") | |
# clone all repositories into a cache folder so that we don't need to re-clone it again | |
mkpath("workdir") | |
mkpath("cache") | |
for repo in repos | |
workdir = joinpath("workdir", basename(repo)) | |
cache_dir = joinpath("cache", basename(repo)) | |
if !isdir(cache_dir) | |
run(`git clone https://github.com/$repo.git $cache_dir`) | |
end | |
rm(workdir; recursive=true, force=true) | |
cp(cache_dir, workdir) | |
end | |
# for each copied repositories, move the entire history to subfolder | |
for repo in repos | |
workdir = joinpath("workdir", basename(repo)) | |
repo_name, _ = splitext(basename(repo)) | |
new_tagname = "$(repo_name)-" | |
# add repo name as commit prefix | |
# a python function body | |
message_callback = """ | |
return b"[$repo_name] " + message | |
""" | |
run(pipeline(`git | |
-C $workdir | |
filter-repo | |
--invert-paths | |
--to-subdirectory-filter packages/$repo_name | |
--tag-rename '':$new_tagname | |
--message-callback $message_callback` | |
)) | |
# exclude large blobs, docs, and duplicated settings | |
run(`git | |
-C $workdir | |
filter-repo | |
--path-glob "**/docs" | |
--path-glob "**/*.png" | |
--path-glob "**/*.gif" | |
--path-glob "**/*.jpg" | |
--path-glob "**/*.flo" | |
--path-glob "**/*.html" | |
--path-glob "**/.DS_Store" | |
--path-glob "**/.github" | |
--path-glob "**/.codecov.yml" | |
--path-glob "**/.travis.yml" | |
--path-glob "**/appveyor.yml" | |
--path-glob "**/.gitignore" | |
--path-glob "**/.vscode" | |
--path-glob "**/.JuliaFormatter.toml" | |
--invert-paths` | |
) | |
end | |
# rebuild the new repo using the history of all repositories | |
monorepo = "Images" | |
isdir(monorepo) && rm(monorepo; recursive=true, force=true) | |
mkdir(monorepo) | |
run(`git -C $monorepo init`) | |
write(joinpath(monorepo, "README.md"), "# Images") | |
run(`git -C $monorepo add .`) | |
run(`git -C $monorepo commit -m "set up monorepo"`) | |
for repo in repos | |
subdir = joinpath("workdir", basename(repo)) | |
subdir_name, _ = splitext(basename(repo)) | |
run(`git -C $monorepo remote add $(subdir_name) ../$subdir`) | |
run(`git -C $monorepo fetch $(subdir_name)`) | |
run(`git -C $monorepo merge $(subdir_name)/master --allow-unrelated-histories -m "tracking history: $(subdir_name)"`) | |
run(`git -C $monorepo remote remove $(subdir_name)`) | |
end | |
run(`git -C $monorepo remote add origin [email protected]:johnnychen94/Images.jl.git`) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
JuliaImages/HistogramThresholding.jl | |
JuliaImages/ImageAxes.jl | |
JuliaImages/ImageBase.jl | |
JuliaImages/ImageBinarization.jl | |
JuliaImages/ImageCore.jl | |
JuliaImages/ImageContrastAdjustment.jl | |
JuliaImages/ImageDistances.jl | |
JuliaImages/ImageDraw.jl | |
JuliaImages/ImageEdgeDetection.jl | |
JuliaImages/ImageFeatures.jl | |
JuliaImages/ImageFiltering.jl | |
JuliaImages/ImageInpainting.jl | |
JuliaImages/ImageMetadata.jl | |
JuliaImages/ImageMorphology.jl | |
JuliaImages/ImageNoise.jl | |
JuliaImages/ImageQualityIndexes.jl | |
JuliaImages/ImageSegmentation.jl | |
JuliaImages/ImageShow.jl | |
JuliaImages/ImageSmooth.jl | |
JuliaImages/ImageTracking.jl | |
JuliaImages/ImageTransformations.jl | |
JuliaImages/ImageView.jl | |
JuliaImages/Images.jl | |
JuliaImages/IntegralArrays.jl | |
JuliaImages/QRCode.jl |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment