Sign in Join
Wiki copytemporary

Creating A Patch/de: what changed

Revision 1 to 2. Removed lines have a minus sign; added lines have a plus sign.

OldNewLine
11Falls Sie Verbesserungen am Code von FPC oder Lazarus haben, sollten Sie uns diese als "Patch" zusenden, den die Entwickler leicht einbauen können.
22
33Ausnahmen:
44
551. .po Übersetzungsdateien sollten Sie als vollständige Dateien schicken.
662. Neue Dateien sollten Sie ebenso als vollständige Dateien schicken, zusammen mit Instruktionen wo diese plaziert werden müssen.
77
88## Voraussetzungen
99
1010Sie können sich Lazarus mittels Git oder SVN besorgen.
1111
1212- Git: <https://gitlab.com/freepascal.org/lazarus/lazarus> Dies ist das originale Repositorium.
1313- SVN:
1414
15-`svn checkout --depth files `[`https://github.com/fpc/Lazarus/branches`](https://github.com/fpc/Lazarus/branches)` all`\
16-`cd all`\
17-`svn update --set-depth infinity main`
15+```text
16+svn checkout --depth files https://github.com/fpc/Lazarus/branches all
17+cd all
18+svn update --set-depth infinity main
19+```
1820
1921## Plattformspezifische Unterschiede
2022
2123Die folgenden Instruktionen setzen voraus, dass Sie eine Befehlszeile geöffnet haben und dass Sie mittels des Befehls cd in das Verzeichnis des Repositoriums gewechselt haben. Hier sind die Details:
2224
2325### Windows
2426
2527Falls Sie ein Checkout von Lazarus in C:\lazarus haben:
2628
27291. Öffnen Sie eine Befehlszeile, z.B. Start, geben Sie **cmd.exe** ein, {drücken Sie EINGABE} und gehen Sie ins Lazarus-Quelltext-Verzeichnis:
2830
29312. ```dos
3032 c:
3133 ```
3234
33353. ```dos
3436 cd \lazarus
3537 ```
3638
3739Siehe auch [[TortoiseSvn|TortoiseSvn#Troubleshooting]], wenn es Probleme gibt.
3840
3941### *nix Systeme
4042
4143Falls Sie ein Checkout von Lazarus in ~/lazarus haben:
4244
43451. Öffnen Sie Ihr bevorzugtes Terminalprogramm
4446
45472. ``` bash
4648 cd ~/lazarus
4749 ```
4850
4951## Erzeugen eines Patchs mittels SVN
5052
5153``` bash
5254svn diff > mypatch.diff
5355```
5456
5557Dies schließt sämtliche veränderten Dateien im gesamten SVN-Repositorium ein.
5658
5759Sie können aber auch die einzelnen Dateien definieren, damit sicher kein überflüssiger Dateimüll enthalten ist, z.B.:
5860
5961``` bash
6062svn diff ide/main.pp ideintf/objectinspector.pp > mypatch.diff
6163```
6264
6365## Erzeugen eines Patchs mittels Git
6466
6567Als Erstes: Entwickeln Sie Ihren Code in einem separaten Zweig! Solange Ihr Entwicklungszweig aktiv ist, können Sie Patches all Ihrer lokalen Commits erzeugen über:
6668
6769``` bash
6870git format-patch master
6971```
7072
7173Dies erzeugt einen Satz von Patches mit Namen wie "0001-CommitMsg.patch", "0002-CommitMsg.patch" und so weiter.
7274
7375Falls Sie all Ihre Änderungen in einem einzigen Patch wollen, kombinieren Sie entweder die Commits mittels "git rebase -i ..." oder benutzen Sie folgenden Befehl:
7476
7577``` bash
7678git format-patch master --stdout > mypatch.patch
7779```
7880
7981## Übermitteln des Patchs
8082
8183Jetzt haben Sie einen Patch. Ich empfehle Ihnen, sich diese Datei einmal anzusehen, ob alles gut aussieht (- keine unerwarteten Änderungen).
8284
8385Der empfohlene Weg, einen Patch zu übermitteln, ist über den [bug tracker](http://bugs.freepascal.org), siehe [[How do I create a bug report]] für Details. Falls dort ein Bericht vorliegt über das Problem, das Ihr Patch beseitigt, dann benutzen Sie diesen. Andernfalls erzeugen Sie einen neuen Eintrag. Laden Sie die Datei als Anhang zu diesem Fehlerbericht hoch.
8486
8587## Using a forked Git repository directly
8688
8789It is possible to use Git in a distributed manner also for Lazarus development. At least developers JuhaManninen and Alexander Klenin ("Ask") are ready to accept code in a Git repository.
8890
8991In practice the repository must be forked from the Lazarus mirror in GitHub. The code must be in a separate branch and rebased against "upstream" branch. This is not tested yet, we can add more details here when somebody actually forks the repo and creates code.
9092
9193The limitation of this model is that the code must belong to the area of expertise of the developers working with Git. If the code is outside that area, you can still use Git but you must create patches and send them to bug tracker.
9294
9395## Applying a patch
9496
9597This explains how to apply somebody else's patch to your local repository. You can test the patch by using the --dry-run toggle switch like this:
9698
9799``` bash
98100patch --dry-run < somepatch.diff
99101```
100102
101103The output of the patch program will be identical to the actual patching, only it does not alter the sourcecode files. Very handy for testing, without the possibility to screw up your source.
102104
103105### A patch made with "svn diff"
104106
105107To do the final patching, use the following commandline:
106108
107109``` bash
108110patch < somepatch.diff
109111```
110112
111113If that doesn't work because the path layout of your environment is different from the environment where the patch was created, you can tell *patch* to strip out all path information:
112114
113115``` bash
114116patch -p0 < somepatch.diff
115117```
116118
117119Any GUI tool for diffs on Windows can handle these patches, too.
118120
119121### A patch made with "git format-patch"
120122
121123#### Git
122124
123125Git itself applies the patch like this :
124126
125127``` bash
126128git apply 0001-gitpatch.patch
127129```
128130
129131#### patch
130132
131133The "patch" command now supports git format patches with -p1. This is tested with patch v.2.6.1 on Linux, old versions may not support it.
132134
133135``` bash
134136patch -p1 < 0001-gitpatch.patch
135137```
136138
137139"patch" is available for Windows, too, but there are also GUI tools for the job.
138140
139141#### TortoiseMerge
140142
141143TortoiseMerge supports the Git format patch without problems. It is installed together with Tortoise SVN but is not integrated in explorer. It must be opened from the Start menu.
142144
143145ToDo: add more GUI tools that support Git format patches
144146
145147### Troubleshooting
146148
147149Finally, patches may have a Unix/Linux line ending (LF) while your local file has Windows (CR+LF) line endings or vice versa. You'll have to convert the patch file before applying on Windows at least, as the supplied patch.exe is picky about line endings.
148150
149151On Windows, the patch.exe supplied with FPC/Lazarus is very picky; you may have better luck with the patch.exe supplied by Git:
150152
151153```dos
152154"C:\Program Files (x86)\Git\bin\patch.exe" -p0 < mypatch.diff
153155```
154156
155157## See also
156158
157159- [[How do I create a bug report]] general information on bug reporting
158160- [[Tips on writing bug reports]] detailed information on what should be covered in a bug report.
159161- [[Database bug reporting]] Specific info and sample programs for database bugs
160162
161163---
162164*From the Free Pascal wiki, page "Creating A Patch/de", as it stood on 2022-01-13 after a change by Trev, out of the wiki's dump of 2024-05-26. Copyright stays with the author who wrote it, according to the old wiki's [[Licensing]] page. If you have concerns about this material, [message the admin](/wiki-contact).*
163165Category: Debugging/de
164166Category: Lazarus/de
165167Category: Tutorials/de

Back to history