Typo3 - Patch einspielen: Unterschied zwischen den Versionen
| (Eine dazwischenliegende Version desselben Benutzers wird nicht angezeigt) | |||
| Zeile 1: | Zeile 1: | ||
| − | Creating a "diff" | + | == Tipp == |
| + | Textmate kann das auch: Patchfile (.diff) in Textmate öffnen. Oben im Patchfile steht normalerweise auf welchen Pfad sich das Patch bezieht. Dann mit Bundles / Diff / Apply Patch to Files anwenden. | ||
| + | |||
| + | == Creating a "diff" == | ||
A "diff" is a file that contains just the differences between two files. Diffs are widely used for development because they allow easy reviewing of changes to the program code. There are various styles of diff output. It is important to know that for TYPO3 development we almost only use the "unified diff" (a diff variant that contains three lines of context before and after that part that was changed). | A "diff" is a file that contains just the differences between two files. Diffs are widely used for development because they allow easy reviewing of changes to the program code. There are various styles of diff output. It is important to know that for TYPO3 development we almost only use the "unified diff" (a diff variant that contains three lines of context before and after that part that was changed). | ||
| − | The | + | The '''opposite part of "diff" is "patch"''', a program that can apply changes from a diff file to the original code. |
Here are the two most important commands: | Here are the two most important commands: | ||
| Zeile 9: | Zeile 12: | ||
Create a unified diff of two directories: | Create a unified diff of two directories: | ||
| − | diff -ru typo3_src.orig/ typo3_src.new/ > bug_1234.diff | + | diff -ru typo3_src.orig/ typo3_src.new/ > bug_1234.diff |
| − | How to apply a patch | + | '''How to apply a patch''' |
Patch your source code using a diff file: | Patch your source code using a diff file: | ||
| − | cd typo3_src.new/ | + | cd typo3_src.new/ |
| − | patch --dry-run -p1 < ../bug_1234.diff | + | patch --dry-run -p1 < ../bug_1234.diff |
(Use the --dry-run parameter to first check if the patch applies successfully. Run the same command again without this parameter to make the changes affect.) | (Use the --dry-run parameter to first check if the patch applies successfully. Run the same command again without this parameter to make the changes affect.) | ||
Aktuelle Version vom 1. Mai 2010, 20:25 Uhr
Tipp[Bearbeiten]
Textmate kann das auch: Patchfile (.diff) in Textmate öffnen. Oben im Patchfile steht normalerweise auf welchen Pfad sich das Patch bezieht. Dann mit Bundles / Diff / Apply Patch to Files anwenden.
Creating a "diff"[Bearbeiten]
A "diff" is a file that contains just the differences between two files. Diffs are widely used for development because they allow easy reviewing of changes to the program code. There are various styles of diff output. It is important to know that for TYPO3 development we almost only use the "unified diff" (a diff variant that contains three lines of context before and after that part that was changed).
The opposite part of "diff" is "patch", a program that can apply changes from a diff file to the original code.
Here are the two most important commands:
Create a unified diff of two directories:
diff -ru typo3_src.orig/ typo3_src.new/ > bug_1234.diff
How to apply a patch
Patch your source code using a diff file:
cd typo3_src.new/ patch --dry-run -p1 < ../bug_1234.diff
(Use the --dry-run parameter to first check if the patch applies successfully. Run the same command again without this parameter to make the changes affect.)