Introduce scoped PR patches over "main-branch" patches
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Idoneità per principianti
- 30/100
- Tipo di issue
- Funzionalità
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Attiva
- Stack tecnologico
- kotlin
- Ambito
- build-system, tooling
Direzione di ricerca
Start by reading the existing applyPatches workflow and how patches are organized in patches/sources and patches/features. The proposed entry points are fixupPrSourcePatches, rebuildPrPatches, and updateWithPrPatches; the issue leaves their design open. Done would mean PR patches can be created, applied after main patches, and incorporated into main patches as described in the example workflow.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
The Problem
When one wants to PR a change to Paper that involves editing (feature) patches, one regularly simply PRs the diff from the original patch file to the new, through the PR updated patch file.
This however introduces very annoying merge conflicts as soon as the very same patch file is updated on the main branch in the meantime. Those merge conflicts can oftentimes be annoying to solve for bigger feature patches, such as Moonrise, which may mean to completely re-apply your PR's changes by hand.
Additionally, the diff of a diff is very busy for review. For example, the very simple change below:
Now of course this is something that should just be an access transformer, but I think it highlights that noise very well. You have the actual changes the PR does (replace a private with a public), but you also have the big red and green highlighted lines caused by the diff file syntax highlighting.
Proposal
I propose to introduce a new feature to paperweight, which allows PR authors to create "pr-patches". This feature would work similarly to regular patches, except that they are stored in a separate directory (as file patches are stored in patches/sources, file pr-patches would be stored in patches/sources-pr.) Pr-patches would be applied right after the main patch. This means the primary patch stays unedited, and the pr-patch patches over the already patched Java file.
For the purpose of the above, the Gradle tasks, fixupPrSourcePatches and rebuildPrPatches, for patch creation, and updateWithPrPatches, for applying the PR patches directly onto the "main" patches, used right before a PR is merged (this could maybe also be automatized), would be introduced.
Implementation
The implementation of these is of course its own interesting difficulty. It is not really possible to differentiate between main-patch and pr-patch based on the commit history of the patched minecraft directory alone. Instead, when applyPatches is run, paperweight would have to keep track of which commits are applied by the main patches. The pr-patches Gradle tasks would basically operate on the commits not kept track of by paperweight.
For feature patches specifically, it could depend on how the commit actually looks. If the commit history notices that a feature-patch commit was edited, it could take the diff as a direct "edit" and create a feature patch in the pr-patched directory with the same name as the original patch, again with only the changes being recorded. If a new commit is added after a feature patch commit, paperweight could treat it as the user wanting to add a new feature patch entirely. For all intends and purposes, that would create a new pr-patched feature patch with the same number, but different name.
Example Workflow
- User checks out PaperMC/Paper (main) --> New branch (feat) -->
gradle applyPatches - User edits the commit for
0016-Optimise-EntityScheduler-ticking.patchinside the patched directory gradle rebuildPrPatches-> New file created:patches/features-pr/0016-Optimise-EntityScheduler-ticking.patch, with only the changes ontop of the existing feature patch- Main branch gets updated, with changes to EntityScheduler
- User:
git pull && git merge main--> No merge commit -->gradle applyPatches--> Conflict; triggers new three-way merge on the affected files - User fixes conflicts -->
gradle rebuildPrPatches-->git push - Maintainer can review the changes --> Maintainer:
gradle updateWithPrPatches--> CI passes --> Merge
And everything works out nicely! That's kinda what I envision. Same would also work for file patches, even though admittedly, it doesn't have as much demand there.
Closing notes
I think this could make both the process of maintaining a PR over an extended period of time, as well as the process of reviewing a PR a more pleasant process. The task names I have given here are only first draft examples, I am obviously open to different naming and general changes.
I would generally be ready to open a paperweight PR to implement this. But as is good etiquette with bigger changes such as this, I would really love opinions by paperweight maintainers and users alike on this feature. This should also work for forks accepting contributions just as well as it would for Paper itself.
- Lingua principale
- Kotlin
- Stelle
- 321
- Fork
- 77
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Preparare l'ambiente
Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di PaperMC/paperweight
-
Gradle Isolated Projects IncompatibilityForse già presa @Toffikk l’ha presa 58 giorni fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
PaperMC/paperweight#397 · 1 commento · 2 reazioni ·
-
Option to fail on missing/failed AT applicationForse già presa Una pull request collegata a questa issue è aperta o già unita. Aperta
Difficoltà 3/5 1-2 giorni Idoneità per principianti 45/100
PaperMC/paperweight#344 · 1 commento ·
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 35/100
PaperMC/paperweight#324 · 7 commenti ·
-
Dependency DashboardApertadependencies
Difficoltà 4/5 3-5 giorni Idoneità per principianti 25/100
PaperMC/paperweight#293 ·
-
status: accepted
Difficoltà 4/5 3-5 giorni Idoneità per principianti 45/100
PaperMC/paperweight#288 · 1 commento ·
Tutte le issue di PaperMC/paperweight
Issue simili
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
LeanBitLab/LeanType#864 ·
I maintainer di solito rispondono entro 1 giorno
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 61/100
PixelPlayerHQ/PixelPlayerOSS#249 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 66/100
streetcomplete/StreetComplete#7395 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 82/100
134130/intellij-mise#552 ·