|
# This code merges `eglot.el` from joaotavora/eglot to upstream |
|
# `emacs.git` master branch. |
|
# |
|
# It does the following things: |
|
# |
|
# - Move eglot.el to lisp/progmodes/eglot.el |
|
# |
|
# - Preserve complete history from original repo for the file |
|
# |
|
# - Edit commit messages to append URLs for all mentioned issues and |
|
# PRs to individual commit message |
|
|
|
# Dependencies required |
|
# |
|
# - https://github.com/newren/git-filter-repo |
|
# nix shell nixpkgs#git-filter-repo |
|
# arch: pacman -S git-filter-repo |
|
# - git |
|
|
|
# While made by order, it is perfect example and suitable to rearrange |
|
# code while preserving as well as modifying git history |
|
# programmatically. |
|
|
|
# Hope it helps! |
|
# |
|
# |
|
# Repo will be cloned in this directory if they don't exist directory. |
|
# No repo update will be performed automatically. |
|
# |
|
# It is recommended that the Emacs repo be cloned here under the |
|
# scratch/eglot2emacs branch. This can be done by moving on to the |
|
# principal emacs worktree and typing: |
|
# |
|
# git worktree add /path-to-this-files-directory/emacs scratch/eglot2emacs |
|
# |
|
# If (when) things go sour, this normally helps: |
|
# |
|
# rm -rf eglot # will be recloned |
|
# cd emacs |
|
# git merge --abort |
|
# cd ../ |
|
# |
|
# clone repos |
|
test -d eglot/.git || git clone https://github.com/joaotavora/eglot.git |
|
test -d emacs/.git || git clone -b master git://git.sv.gnu.org/emacs.git |
|
|
|
# filter eglot to keep only eglot.el. This destroys the current |
|
# worktree of the repo. |
|
# |
|
# move eglot.el to lisp/progmodes/eglot.el -> This makes history file |
|
# specific and everything makes find+replace in commit messages |
|
|
|
( |
|
cd eglot |
|
|
|
git filter-repo -f --message-callback ../adjust-issue-references.py |
|
|
|
git filter-repo -f --commit-callback ../adjust-some-commits.py |
|
|
|
git filter-repo -f --mailmap ../mailmap.txt |
|
|
|
git filter-repo -f --to-subdirectory-filter lisp/progmodes/ --path eglot.el |
|
) |
|
|
|
( |
|
cd emacs |
|
git reset --hard origin/master |
|
# add filtered eglot as upstream |
|
git remote add eglot2emacs-filtered-eglot ../eglot/ |
|
git fetch eglot2emacs-filtered-eglot master |
|
git merge remotes/eglot2emacs-filtered-eglot/master --allow-unrelated-histories --no-commit |
|
# make a commit |
|
git commit -m "; Merge from https://github.com/joaotavora/eglot" |
|
) |
|
|
|
|
|
|