Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Code used to extract history from MLJBase #1

Closed
giordano opened this issue Mar 20, 2021 · 0 comments
Closed

Code used to extract history from MLJBase #1

giordano opened this issue Mar 20, 2021 · 0 comments

Comments

@giordano
Copy link
Member

giordano commented Mar 20, 2021

Similarly to https://github.com/JuliaLang/Statistics.jl/issues/1, this is the bash script I used to extract the history of the relevant files in MLJBase.jl:

#!/bin/bash

set -xeuf -o pipefail

JULIA_DEV_DIR="${HOME}/.julia/dev"
ORIGPACKAGE="MLJBase"
NEWPACKAGE="MLJOpenML"
BRANCH="dev"

git clone -b "${BRANCH}" --single-branch --no-tags "${JULIA_DEV_DIR}/${ORIGPACKAGE}" "${JULIA_DEV_DIR}/${NEWPACKAGE}"
cd "${JULIA_DEV_DIR}/${NEWPACKAGE}"

# https://ptc-it.de/move-files-to-new-repo-in-git/#
git filter-branch --prune-empty --index-filter \
    'git ls-tree -r -z --name-only --full-tree ${GIT_COMMIT} | \
     grep -z -v "LICENSE" | \
     grep -z -v ".gitignore" | \
     grep -z -v "src/openml.jl" | \
     grep -z -v "test/openml.jl" | \
     xargs -0 -r git rm --cached -r' -f -- --all

# https://stackoverflow.com/a/38420284/2442087
git filter-branch -f --prune-empty --parent-filter \
    'sed "s/-p //g" | xargs -r git show-branch --independent | sed "s/\</-p /g"'

# Squeeze repository size
# https://help.github.com/en/github/authenticating-to-github/removing-sensitive-data-from-a-repository
git for-each-ref --format="delete %(refname)" refs/original | git update-ref --stdin && \
    git reflog expire --all --expire=now && \
    git gc --prune=now --aggressive
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant