Skip to content

Instantly share code, notes, and snippets.

@skangas
Last active November 29, 2022 17:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save skangas/0f853d5ae90aba90f18ab27236aaaaa7 to your computer and use it in GitHub Desktop.
Save skangas/0f853d5ae90aba90f18ab27236aaaaa7 to your computer and use it in GitHub Desktop.
emacs
use-package
def doit(m):
m = re.sub(b"\r",b"",m)
refs = []
refverb = None
url = "https://github.com/jwiegley/use-package/issues/"
header = "GitHub-reference:"
[firstline, _ , rest] = m.partition(b'\n')
def collect_firstline_ref(match):
nonlocal refverb
refverb = match.group(1) or refverb
refs.append([match.group(2), refverb])
return b""
def adjust_firstline(fl):
ret = re.sub(b" *(Per|Fix(?:es)?|Close(?:s)?)? *#([0-9]+)(?:[,:] *)?",
collect_firstline_ref,
fl)
ret = re.sub(b"(?:\(\) )?\.$", b"", ret)
return ret.strip()
rest = re.sub(b"#([0-9]+)",
f"{url}\\1".encode(),
rest)
rest = rest.strip()
def bottom_reference(p):
verb = f"{p[1].decode().lower()} " if p[1] else ""
return f"{header} {verb}{url}{p[0].decode()}".encode()
last_line_is_header = bool(re.search(b"\n[A-Z][^\s:\n]*: [^:\n]*$", rest))
ret = (adjust_firstline(firstline).strip()
+ b"\n\n"
+ rest
+ b"\n"
+ (b"" if last_line_is_header else b"")
+ b"\n".join(map(bottom_reference, refs)))
ret = re.sub(b"\n\s*\n\s*\n", b"\n\n", ret)
# Fix some typos
ret = re.sub(b"supercedes", b"supersedes", ret)
ret = re.sub(b"hilighting", b"highlighting", ret)
ret = re.sub(b"lenght", b"length", ret)
ret = re.sub(b"shold", b"should, hold, sold", ret)
ret = re.sub(b"Unfortunatly", b"Unfortunately", ret)
ret = re.sub(b"fixallow", b"Allow", ret)
ret = re.sub(b"fixuse", b"Use", ret)
ret = re.sub(b"pacakage", b"pacakage", ret)
return ret
return doit(message)
if (not re.search(b"Copyright-[Pp]aperwork-[Ee]xempt:.*[Yy]es", commit.message)):
print((commit.author_name + b"\t<" + commit.author_email + b">").decode())
Aaron Meurer <asmeurer@gmail.com>
Adam Spiers <emacs@adamspiers.org>
Adam Spiers <emacs@adamspiers.org> <adam@pacific.linksys.moosehall>
Adam Spiers <emacs@adamspiers.org> <github@adamspiers.org>
Aleksey Kladov <aleksey.kladov@gmail.com>
Alex Branham <alex.branham@gmail.com>
Alex Branham <alex.branham@gmail.com> <branham@utexas.edu>
Alex Kosorukoff <alex@3form.com>
Alex Kost <alezost@gmail.com>
Andrew Pennebaker <andrew.pennebaker@gmail.com>
Andrew Schwartzmeyer <andrew@schwartzmeyer.com>
Andrew Stribblehill <stribb@gmail.com>
Andrew Stribblehill <stribb@gmail.com> <ads@wompom.org>
Andrey Listopadov <andreyorst@gmail.com>
Andrés Saraos Luna <saraoslunaandres@gmail.com>
Artyom Khramov <futu.fata@gmail.com>
Basil L. Contovounesios <contovob@tcd.ie>
Berend de Boer <berend@pobox.com>
Berk D. Demir <bdd@mindcast.org>
Bernard Hurley <bernard@marcade.biz>
Bjarte Johansen <bjarte.johansen@gmail.com>
Brian Burns <bburns.km@gmail.com>
Carl Lieberman <dev@carl.ac>
Chunyang Xu <xuchunyang56@gmail.com>
Codruț Constantin Gușoi <mail+git@codrut.pro>
Damien Cassou <damien.cassou@gmail.com>
Damien Cassou <damien.cassou@gmail.com> <damien@cassou.me>
Damien Merenne <dam@cosinux.org>
Daniel Martín <mardani29@yahoo.es>
Daniel Mendler <mail@daniel-mendler.de>
Daniel Perez Alvarez <danielpza@protonmail.com>
Daniel Yaren <yarendaniel@gmail.com>
Dave Abrahams <dave@boostpro.com>
David Leatherman <git@david.leatherman.fm>
Deployment Bot (from Travis CI) <deploy@travis-ci.org>
Donald Curtis <dcurtis@milkbox.net>
Dror Levin <spatz@psybear.com>
Edward Knyshov <edvorg@gmail.com>
François Févotte <fevotte@gmail.com>
George Hartzell <hartzell@alerce.com>
Grant Rettke <grettke@acm.org>
Hugo Heagren <hugo@heagren.com>
Indradhanush Gupta <indradhanush.gupta@gmail.com>
Ivan Goncharov <kovrik0@gmail.com>
Ivan Goncharov <kovrik0@gmail.com> <Ivan.Goncharov@wexinc.co.nz>
Jacob First <jacob.first@member.fsf.org>
James Reed <jcrd@tuta.io>
Jimmy Yuen Ho Wong <wyuenho@gmail.com>
Jimmy Yuen Ho Wong <wyuenho@gmail.com> <wyuenho@users.noreply.github.com>
Joe Wreschnig <joe.wreschnig@gmail.com>
Johann Klähn <johann@jklaehn.de>
John Lee <jjl@pobox.com>
John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com> <jwiegley@gmail.com>
Jonas Bernoulli <jonas@bernoul.li>
Justin Burkett <justin@burkett.cc>
Justin Talbott <justin@waymondo.com>
Kaleb Elwert <belak@coded.io>
Koen van Greevenbroek <koen@localhost.com>
Laurence Rochfort <laurence.rochfort@gmail.com>
Lukas Barth <mail@tinloaf.de>
Marc Webbie <marcwebbie@gmail.com>
Martin Geisler <martin@geisler.net>
Matthew Feinberg <ketbra@users.noreply.github.com>
Matthew Justin Bauer <mjbauer95@gmail.com>
Matthias Schmitt <male.schmitt@posteo.de>
Matus Goljer <dota.keys@gmail.com>
Mike Appleby <mike@app.leby.org>
Miks Kalnins <MiksKalnins@maikumori.com>
Nahuel Greco <ngreco@gmail.com>
Naoya Yamashita <conao3@gmail.com>
Nguyễn Hà Dương <cmpitg@gmail.com>
Nick Alcock <nick.alcock@oracle.com>
Nick McCurdy <nick@nickmccurdy.com>
Nico Wagner <nico@cryptopone.org>
Nicolas Dudebout <nicolas.dudebout@gmail.com>
Nicolas Dudebout <nicolas.dudebout@gmail.com> <nicolas.dudebout@gatech.edu>
Nicolas Richard <theonewiththeevillook@yahoo.fr>
Noam Postavsky <npostavs@gmail.com>
Noam Postavsky <npostavs@gmail.com> <npostavs@users.sourceforge.net>
Payas Relekar <relekarpayas@gmail.com>
Peter Hoeg <peter@speartail.com>
Peter Mosmans <support@go-forward.net>
Phil Hudson <phil.hudson@iname.com>
Philipp Stephani <phst@google.com>
Philippe Vaucher <philippe.vaucher@gmail.com>
Philippe Vaucher <philippe.vaucher@gmail.com> <philippe@stvs.ch>
Phillip Lord <phillip.lord@russet.org.uk>
Phillip Lord <phillip.lord@russet.org.uk> <phillip.lord@newcastle.ac.uk>
Radon Rosborough <radon.neon@gmail.com>
Rich Murphey <rich@murphey.org>
Russell Black <black.russell@gmail.com>
Russell Black <black.russell@gmail.com> <killdash9>
Sacha Chua <sacha@sachachua.com>
Sasanidas <fmfs@posteo.net>
Sean Allred <code@seanallred.com>
Shohei YOSHIDA <syohex@gmail.com>
Stefan Kangas <stefankangas@gmail.com>
Steve Purcell <steve@sanityinc.com>
Sylvain Benner <sylvain.benner@gmail.com>
Ted Zlatanov <tzz@lifelogs.com>
Terencio Agozzino <terencio.agozzino@gmail.com>
The Gitter Badger <badger@gitter.im>
Thiago Barroso Perrotta <thiagoperrotta95@gmail.com>
Thierry Volpiatto <thierry.volpiatto@gmail.com>
Thomas Frössman <thomasf@jossystem.se>
Thomas Ingram <taingram@mtu.edu>
Ting-Yu Lin <aethanyc@gmail.com>
Troy Hinckley <t.macman@gmail.com>
Valentin Ignatev <valentjedi@gmail.com>
Vincent Zhang <seagle0128@gmail.com>
Wang Chunye <chunywan@xilinx.com>
Yurii Kholodkov <urist.mckorobochka@gmail.com>
keithmantell <keithmantell@gmail.com>
rws <elisp.vim@gmail.com>
wouter bolsterlee <wouter@bolsterl.ee>
default.mk
doc/.nosearch
doc/config.toml
doc/content/.gitkeep
doc/layouts/section/issues.html
doc/Makefile
doc/README.org
doc/setup-ox-hugo.el
doc/static/css/github_chroma.css
doc/static/css/style.css
doc/static/favicon-16x16.png
doc/static/favicon-32x32.png
doc/static/favicon-96x96.png
doc/static/favicon.ico
doc/static/img/logo-raw/use-package-logo-16x16-v1.ai
doc/static/img/logo-raw/use-package-logo-16x16-v1.svg
doc/static/img/logo-raw/use-package-logo-32x32-v1.ai
doc/static/img/logo-raw/use-package-logo-32x32-v1.svg
doc/static/img/logo-raw/use-package-logo-48x48-v1.ai
doc/static/img/logo-raw/use-package-logo-48x48-v1.svg
doc/static/img/logo-raw/use-package-logo-96x96-v1.ai
doc/static/img/logo-raw/use-package-logo-96x96-v1.svg
doc/static/img/logo-raw/use-package-logo-raw-v1.ai
doc/static/img/use-package-logo-96x96-v1.svg
doc/themes/hugo-alabaster-theme/index.html
doc/themes/hugo-alabaster-theme/layouts/404.html
doc/themes/hugo-alabaster-theme/layouts/_default/baseof.html
doc/themes/hugo-alabaster-theme/layouts/_default/single.html
doc/themes/hugo-alabaster-theme/layouts/index.html
doc/themes/hugo-alabaster-theme/layouts/partials/footer.html
doc/themes/hugo-alabaster-theme/layouts/partials/head.html
doc/themes/hugo-alabaster-theme/layouts/partials/sidebar/buttons.html
doc/themes/hugo-alabaster-theme/layouts/partials/sidebar/menu.html
doc/themes/hugo-alabaster-theme/layouts/partials/sidebar/sidebar.html
doc/themes/hugo-alabaster-theme/layouts/shortcodes/admonition.html
doc/themes/hugo-alabaster-theme/LICENSE.md
doc/themes/hugo-alabaster-theme/README.md
doc/themes/hugo-alabaster-theme/static/css/alabaster.css
doc/themes/hugo-alabaster-theme/static/css/basic.css
.dir-locals.el
.elpaignore
.github/workflows/test.yml
.gitignore
.travis.yml
LICENSE
Makefile
Makefile.doc
Makefile.lisp
README.md
use-package.org
# elisp
bind-chord.el==>lisp/use-package/bind-chord.el
bind-key.el==>lisp/use-package/bind-key.el
use-package-bind-key.el==>lisp/use-package/use-package-bind-key.el
use-package-chords.el==>lisp/use-package/use-package-chords.el
use-package-core.el==>lisp/use-package/use-package-core.el
use-package-delight.el==>lisp/use-package/use-package-delight.el
use-package-diminish.el==>lisp/use-package/use-package-diminish.el
use-package-ensure-system-package.el==>lisp/use-package/use-package-ensure-system-package.el
use-package-ensure.el==>lisp/use-package/use-package-ensure.el
use-package-jump.el==>lisp/use-package/use-package-jump.el
use-package-lint.el==>lisp/use-package/use-package-lint.el
use-package.el==>lisp/use-package/use-package.el
# documentation
NEWS.md==>etc/USE-PACKAGE-NEWS
use-package.texi==>doc/misc/use-package.texi
# tests
use-package-tests.el==>test/lisp/use-package/use-package-tests.el
use-package-chords-tests.el==>test/lisp/use-package/use-package-chords-tests.el
#!/bin/bash
# Based on https://gist.github.com/joaotavora/2ed97f2ec85958986983d5cb78202770
# It does the following things:
#
# - Move use-package.el to lisp/progmodes/use-package.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 use-package/.git || git clone https://github.com/jwiegley/use-package
test -d emacs/.git || git clone -b master git://git.sv.gnu.org/emacs.git
# filter use-package to keep only relevant files. This destroys the current
# worktree of the repo.
#
# move use-package.el to lisp/progmodes/use-package.el -> This makes history file
# specific and everything makes find+replace in commit messages
(
cd use-package
git filter-repo -f --message-callback ../adjust-issue-references.py
# delete files
git filter-repo --paths-from-file ../paths-delete.txt --invert-paths
# keep files
git filter-repo -f --paths-from-file ../paths.txt
# mark some commits as exempt
git filter-repo -f --commit-callback ../adjust-some-commits.py
git filter-repo -f --mailmap ../mailmap.txt
)
(
cd emacs
git fetch
git reset --hard origin/master
# add filtered use-package as upstream
git remote add use-package2emacs-filtered-use-package ../use-package/
git fetch use-package2emacs-filtered-use-package master
git merge remotes/use-package2emacs-filtered-use-package/master --allow-unrelated-histories --no-commit
# make a commit
git commit -m "; Merge from https://github.com/jwiegley/use-package"
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment